fix
This commit is contained in:
parent
e6539edaec
commit
52e0141de4
3 changed files with 52 additions and 14 deletions
|
|
@ -1356,6 +1356,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
*/
|
||||
@Post("search-personal")
|
||||
async getProfileBySearchKeyword(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Body()
|
||||
body: {
|
||||
fieldName: string;
|
||||
|
|
@ -1363,9 +1365,12 @@ export class ProfileEmployeeController 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",
|
||||
|
|
@ -1378,11 +1383,13 @@ export class ProfileEmployeeController 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",
|
||||
|
|
@ -1395,11 +1402,13 @@ export class ProfileEmployeeController 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",
|
||||
|
|
@ -1412,11 +1421,13 @@ export class ProfileEmployeeController 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",
|
||||
|
|
@ -1428,6 +1439,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
"current_holders.orgChild3",
|
||||
"current_holders.orgChild4",
|
||||
],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
@ -1517,7 +1530,7 @@ export class ProfileEmployeeController 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,
|
||||
|
|
@ -1579,7 +1592,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess(mapDataProfile);
|
||||
return new HttpSuccess({ data: mapDataProfile, total });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue