add command code 20
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m3s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m3s
This commit is contained in:
parent
b1210d51e8
commit
757da877f6
8 changed files with 268 additions and 218 deletions
|
|
@ -275,7 +275,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
// ],
|
||||
where: {
|
||||
profileEmployeeId: id,
|
||||
commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16"]),
|
||||
commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16", "20"]),
|
||||
},
|
||||
order: { order: "ASC" },
|
||||
});
|
||||
|
|
@ -1423,7 +1423,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
const position_raw = await this.salaryRepo.find({
|
||||
where: {
|
||||
profileEmployeeId: id,
|
||||
commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16"]),
|
||||
commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16", "20"]),
|
||||
isEntry: false,
|
||||
},
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -5735,61 +5735,61 @@ export class ProfileEmployeeController extends Controller {
|
|||
if (!findRevision) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||
}
|
||||
|
||||
|
||||
let queryLike = "1=1";
|
||||
switch (body.fieldName) {
|
||||
case "citizenId":
|
||||
queryLike = "profile.citizenId LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "fullname":
|
||||
case "fullName":
|
||||
queryLike =
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "firstname":
|
||||
case "firstName":
|
||||
queryLike = "profile.firstName LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "lastname":
|
||||
case "lastName":
|
||||
queryLike = "profile.lastName LIKE :keyword";
|
||||
break;
|
||||
|
||||
default:
|
||||
queryLike = "1=1";
|
||||
break;
|
||||
}
|
||||
|
||||
let query = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
.where("profile.keycloak IS NULL")
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });
|
||||
}),
|
||||
);
|
||||
|
||||
const [findProfile, total] = await query
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
.getManyAndCount();
|
||||
switch (body.fieldName) {
|
||||
case "citizenId":
|
||||
queryLike = "profile.citizenId LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "fullname":
|
||||
case "fullName":
|
||||
queryLike =
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "firstname":
|
||||
case "firstName":
|
||||
queryLike = "profile.firstName LIKE :keyword";
|
||||
break;
|
||||
|
||||
case "lastname":
|
||||
case "lastName":
|
||||
queryLike = "profile.lastName LIKE :keyword";
|
||||
break;
|
||||
|
||||
default:
|
||||
queryLike = "1=1";
|
||||
break;
|
||||
}
|
||||
|
||||
let query = await this.profileRepo
|
||||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
.where("profile.keycloak IS NULL")
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });
|
||||
}),
|
||||
);
|
||||
|
||||
const [findProfile, total] = await query
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
const mapDataProfile = await Promise.all(
|
||||
findProfile.map(async (item: ProfileEmployee) => {
|
||||
const fullName = `${item.prefix} ${item.firstName} ${item.lastName}`;
|
||||
let shortName = null;
|
||||
let root = null;
|
||||
let root = null;
|
||||
let posMasterNo = null;
|
||||
if (item.isLeave == false) {
|
||||
shortName =
|
||||
|
|
@ -5800,14 +5800,15 @@ export class ProfileEmployeeController extends Controller {
|
|||
null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3 !=
|
||||
null
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgChild3 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgChild2 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild2.orgChild2ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
|
||||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id) !=
|
||||
null &&
|
||||
item.current_holders.find((x) => x.orgRevisionId == findRevision.id)
|
||||
?.orgChild1 != null
|
||||
? `${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName} ${item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
|
||||
|
|
@ -5828,21 +5829,36 @@ export class ProfileEmployeeController extends Controller {
|
|||
posMasterNo = item.current_holders?.find(
|
||||
(x) => x.orgRevisionId == findRevision.id,
|
||||
)?.posMasterNo;
|
||||
}
|
||||
else {
|
||||
const profileSalary = await this.salaryRepo
|
||||
} else {
|
||||
const profileSalary = await this.salaryRepo
|
||||
.createQueryBuilder("s")
|
||||
.where("s.profileEmployeeId = :profileId", { profileId: item.id })
|
||||
.andWhere("s.commandCode IN (:...codes)", {
|
||||
codes: ["0","9","1","2","3","4","8","10","11","12","13","14","15","16"],
|
||||
codes: [
|
||||
"0",
|
||||
"9",
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"8",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"16",
|
||||
"20",
|
||||
],
|
||||
})
|
||||
.orderBy("s.order", "DESC")
|
||||
.addOrderBy("s.createdAt", "DESC")
|
||||
.take(2)
|
||||
.getMany();
|
||||
if (profileSalary.length > 0) {
|
||||
shortName = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
shortName = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
? `${profileSalary[1]?.posNoAbb} ${profileSalary[1]?.posNo}`
|
||||
: `${profileSalary[0]?.posNoAbb} ${profileSalary[0]?.posNo}`
|
||||
: `${profileSalary[0]?.posNoAbb} ${profileSalary[0]?.posNo}`;
|
||||
|
|
@ -5851,14 +5867,13 @@ export class ProfileEmployeeController extends Controller {
|
|||
? profileSalary[1]?.posNo
|
||||
: profileSalary[0]?.posNo
|
||||
: profileSalary[0]?.posNo;
|
||||
root = item.isRetirement
|
||||
root = item.isRetirement
|
||||
? profileSalary.length > 1
|
||||
? profileSalary[1]?.orgRoot
|
||||
: profileSalary[0]?.orgRoot
|
||||
: profileSalary[0]?.orgRoot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const latestProfileEducation = await this.profileEducationRepo.findOne({
|
||||
where: { profileEmployeeId: item.id },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue