This commit is contained in:
Bright 2024-11-25 21:02:43 +07:00
parent 859c61aa99
commit 542df70eb7
3 changed files with 22 additions and 4 deletions

View file

@ -126,6 +126,7 @@ export class PermissionOrgController extends Controller {
const findRevision = await this.orgRevisionRepository.findOne({
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
});
const orgRevisionId = findRevision?.id;
if (!findRevision) {
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
}
@ -138,16 +139,19 @@ export class PermissionOrgController extends Controller {
.leftJoinAndSelect("profile.current_holders", "current_holders")
.leftJoinAndSelect("current_holders.positions", "positions")
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
.leftJoinAndSelect("current_holders.orgRevision", "orgRevision")
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
.where("current_holders.orgRevisionId = :orgRevisionId", {orgRevisionId})
.andWhere(
new Brackets((qb) => {
qb.andWhere(`current_holders.orgRevisionId = :orgRevisionId`, {
orgRevisionId: findRevision.id,
}).andWhere(
// qb.andWhere(`current_holders.orgRevision = :orgRevisionId`, {
// orgRevisionId: findRevision.id,
// })
qb.andWhere(
searchKeyword != undefined && searchKeyword != null && searchKeyword != ""
? queryLike
: "1=1",

View file

@ -1591,6 +1591,18 @@ export class PositionController extends Controller {
.take(body.pageSize)
.getManyAndCount();
//serch name สิทธิ์
// if(posMaster.length == 0 && body.keyword != null && body.keyword != "") {
// let _authRole:any;
// let _masterIdRole:any
// _authRole = await this.authRoleRepo.find({
// where: {
// roleName: Like(`%${body.keyword}%`),
// },
// relations: ["posMasters"]
// });
// _masterIdRole = [...new Set(_authRole.map((x: any) => x.posMasters.map((y: any) => y.id)).flat())];
// }
//แก้ค้นหา
let _position: any[] = [];
let x: any = null;

View file

@ -103,7 +103,9 @@ export class ProfileGovernmentEmployeeController extends Controller {
const data = {
org: org, //สังกัด
position: record.position, //ตำแหน่ง
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
posLevel: record.posType == null && record.posLevel == null
? null
: `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ
posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),