diff --git a/README.md b/README.md index 04406fe..f08f061 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ docker rmi huaxin-admin-server:stable ```bash pnpm docker:logs # or -docker compose --env-file .env --env-file .env.production logs -f +docker-compose --env-file .env --env-file .env.production logs -f ``` diff --git a/src/modules/user/dto/user.dto.ts b/src/modules/user/dto/user.dto.ts index 3b2c3c7..f7efc73 100644 --- a/src/modules/user/dto/user.dto.ts +++ b/src/modules/user/dto/user.dto.ts @@ -95,4 +95,9 @@ export class UserQueryDto extends IntersectionType(PagerDto, PartialTyp @IsInt() @IsOptional() status?: number; + + @ApiProperty({ description: '关键字' }) + @IsString() + @IsOptional() + keyword?: string; } diff --git a/src/modules/user/user.service.ts b/src/modules/user/user.service.ts index a3a2867..afb8345 100644 --- a/src/modules/user/user.service.ts +++ b/src/modules/user/user.service.ts @@ -249,7 +249,8 @@ export class UserService { nickname, deptId, email, - status + status, + keyword }: UserQueryDto): Promise> { const queryBuilder = this.userRepository .createQueryBuilder('user') @@ -264,7 +265,15 @@ export class UserService { }); if (deptId) queryBuilder.andWhere('dept.id = :deptId', { deptId }); - + if (keyword) { + //关键字模糊查询product的name,productNumber,productSpecification + queryBuilder.andWhere( + '(user.name like :keyword or dept.name like :keyword)', + { + keyword: `%${keyword}%` + } + ); + } return paginate(queryBuilder, { page, pageSize