fix
This commit is contained in:
parent
e6539edaec
commit
52e0141de4
3 changed files with 52 additions and 14 deletions
|
|
@ -1934,6 +1934,8 @@ export class ProfileController extends Controller {
|
|||
*/
|
||||
@Post("search-personal")
|
||||
async getProfileBySearchKeyword(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Body()
|
||||
body: {
|
||||
fieldName: string;
|
||||
|
|
@ -1941,9 +1943,12 @@ export class ProfileController extends Controller {
|
|||
},
|
||||
) {
|
||||
let findProfile: any;
|
||||
let total: any;
|
||||
const skip = (page - 1) * pageSize;
|
||||
const take = pageSize;
|
||||
switch (body.fieldName) {
|
||||
case "idcard":
|
||||
findProfile = await this.profileRepo.find({
|
||||
case "citizenId":
|
||||
[findProfile, total] = await this.profileRepo.find({
|
||||
where: { citizenId: Like(`%${body.keyword}%`) },
|
||||
relations: [
|
||||
"posType",
|
||||
|
|
@ -1956,11 +1961,13 @@ export class ProfileController extends Controller {
|
|||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
|
||||
case "firstname":
|
||||
findProfile = await this.profileRepo.find({
|
||||
[findProfile, total] = await this.profileRepo.find({
|
||||
where: { firstName: Like(`%${body.keyword}%`) },
|
||||
relations: [
|
||||
"posType",
|
||||
|
|
@ -1973,11 +1980,13 @@ export class ProfileController extends Controller {
|
|||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
|
||||
case "lastname":
|
||||
findProfile = await this.profileRepo.find({
|
||||
[findProfile, total] = await this.profileRepo.find({
|
||||
where: { lastName: Like(`%${body.keyword}%`) },
|
||||
relations: [
|
||||
"posType",
|
||||
|
|
@ -1990,11 +1999,13 @@ export class ProfileController extends Controller {
|
|||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
findProfile = await this.profileRepo.find({
|
||||
[findProfile, total] = await this.profileRepo.find({
|
||||
relations: [
|
||||
"posType",
|
||||
"posLevel",
|
||||
|
|
@ -2006,6 +2017,8 @@ export class ProfileController extends Controller {
|
|||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
@ -2095,7 +2108,7 @@ export class ProfileController extends Controller {
|
|||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
position: item.position,
|
||||
idcard: item.citizenId,
|
||||
citizenId: item.citizenId,
|
||||
email: item.email,
|
||||
phone: item.phone,
|
||||
name: fullName,
|
||||
|
|
@ -2157,7 +2170,7 @@ export class ProfileController extends Controller {
|
|||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess(mapDataProfile);
|
||||
return new HttpSuccess({ data: mapDataProfile, total });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue