From ad4be2310877ffdec7fa859e9b5daeec76e01105 Mon Sep 17 00:00:00 2001 From: rustdreamer Date: Mon, 8 Apr 2024 21:51:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2=E8=AE=BF?= =?UTF-8?q?=E5=AE=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.controller.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/app.controller.ts b/src/app.controller.ts index 2c11b13..5ba6230 100644 --- a/src/app.controller.ts +++ b/src/app.controller.ts @@ -260,6 +260,11 @@ export class QueryVisitorByNumberDto { @IsString() @IsNotEmpty() identity_card_no: string + + @ApiPropertyOptional({ description: "", required: false }) + @IsString() + @IsOptional() + area_code?: string } @Controller() @@ -301,11 +306,15 @@ export class AppController { // } @Get("/visitor") @ApiBearerAuth() - async getVisiotr(@Query() { identity_card_no }: QueryVisitorByNumberDto, @Req() req: any) { + async getVisiotr(@Query() { identity_card_no, area_code }: QueryVisitorByNumberDto, @Req() req: any) { let date = new Date().toDateString(); let node_other_visitor; + const where: any = { identity_card_no, end_time: IsNull() }; + if (area_code) { + where.to_area_code = area_code; + } const node_other_visitors: any = await this.nodeOtherVisitorRepository.find({ - where: { identity_card_no, end_time: IsNull() }, + where, order: { created_date: "DESC" }