เพิ่มเงื่อนไข
บรรจุแต่งตั้ง (APPOINTED) แต่งตั้ง (APPOINT) ย้าย (MOVE)
This commit is contained in:
parent
89194b1ba3
commit
8900e0cb38
1 changed files with 83 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ import { PosType } from "../entities/PosType";
|
||||||
import { PosLevel } from "../entities/PosLevel";
|
import { PosLevel } from "../entities/PosLevel";
|
||||||
import { CreatePosDict, CreatePosDictExe, PosDict, UpdatePosDict } from "../entities/PosDict";
|
import { CreatePosDict, CreatePosDictExe, PosDict, UpdatePosDict } from "../entities/PosDict";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import { Equal, ILike, In, IsNull, Like, Not, Brackets } from "typeorm";
|
import { Equal, ILike, In, IsNull, Like, Not, Brackets,MoreThan } from "typeorm";
|
||||||
import { CreatePosMaster, PosMaster } from "../entities/PosMaster";
|
import { CreatePosMaster, PosMaster } from "../entities/PosMaster";
|
||||||
import { OrgRevision } from "../entities/OrgRevision";
|
import { OrgRevision } from "../entities/OrgRevision";
|
||||||
import { OrgRoot } from "../entities/OrgRoot";
|
import { OrgRoot } from "../entities/OrgRoot";
|
||||||
|
|
@ -2642,4 +2642,86 @@ export class PositionController extends Controller {
|
||||||
);
|
);
|
||||||
return new HttpSuccess({ data: formattedData, total });
|
return new HttpSuccess({ data: formattedData, total });
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* API ค้นหาตำแหน่งในระบบสมัครสอบ
|
||||||
|
*
|
||||||
|
* @summary ค้นหาตำแหน่งในระบบสมัครสอบ
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("placement/searchh")
|
||||||
|
async searchPlacementt(
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
node: number;
|
||||||
|
nodeId: string;
|
||||||
|
position: string;
|
||||||
|
typeCommand: string;
|
||||||
|
posType: string;
|
||||||
|
posLevel: string;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
let typeCondition: any = {};
|
||||||
|
let conditionA: any = {};
|
||||||
|
let posTypeRank: any = {};
|
||||||
|
|
||||||
|
posTypeRank = await this.posTypeRepository.findOne({
|
||||||
|
where: { id: String(posTypeRank?.posTypeId) },
|
||||||
|
});
|
||||||
|
if (body.typeCommand == "APPOINTED" || body.typeCommand == "MOVE") {
|
||||||
|
conditionA = {
|
||||||
|
posTypeId: body.posType,
|
||||||
|
posLevelId: body.posLevel,
|
||||||
|
};
|
||||||
|
} else if (body.typeCommand == "APPOINT") {
|
||||||
|
conditionA = {
|
||||||
|
posTypeId: body.posType,
|
||||||
|
|
||||||
|
posLevel: {
|
||||||
|
posTypeRank: MoreThan(posTypeRank),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (body.node === 0) {
|
||||||
|
typeCondition = {
|
||||||
|
orgRootId: body.nodeId,
|
||||||
|
orgChild1Id: IsNull(),
|
||||||
|
next_holderId: IsNull(),
|
||||||
|
positions: conditionA,
|
||||||
|
};
|
||||||
|
} else if (body.node === 1) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild1Id: body.nodeId,
|
||||||
|
orgChild2Id: IsNull(),
|
||||||
|
next_holderId: IsNull(),
|
||||||
|
positions: conditionA,
|
||||||
|
};
|
||||||
|
} else if (body.node === 2) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild2Id: body.nodeId,
|
||||||
|
orgChild3Id: IsNull(),
|
||||||
|
next_holderId: IsNull(),
|
||||||
|
positions: conditionA,
|
||||||
|
};
|
||||||
|
} else if (body.node === 3) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild3Id: body.nodeId,
|
||||||
|
orgChild4Id: IsNull(),
|
||||||
|
next_holderId: IsNull(),
|
||||||
|
positions: {
|
||||||
|
posTypeId: body.posType,
|
||||||
|
posLevelId: body.posLevel,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
} else if (body.node === 4) {
|
||||||
|
typeCondition = {
|
||||||
|
orgChild4Id: body.nodeId,
|
||||||
|
next_holderId: IsNull(),
|
||||||
|
positions: {
|
||||||
|
posTypeId: body.posType,
|
||||||
|
posLevelId: body.posLevel,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue