no message
This commit is contained in:
parent
89beced8cc
commit
ed862a3802
1 changed files with 198 additions and 188 deletions
|
|
@ -335,13 +335,14 @@ export class PositionController extends Controller {
|
||||||
if (!orgChild4) {
|
if (!orgChild4) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงสร้าง");
|
||||||
} else {
|
} else {
|
||||||
const order:any = await this.posMasterRepository.findOne({
|
const order: any = await this.posMasterRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
orgChild4Id: orgChild4.id
|
orgChild4Id: orgChild4.id,
|
||||||
},
|
},
|
||||||
order: { posMasterNo: "DESC" }
|
order: { posMasterNo: "DESC" },
|
||||||
})
|
});
|
||||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
posMaster.posMasterOrder =
|
||||||
|
order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||||
posMaster.orgRootId = orgChild4.orgRootId;
|
posMaster.orgRootId = orgChild4.orgRootId;
|
||||||
posMaster.orgChild1Id = orgChild4.orgChild1Id;
|
posMaster.orgChild1Id = orgChild4.orgChild1Id;
|
||||||
posMaster.orgChild2Id = orgChild4.orgChild2Id;
|
posMaster.orgChild2Id = orgChild4.orgChild2Id;
|
||||||
|
|
@ -350,14 +351,14 @@ export class PositionController extends Controller {
|
||||||
posMaster.orgRevisionId = orgChild4.orgRevisionId;
|
posMaster.orgRevisionId = orgChild4.orgRevisionId;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const order:any = await this.posMasterRepository.findOne({
|
const order: any = await this.posMasterRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
orgChild3Id: orgChild3.id,
|
orgChild3Id: orgChild3.id,
|
||||||
orgChild4Id: IsNull() || ""
|
orgChild4Id: IsNull() || "",
|
||||||
},
|
},
|
||||||
order: { posMasterNo: "DESC" }
|
order: { posMasterNo: "DESC" },
|
||||||
})
|
});
|
||||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
posMaster.posMasterOrder = order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||||
posMaster.orgRootId = orgChild3.orgRootId;
|
posMaster.orgRootId = orgChild3.orgRootId;
|
||||||
posMaster.orgChild1Id = orgChild3.orgChild1Id;
|
posMaster.orgChild1Id = orgChild3.orgChild1Id;
|
||||||
posMaster.orgChild2Id = orgChild3.orgChild2Id;
|
posMaster.orgChild2Id = orgChild3.orgChild2Id;
|
||||||
|
|
@ -365,37 +366,37 @@ export class PositionController extends Controller {
|
||||||
posMaster.orgRevisionId = orgChild3.orgRevisionId;
|
posMaster.orgRevisionId = orgChild3.orgRevisionId;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const order:any = await this.posMasterRepository.findOne({
|
const order: any = await this.posMasterRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
orgChild2Id: orgChild2.id,
|
orgChild2Id: orgChild2.id,
|
||||||
orgChild3Id: IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id: IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
},
|
},
|
||||||
order: { posMasterNo: "DESC" }
|
order: { posMasterNo: "DESC" },
|
||||||
})
|
});
|
||||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
posMaster.posMasterOrder = order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||||
posMaster.orgRootId = orgChild2.orgRootId;
|
posMaster.orgRootId = orgChild2.orgRootId;
|
||||||
posMaster.orgChild1Id = orgChild2.orgChild1Id;
|
posMaster.orgChild1Id = orgChild2.orgChild1Id;
|
||||||
posMaster.orgChild2Id = orgChild2.id;
|
posMaster.orgChild2Id = orgChild2.id;
|
||||||
posMaster.orgRevisionId = orgChild2.orgRevisionId;
|
posMaster.orgRevisionId = orgChild2.orgRevisionId;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const order:any = await this.posMasterRepository.findOne({
|
const order: any = await this.posMasterRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
orgChild1Id: orgChild1.id,
|
orgChild1Id: orgChild1.id,
|
||||||
orgChild2Id: IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id: IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id: IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
},
|
},
|
||||||
order: { posMasterNo: "DESC" }
|
order: { posMasterNo: "DESC" },
|
||||||
})
|
});
|
||||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
posMaster.posMasterOrder = order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||||
posMaster.orgRootId = orgChild1.orgRootId;
|
posMaster.orgRootId = orgChild1.orgRootId;
|
||||||
posMaster.orgChild1Id = orgChild1.id;
|
posMaster.orgChild1Id = orgChild1.id;
|
||||||
posMaster.orgRevisionId = orgChild1.orgRevisionId;
|
posMaster.orgRevisionId = orgChild1.orgRevisionId;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const order:any = await this.posMasterRepository.findOne({
|
const order: any = await this.posMasterRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: orgRoot.id,
|
orgRootId: orgRoot.id,
|
||||||
orgChild1Id: IsNull() || "",
|
orgChild1Id: IsNull() || "",
|
||||||
|
|
@ -403,9 +404,9 @@ export class PositionController extends Controller {
|
||||||
orgChild3Id: IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id: IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
},
|
},
|
||||||
order: { posMasterNo: "DESC" }
|
order: { posMasterNo: "DESC" },
|
||||||
})
|
});
|
||||||
posMaster.posMasterOrder = order.posMasterOrder == null ? 1: order.posMasterOrder+1
|
posMaster.posMasterOrder = order.posMasterOrder == null ? 1 : order.posMasterOrder + 1;
|
||||||
posMaster.orgRootId = orgRoot.id;
|
posMaster.orgRootId = orgRoot.id;
|
||||||
posMaster.orgRevisionId = orgRoot.orgRevisionId;
|
posMaster.orgRevisionId = orgRoot.orgRevisionId;
|
||||||
}
|
}
|
||||||
|
|
@ -1051,7 +1052,12 @@ export class PositionController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id);
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งตามไอดีนี้ : " + id);
|
||||||
}
|
}
|
||||||
const posMasters = await this.posMasterRepository.find({
|
const posMasters = await this.posMasterRepository.find({
|
||||||
where: { ancestorDNA: posMaster.ancestorDNA },
|
where: {
|
||||||
|
ancestorDNA:
|
||||||
|
posMaster.ancestorDNA == null || posMaster.ancestorDNA == ""
|
||||||
|
? "123"
|
||||||
|
: posMaster.ancestorDNA,
|
||||||
|
},
|
||||||
order: { lastUpdatedAt: "DESC" },
|
order: { lastUpdatedAt: "DESC" },
|
||||||
relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
|
relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
|
||||||
});
|
});
|
||||||
|
|
@ -1069,10 +1075,10 @@ export class PositionController extends Controller {
|
||||||
: item.orgChild4 == null
|
: item.orgChild4 == null
|
||||||
? item.orgChild3.orgChild3ShortName
|
? item.orgChild3.orgChild3ShortName
|
||||||
: item.orgChild4.orgChild4ShortName,
|
: item.orgChild4.orgChild4ShortName,
|
||||||
lastUpdatedAt: item.lastUpdatedAt?item.posMasterNo:null,
|
lastUpdatedAt: item.lastUpdatedAt ? item.posMasterNo : null,
|
||||||
posMasterNoPrefix: item.posMasterNoPrefix?item.posMasterNoPrefix:null,
|
posMasterNoPrefix: item.posMasterNoPrefix ? item.posMasterNoPrefix : null,
|
||||||
posMasterNo: item.posMasterNo?item.posMasterNo:null,
|
posMasterNo: item.posMasterNo ? item.posMasterNo : null,
|
||||||
posMasterNoSuffix: item.posMasterNoSuffix?item.posMasterNoSuffix:null,
|
posMasterNoSuffix: item.posMasterNoSuffix ? item.posMasterNoSuffix : null,
|
||||||
}));
|
}));
|
||||||
return new HttpSuccess(_data);
|
return new HttpSuccess(_data);
|
||||||
}
|
}
|
||||||
|
|
@ -1183,7 +1189,7 @@ export class PositionController extends Controller {
|
||||||
let totalPositionNextUse: any;
|
let totalPositionNextUse: any;
|
||||||
let totalPositionNextVacant: any;
|
let totalPositionNextVacant: any;
|
||||||
|
|
||||||
if(requestBody.isNode === true){
|
if (requestBody.isNode === true) {
|
||||||
switch (requestBody.type) {
|
switch (requestBody.type) {
|
||||||
case 0: {
|
case 0: {
|
||||||
const NodeId = await this.posMasterRepository.findOne({
|
const NodeId = await this.posMasterRepository.findOne({
|
||||||
|
|
@ -1383,8 +1389,7 @@ export class PositionController extends Controller {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
switch (requestBody.type) {
|
switch (requestBody.type) {
|
||||||
case 0: {
|
case 0: {
|
||||||
const NodeId = await this.posMasterRepository.findOne({
|
const NodeId = await this.posMasterRepository.findOne({
|
||||||
|
|
@ -1399,49 +1404,49 @@ export class PositionController extends Controller {
|
||||||
totalPosition = await this.posMasterRepository.count({
|
totalPosition = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: requestBody.id,
|
orgRootId: requestBody.id,
|
||||||
orgChild1Id : IsNull() || "",
|
orgChild1Id: IsNull() || "",
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: requestBody.id,
|
orgRootId: requestBody.id,
|
||||||
orgChild1Id : IsNull() || "",
|
orgChild1Id: IsNull() || "",
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
current_holderId: Not(IsNull()) || Not(""),
|
current_holderId: Not(IsNull()) || Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: requestBody.id,
|
orgRootId: requestBody.id,
|
||||||
orgChild1Id : IsNull() || "",
|
orgChild1Id: IsNull() || "",
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
current_holderId: IsNull() || "",
|
current_holderId: IsNull() || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextUse = await this.posMasterRepository.count({
|
totalPositionNextUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: requestBody.id,
|
orgRootId: requestBody.id,
|
||||||
orgChild1Id : IsNull() || "",
|
orgChild1Id: IsNull() || "",
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
next_holderId: Not(IsNull()) || Not(""),
|
next_holderId: Not(IsNull()) || Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: requestBody.id,
|
orgRootId: requestBody.id,
|
||||||
orgChild1Id : IsNull() || "",
|
orgChild1Id: IsNull() || "",
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
next_holderId: IsNull() || "",
|
next_holderId: IsNull() || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1460,49 +1465,49 @@ export class PositionController extends Controller {
|
||||||
totalPosition = await this.posMasterRepository.count({
|
totalPosition = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : requestBody.id,
|
orgChild1Id: requestBody.id,
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : requestBody.id,
|
orgChild1Id: requestBody.id,
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
current_holderId: Not(IsNull()) && Not(""),
|
current_holderId: Not(IsNull()) && Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : requestBody.id,
|
orgChild1Id: requestBody.id,
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
current_holderId: IsNull() && "",
|
current_holderId: IsNull() && "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextUse = await this.posMasterRepository.count({
|
totalPositionNextUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : requestBody.id,
|
orgChild1Id: requestBody.id,
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
next_holderId: Not(IsNull()) && Not(""),
|
next_holderId: Not(IsNull()) && Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : requestBody.id,
|
orgChild1Id: requestBody.id,
|
||||||
orgChild2Id : IsNull() || "",
|
orgChild2Id: IsNull() || "",
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
next_holderId: IsNull() && "",
|
next_holderId: IsNull() && "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1521,49 +1526,49 @@ export class PositionController extends Controller {
|
||||||
totalPosition = await this.posMasterRepository.count({
|
totalPosition = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : requestBody.id,
|
orgChild2Id: requestBody.id,
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : requestBody.id,
|
orgChild2Id: requestBody.id,
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
current_holderId: Not(IsNull()) && Not(""),
|
current_holderId: Not(IsNull()) && Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : requestBody.id,
|
orgChild2Id: requestBody.id,
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
current_holderId: IsNull() && "",
|
current_holderId: IsNull() && "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextUse = await this.posMasterRepository.count({
|
totalPositionNextUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : requestBody.id,
|
orgChild2Id: requestBody.id,
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
next_holderId: Not(IsNull()) && Not(""),
|
next_holderId: Not(IsNull()) && Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : requestBody.id,
|
orgChild2Id: requestBody.id,
|
||||||
orgChild3Id : IsNull() || "",
|
orgChild3Id: IsNull() || "",
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
next_holderId: IsNull() && "",
|
next_holderId: IsNull() && "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1582,49 +1587,49 @@ export class PositionController extends Controller {
|
||||||
totalPosition = await this.posMasterRepository.count({
|
totalPosition = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : requestBody.id,
|
orgChild3Id: requestBody.id,
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : requestBody.id,
|
orgChild3Id: requestBody.id,
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
current_holderId: Not(IsNull()) && Not(""),
|
current_holderId: Not(IsNull()) && Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : requestBody.id,
|
orgChild3Id: requestBody.id,
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
current_holderId: IsNull() && "",
|
current_holderId: IsNull() && "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextUse = await this.posMasterRepository.count({
|
totalPositionNextUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : requestBody.id,
|
orgChild3Id: requestBody.id,
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
next_holderId: Not(IsNull()) && Not(""),
|
next_holderId: Not(IsNull()) && Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : requestBody.id,
|
orgChild3Id: requestBody.id,
|
||||||
orgChild4Id : IsNull() || "",
|
orgChild4Id: IsNull() || "",
|
||||||
next_holderId: IsNull() && "",
|
next_holderId: IsNull() && "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1643,49 +1648,49 @@ export class PositionController extends Controller {
|
||||||
totalPosition = await this.posMasterRepository.count({
|
totalPosition = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : Not(IsNull()) || Not(""),
|
orgChild3Id: Not(IsNull()) || Not(""),
|
||||||
orgChild4Id : requestBody.id,
|
orgChild4Id: requestBody.id,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentUse = await this.posMasterRepository.count({
|
totalPositionCurrentUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : Not(IsNull()) || Not(""),
|
orgChild3Id: Not(IsNull()) || Not(""),
|
||||||
orgChild4Id : requestBody.id,
|
orgChild4Id: requestBody.id,
|
||||||
current_holderId: Not(IsNull()) && Not(""),
|
current_holderId: Not(IsNull()) && Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
totalPositionCurrentVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : Not(IsNull()) || Not(""),
|
orgChild3Id: Not(IsNull()) || Not(""),
|
||||||
orgChild4Id : requestBody.id,
|
orgChild4Id: requestBody.id,
|
||||||
current_holderId: IsNull() && "",
|
current_holderId: IsNull() && "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextUse = await this.posMasterRepository.count({
|
totalPositionNextUse = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : Not(IsNull()) || Not(""),
|
orgChild3Id: Not(IsNull()) || Not(""),
|
||||||
orgChild4Id : requestBody.id,
|
orgChild4Id: requestBody.id,
|
||||||
next_holderId: Not(IsNull()) && Not(""),
|
next_holderId: Not(IsNull()) && Not(""),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
totalPositionNextVacant = await this.posMasterRepository.count({
|
totalPositionNextVacant = await this.posMasterRepository.count({
|
||||||
where: {
|
where: {
|
||||||
orgRootId: Not(IsNull()) || Not(""),
|
orgRootId: Not(IsNull()) || Not(""),
|
||||||
orgChild1Id : Not(IsNull()) || Not(""),
|
orgChild1Id: Not(IsNull()) || Not(""),
|
||||||
orgChild2Id : Not(IsNull()) || Not(""),
|
orgChild2Id: Not(IsNull()) || Not(""),
|
||||||
orgChild3Id : Not(IsNull()) || Not(""),
|
orgChild3Id: Not(IsNull()) || Not(""),
|
||||||
orgChild4Id : requestBody.id,
|
orgChild4Id: requestBody.id,
|
||||||
next_holderId: IsNull() && "",
|
next_holderId: IsNull() && "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -1789,23 +1794,28 @@ export class PositionController extends Controller {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Post("dna")
|
@Post("dna")
|
||||||
async dna(@Body() requestBody: { draftPositionId: string; publishPositionId: string;}) {
|
async dna(@Body() requestBody: { draftPositionId: string; publishPositionId: string }) {
|
||||||
const dataDraft = await this.posMasterRepository.findOne({
|
const dataDraft = await this.posMasterRepository.findOne({
|
||||||
where: { id: requestBody.draftPositionId },
|
where: { id: requestBody.draftPositionId },
|
||||||
});
|
});
|
||||||
if (!dataDraft) {
|
if (!dataDraft) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้(draftPositionId) : " + requestBody.draftPositionId);
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลไอดีนี้(draftPositionId) : " + requestBody.draftPositionId,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const dataPublish = await this.posMasterRepository.findOne({
|
const dataPublish = await this.posMasterRepository.findOne({
|
||||||
where: { id: requestBody.publishPositionId },
|
where: { id: requestBody.publishPositionId },
|
||||||
});
|
});
|
||||||
if (!dataPublish) {
|
if (!dataPublish) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลไอดีนี้(publishPositionId) : " + requestBody.publishPositionId);
|
throw new HttpError(
|
||||||
|
HttpStatusCode.NOT_FOUND,
|
||||||
|
"ไม่พบข้อมูลไอดีนี้(publishPositionId) : " + requestBody.publishPositionId,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
dataDraft.ancestorDNA = dataPublish.ancestorDNA;
|
dataDraft.ancestorDNA = dataPublish.ancestorDNA;
|
||||||
await this.posMasterRepository.save(dataDraft);
|
await this.posMasterRepository.save(dataDraft);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue