sort command act
This commit is contained in:
parent
c834cb6e41
commit
c58626ec3f
2 changed files with 10 additions and 5 deletions
|
|
@ -2658,7 +2658,7 @@ export class CommandController extends Controller {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (["C-PM-10"].includes(commandCode)) {
|
if (["C-PM-10", "C-PM-40"].includes(commandCode)) {
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
requestBody.persons.map(async (item: any) => {
|
requestBody.persons.map(async (item: any) => {
|
||||||
const _posMasterDirector = await this.posMasterRepository.findOne({
|
const _posMasterDirector = await this.posMasterRepository.findOne({
|
||||||
|
|
|
||||||
|
|
@ -408,13 +408,13 @@ export class PosMasterActController extends Controller {
|
||||||
let conditionGroup = "";
|
let conditionGroup = "";
|
||||||
if (body.type.trim().toUpperCase() == "GROUP1.1") {
|
if (body.type.trim().toUpperCase() == "GROUP1.1") {
|
||||||
conditionGroup =
|
conditionGroup =
|
||||||
"(posType.posTypeName = 'ทั่วไป' AND posLevel.posLevelName = 'ชำนาญงาน') OR (posType.posTypeName = 'ทั่วไป' AND posLevel.posLevelName = 'ปฏิบัติงาน') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'ปฏิบัติการ') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'ชำนาญการ')";
|
"(posTypeAct.posTypeName = 'ทั่วไป' AND posLevelAct.posLevelName = 'ชำนาญงาน') OR (posTypeAct.posTypeName = 'ทั่วไป' AND posLevelAct.posLevelName = 'ปฏิบัติงาน') OR (posTypeAct.posTypeName = 'วิชาการ' AND posLevelAct.posLevelName = 'ปฏิบัติการ') OR (posTypeAct.posTypeName = 'วิชาการ' AND posLevelAct.posLevelName = 'ชำนาญการ')";
|
||||||
} else if (body.type.trim().toUpperCase() == "GROUP1.2") {
|
} else if (body.type.trim().toUpperCase() == "GROUP1.2") {
|
||||||
conditionGroup =
|
conditionGroup =
|
||||||
"(posType.posTypeName = 'ทั่วไป' AND posLevel.posLevelName = 'อาวุโส') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'ชำนาญการพิเศษ') OR (posType.posTypeName = 'อำนวยการ' AND posLevel.posLevelName = 'ต้น')";
|
"(posTypeAct.posTypeName = 'ทั่วไป' AND posLevelAct.posLevelName = 'อาวุโส') OR (posTypeAct.posTypeName = 'วิชาการ' AND posLevelAct.posLevelName = 'ชำนาญการพิเศษ') OR (posTypeAct.posTypeName = 'อำนวยการ' AND posLevelAct.posLevelName = 'ต้น')";
|
||||||
} else if (body.type.trim().toUpperCase() == "GROUP2") {
|
} else if (body.type.trim().toUpperCase() == "GROUP2") {
|
||||||
conditionGroup =
|
conditionGroup =
|
||||||
"(posType.posTypeName = 'ทั่วไป' AND posLevel.posLevelName = 'ทักษะพิเศษ') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'เชี่ยวชาญ') OR (posType.posTypeName = 'วิชาการ' AND posLevel.posLevelName = 'ทรงคุณวุฒิ') OR (posType.posTypeName = 'อำนวยการ' AND posLevel.posLevelName = 'สูง') OR (posType.posTypeName = 'บริหาร' AND posLevel.posLevelName = 'ต้น') OR (posType.posTypeName = 'บริหาร' AND posLevel.posLevelName = 'สูง')";
|
"(posTypeAct.posTypeName = 'ทั่วไป' AND posLevelAct.posLevelName = 'ทักษะพิเศษ') OR (posTypeAct.posTypeName = 'วิชาการ' AND posLevelAct.posLevelName = 'เชี่ยวชาญ') OR (posTypeAct.posTypeName = 'วิชาการ' AND posLevelAct.posLevelName = 'ทรงคุณวุฒิ') OR (posTypeAct.posTypeName = 'อำนวยการ' AND posLevelAct.posLevelName = 'สูง') OR (posTypeAct.posTypeName = 'บริหาร' AND posLevelAct.posLevelName = 'ต้น') OR (posTypeAct.posTypeName = 'บริหาร' AND posLevelAct.posLevelName = 'สูง')";
|
||||||
} else {
|
} else {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "กลุ่มเป้าหมายไม่ถูกต้อง");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "กลุ่มเป้าหมายไม่ถูกต้อง");
|
||||||
}
|
}
|
||||||
|
|
@ -431,6 +431,10 @@ export class PosMasterActController extends Controller {
|
||||||
.leftJoinAndSelect("posMasterChild.positions", "positions")
|
.leftJoinAndSelect("posMasterChild.positions", "positions")
|
||||||
.leftJoinAndSelect("positions.posType", "posType")
|
.leftJoinAndSelect("positions.posType", "posType")
|
||||||
.leftJoinAndSelect("positions.posLevel", "posLevel")
|
.leftJoinAndSelect("positions.posLevel", "posLevel")
|
||||||
|
.leftJoinAndSelect("posMasterAct.posMaster", "posMaster")
|
||||||
|
.leftJoinAndSelect("posMaster.positions", "positionActs")
|
||||||
|
.leftJoinAndSelect("positionActs.posType", "posTypeAct")
|
||||||
|
.leftJoinAndSelect("positionActs.posLevel", "posLevelAct")
|
||||||
.leftJoinAndSelect("posMasterChild.orgRevision", "orgRevision")
|
.leftJoinAndSelect("posMasterChild.orgRevision", "orgRevision")
|
||||||
.andWhere("posMasterChild.orgRootId LIKE :orgRootId", {
|
.andWhere("posMasterChild.orgRootId LIKE :orgRootId", {
|
||||||
orgRootId: body.type.trim().toUpperCase() == "GROUP1.1" ? body.rootId : `%%`,
|
orgRootId: body.type.trim().toUpperCase() == "GROUP1.1" ? body.rootId : `%%`,
|
||||||
|
|
@ -444,12 +448,13 @@ export class PosMasterActController extends Controller {
|
||||||
orgRevisionIsDraft: false,
|
orgRevisionIsDraft: false,
|
||||||
})
|
})
|
||||||
.andWhere("positions.positionIsSelected = :isSelected", { isSelected: true })
|
.andWhere("positions.positionIsSelected = :isSelected", { isSelected: true })
|
||||||
|
.andWhere("positionActs.positionIsSelected = :isSelected", { isSelected: true })
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.andWhere(conditionGroup);
|
qb.andWhere(conditionGroup);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.orderBy("posMasterChild.posMasterOrder", "ASC")
|
.orderBy("posMasterAct.posMasterOrder", "ASC")
|
||||||
.select([
|
.select([
|
||||||
"posMasterAct.id",
|
"posMasterAct.id",
|
||||||
"posMasterChild.posMasterNo",
|
"posMasterChild.posMasterNo",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue