fixed add isGovernment & commandDateAffect
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m12s

This commit is contained in:
Warunee Tamkoo 2026-04-28 16:53:15 +07:00
parent 2a5fba2dfc
commit 190a5d665a
4 changed files with 68 additions and 32 deletions

View file

@ -133,8 +133,8 @@ export class ProfileSalaryTempController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
`current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,
@ -545,8 +545,8 @@ export class ProfileSalaryTempController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: `current_holders.orgChild1Id is null`
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
`current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1,
@ -1233,6 +1233,13 @@ export class ProfileSalaryTempController extends Controller {
isDelete: false,
};
Object.assign(data, { ...body, ...meta });
if (["12", "15", "16"].includes(body.commandCode ?? "")) {
data.isGovernment = false;
if (body.commandDateAffect) data.dateGovernment = body.commandDateAffect;
} else if (["1", "2", "3", "4", "10", "11", "20"].includes(body.commandCode ?? "")) {
data.isGovernment = true;
if (body.commandDateAffect) data.dateGovernment = body.commandDateAffect;
}
await this.salaryRepo.save(data, { data: req });
setLogDataDiff(req, { before, after: data });
@ -1509,6 +1516,16 @@ export class ProfileSalaryTempController extends Controller {
const before = structuredClone(record);
Object.assign(record, body);
// 12,15,16 isGovernment = false & dateGovernment = commandDateAffect
if (["12", "15", "16"].includes(body.commandCode ?? "")) {
record.isGovernment = false;
if (body.commandDateAffect) record.dateGovernment = body.commandDateAffect;
}
// 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = commandDateAffect
else if (["1", "2", "3", "4", "10", "11", "20"].includes(body.commandCode ?? "")) {
record.isGovernment = true;
if (body.commandDateAffect) record.dateGovernment = body.commandDateAffect;
}
record.isEdit = true;
record.lastUpdateUserId = req.user.sub;