fix: when no keyword, list cannot be found
This commit is contained in:
parent
8a1400d840
commit
ed7b15ebbe
1 changed files with 10 additions and 8 deletions
|
|
@ -186,7 +186,7 @@ export class ProfileController extends Controller {
|
|||
async listProfile(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("keyword") keyword?: string,
|
||||
@Query("keyword") keyword: string = "",
|
||||
) {
|
||||
const [record, total] = await this.profileRepo.findAndCount({
|
||||
relations: {
|
||||
|
|
@ -196,13 +196,15 @@ export class ProfileController extends Controller {
|
|||
relationship: true,
|
||||
bloodGroup: true,
|
||||
},
|
||||
where: {
|
||||
citizenId: Like(`%${keyword}%`),
|
||||
position: Like(`%${keyword}%`),
|
||||
prefix: Like(`%${keyword}%`),
|
||||
firstName: Like(`%${keyword}%`),
|
||||
lastName: Like(`%${keyword}%`),
|
||||
},
|
||||
where: [
|
||||
{ citizenId: Like(`%${keyword}%`) },
|
||||
{ position: Like(`%${keyword}%`) },
|
||||
{ prefix: Like(`%${keyword}%`) },
|
||||
{ firstName: Like(`%${keyword}%`) },
|
||||
{ lastName: Like(`%${keyword}%`) },
|
||||
{ email: Like(`%${keyword}%`) },
|
||||
{ telephoneNumber: Like(`%${keyword}%`) },
|
||||
],
|
||||
order: { createdAt: "ASC" },
|
||||
skip: (page - 1) * pageSize,
|
||||
take: pageSize,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue