แต่งตั้ง ย้ายแก้ไขเงื่อนไขการ search ตำแหน่ง #2554
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m5s

This commit is contained in:
harid 2026-06-08 18:09:44 +07:00
parent bba6754eeb
commit 0a874798bd

View file

@ -4434,6 +4434,7 @@ export class PositionController extends Controller {
typeCommand: string | null;
posType?: string | null;
posLevel?: string | null;
profileId?: string | null;
isAll: boolean;
isBlank: boolean;
},
@ -4475,9 +4476,13 @@ export class PositionController extends Controller {
posLevel: posLevel?.id,
};
} else if (body.typeCommand == "APPOINT") {
conditionA = "posType.posTypeRank > :posTypeRank";
// เดิม : กรองเฉพาะ posTypeRank ที่สูงกว่า
// conditionA = "posType.posTypeRank > :posTypeRank";
// ใหม่ : กรองเฉพาะ posType ที่สูงหรือต่ำกว่าก็ได้
conditionA = "positions.posTypeId != :currentPosType";
params = {
posTypeRank: posType?.posTypeRank ?? 0,
// posTypeRank: posType?.posTypeRank ?? 0,
currentPosType: posType?.id,
};
} else if (body.typeCommand == "SLIP") {
conditionA = "positions.posTypeId LIKE :posType AND posLevel.posLevelRank > :posLevelRank";
@ -4541,6 +4546,10 @@ export class PositionController extends Controller {
typeCondition.current_holderId = IsNull();
}
if (body.typeCommand === "MOVE" && body.profileId && !body.isBlank) {
typeCondition.current_holderId = Not(body.profileId);
}
const [posMaster, total] = await AppDataSource.getRepository(PosMaster)
.createQueryBuilder("posMaster")
.leftJoinAndSelect("posMaster.orgRevision", "orgRevision")