feat: users filter
This commit is contained in:
parent
8800008d27
commit
fdc6af9e20
|
@ -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
|
||||
|
||||
```
|
||||
|
||||
|
|
|
@ -95,4 +95,9 @@ export class UserQueryDto extends IntersectionType(PagerDto<UserDto>, PartialTyp
|
|||
@IsInt()
|
||||
@IsOptional()
|
||||
status?: number;
|
||||
|
||||
@ApiProperty({ description: '关键字' })
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
keyword?: string;
|
||||
}
|
||||
|
|
|
@ -249,7 +249,8 @@ export class UserService {
|
|||
nickname,
|
||||
deptId,
|
||||
email,
|
||||
status
|
||||
status,
|
||||
keyword
|
||||
}: UserQueryDto): Promise<Pagination<UserEntity>> {
|
||||
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<UserEntity>(queryBuilder, {
|
||||
page,
|
||||
pageSize
|
||||
|
|
Loading…
Reference in New Issue