fix
This commit is contained in:
1 parent
081b3a303d
commit
60df57ceb2
1 file changed
+14
@@ -1,7 +1,21 @@
|
||||
import { BaseFilter } from '../../core/dto/base.filter';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsOptional } from 'class-validator';
|
||||
import { Like } from 'typeorm';
|
||||
|
||||
export class SearchCategoryFilter extends BaseFilter {
|
||||
@ApiProperty()
|
||||
order = ['+order', '-createdTime'];
|
||||
|
||||
@ApiProperty({ required: false, description: '分类名称检索', example: '猫' })
|
||||
@IsOptional()
|
||||
name?: string;
|
||||
|
||||
getConditions(): Record<string, any> {
|
||||
const conditions: Record<string, any> = {};
|
||||
if (this.name) {
|
||||
conditions.name = Like(`%${this.name}%`); // 假设使用模糊查询
|
||||
}
|
||||
return conditions;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user