Merge branch 'develop' into develop-Bright
This commit is contained in:
commit
136a4c562e
2 changed files with 37 additions and 6 deletions
|
|
@ -350,6 +350,31 @@ export class ApiManageController extends Controller {
|
||||||
"next_holderId",
|
"next_holderId",
|
||||||
"current_holderId",
|
"current_holderId",
|
||||||
"ancestorDNA",
|
"ancestorDNA",
|
||||||
|
"leaveCommandId",
|
||||||
|
"posLevelId",
|
||||||
|
"posTypeId",
|
||||||
|
"posExecutiveId",
|
||||||
|
"registrationProvinceId",
|
||||||
|
"registrationDistrictId",
|
||||||
|
"registrationSubDistrictId",
|
||||||
|
"currentProvinceId",
|
||||||
|
"currentDistrictId",
|
||||||
|
"currentSubDistrictId",
|
||||||
|
"isDelete",
|
||||||
|
"keycloak",
|
||||||
|
"statusCheckEdit",
|
||||||
|
"privacyCheckin",
|
||||||
|
"privacyUser",
|
||||||
|
"privacyMgt",
|
||||||
|
"dutyTimeId",
|
||||||
|
"dutyTimeEffectiveDate",
|
||||||
|
"profileId",
|
||||||
|
"profileEmployeeId",
|
||||||
|
"orgRevisionId",
|
||||||
|
"rank",
|
||||||
|
"isUpload",
|
||||||
|
"isDeleted",
|
||||||
|
"isEntry",
|
||||||
]; // ฟิลด์ที่ไม่ต้องการแสดงในผลลัพธ์
|
]; // ฟิลด์ที่ไม่ต้องการแสดงในผลลัพธ์
|
||||||
|
|
||||||
// การแทนที่ฟิลด์ ID ด้วยฟิลด์ Name สำหรับ Profile entity
|
// การแทนที่ฟิลด์ ID ด้วยฟิลด์ Name สำหรับ Profile entity
|
||||||
|
|
|
||||||
|
|
@ -3594,6 +3594,8 @@ export class CommandController extends Controller {
|
||||||
positionArea?: string | null;
|
positionArea?: string | null;
|
||||||
positionType: string | null;
|
positionType: string | null;
|
||||||
positionLevel: string | null;
|
positionLevel: string | null;
|
||||||
|
positionTypeId?: string | null;
|
||||||
|
positionLevelId?: string | null;
|
||||||
posmasterId: string;
|
posmasterId: string;
|
||||||
positionId: string;
|
positionId: string;
|
||||||
posExecutiveId?: string | null;
|
posExecutiveId?: string | null;
|
||||||
|
|
@ -3815,6 +3817,10 @@ export class CommandController extends Controller {
|
||||||
|
|
||||||
let positionNew: Position | null = null;
|
let positionNew: Position | null = null;
|
||||||
|
|
||||||
|
// Resolve ID: ใช้ positionTypeId/positionLevelId ก่อน ถ้าไม่มี fallback เป็น positionType/positionLevel
|
||||||
|
const posTypeId = item.positionTypeId || item.positionType;
|
||||||
|
const posLevelId = item.positionLevelId || item.positionLevel;
|
||||||
|
|
||||||
// ═══════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════
|
||||||
// CONDITION 1: เช็คจาก positionId ตรง
|
// CONDITION 1: เช็คจาก positionId ตรง
|
||||||
// ═══════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════
|
||||||
|
|
@ -3835,13 +3841,13 @@ export class CommandController extends Controller {
|
||||||
// ═══════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════
|
||||||
// CONDITION 2: Match 7 ฟิลด์ (ถ้า Condition 1 ไม่ match)
|
// CONDITION 2: Match 7 ฟิลด์ (ถ้า Condition 1 ไม่ match)
|
||||||
// ═══════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════
|
||||||
if (!positionNew && item.positionName && item.positionType && item.positionLevel) {
|
if (!positionNew && item.positionName && posTypeId && posLevelId) {
|
||||||
// สร้าง where clause แบบ dynamic - ใส่เฉพาะฟิลด์ที่มีค่า
|
// สร้าง where clause แบบ dynamic - ใส่เฉพาะฟิลด์ที่มีค่า
|
||||||
const whereCondition: any = {
|
const whereCondition: any = {
|
||||||
posMasterId: posMaster.id,
|
posMasterId: posMaster.id,
|
||||||
positionName: item.positionName,
|
positionName: item.positionName,
|
||||||
posTypeId: item.positionType, // positionType = posTypeId
|
posTypeId: posTypeId,
|
||||||
posLevelId: item.positionLevel, // positionLevel = posLevelId
|
posLevelId: posLevelId,
|
||||||
};
|
};
|
||||||
|
|
||||||
// เพิ่มเฉพาะฟิลด์ที่มีค่า (ไม่ใช่ null, undefined, หรือ string ว่าง)
|
// เพิ่มเฉพาะฟิลด์ที่มีค่า (ไม่ใช่ null, undefined, หรือ string ว่าง)
|
||||||
|
|
@ -3872,13 +3878,13 @@ export class CommandController extends Controller {
|
||||||
// ═══════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════
|
||||||
// CONDITION 3: Match 3 ฟิลด์ (ถ้า Condition 2 ไม่ match)
|
// CONDITION 3: Match 3 ฟิลด์ (ถ้า Condition 2 ไม่ match)
|
||||||
// ═══════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════
|
||||||
if (!positionNew && item.positionName && item.positionType && item.positionLevel) {
|
if (!positionNew && item.positionName && posTypeId && posLevelId) {
|
||||||
const positionBy3Fields = await this.positionRepository.findOne({
|
const positionBy3Fields = await this.positionRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
posMasterId: posMaster.id,
|
posMasterId: posMaster.id,
|
||||||
positionName: item.positionName,
|
positionName: item.positionName,
|
||||||
posTypeId: item.positionType,
|
posTypeId: posTypeId,
|
||||||
posLevelId: item.positionLevel,
|
posLevelId: posLevelId,
|
||||||
},
|
},
|
||||||
relations: ["posExecutive"],
|
relations: ["posExecutive"],
|
||||||
order: { orderNo: "ASC" }
|
order: { orderNo: "ASC" }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue