fix
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m9s

This commit is contained in:
harid 2026-07-23 13:53:05 +07:00
parent 22ea54aeb3
commit 02c30c558a
2 changed files with 95 additions and 11 deletions

View file

@ -11451,11 +11451,10 @@ export class ProfileController extends Controller {
system?: string;
},
) {
// comment ออกก่อนเพราะยังไม่ได้ใช้
// // ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ
// let _system: string = "SYS_REGISTRY_OFFICER";
// if (body.system) _system = body.system;
// let _data = await new permission().PermissionOrgList(request, _system);
// ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ
let _system: string = "SYS_REGISTRY_OFFICER";
if (body.system) _system = body.system;
let _data = await new permission().PermissionOrgList(request, _system);
const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
});
@ -11500,10 +11499,50 @@ export class ProfileController extends Controller {
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
.where(body.system ? "profile.isActive = :isActive" : "profile.isDelete = :isDelete", {
isActive: false,
isDelete: true,
.where("profile.isActive = :isActive AND profile.isDelete = :isDelete", {
isActive: true,
isDelete: false,
})
.andWhere(
_data.root != undefined && _data.root != null
? _data.root[0] != null
? `current_holders.orgRootId IN (:...root)`
: `current_holders.orgRootId is null`
: "1=1",
{ root: _data.root },
)
.andWhere(
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)
.andWhere(
_data.child2 != undefined && _data.child2 != null
? _data.child2[0] != null
? `current_holders.orgChild2Id IN (:...child2)`
: `current_holders.orgChild2Id is null`
: "1=1",
{ child2: _data.child2 },
)
.andWhere(
_data.child3 != undefined && _data.child3 != null
? _data.child3[0] != null
? `current_holders.orgChild3Id IN (:...child3)`
: `current_holders.orgChild3Id is null`
: "1=1",
{ child3: _data.child3 },
)
.andWhere(
_data.child4 != undefined && _data.child4 != null
? _data.child4[0] != null
? `current_holders.orgChild4Id IN (:...child4)`
: `current_holders.orgChild4Id is null`
: "1=1",
{ child4: _data.child4 },
)
.andWhere(
new Brackets((qb) => {
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });

View file

@ -6172,6 +6172,7 @@ export class ProfileEmployeeController extends Controller {
*/
@Post("search-personal-no-keycloak")
async getProfileBySearchKeywordNoKeyCloak(
@Request() request: RequestWithUser,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Body()
@ -6181,6 +6182,10 @@ export class ProfileEmployeeController extends Controller {
system?: string;
},
) {
// ค้นหารายชื่อถ้าไม่ส่ง system มาให้ default ตามทะเบียนประวัติ
let _system: string = "SYS_REGISTRY_EMP";
if (body.system) _system = body.system;
let _data = await new permission().PermissionOrgList(request, _system);
const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
});
@ -6225,10 +6230,50 @@ export class ProfileEmployeeController extends Controller {
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
.where(body.system ? "profile.isActive = :isActive" : "profile.isDelete = :isDelete", {
isActive: false,
isDelete: true,
.where("profile.isActive = :isActive AND profile.isDelete = :isDelete", {
isActive: true,
isDelete: false,
})
.andWhere(
_data.root != undefined && _data.root != null
? _data.root[0] != null
? `current_holders.orgRootId IN (:...root)`
: `current_holders.orgRootId is null`
: "1=1",
{ root: _data.root },
)
.andWhere(
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)
.andWhere(
_data.child2 != undefined && _data.child2 != null
? _data.child2[0] != null
? `current_holders.orgChild2Id IN (:...child2)`
: `current_holders.orgChild2Id is null`
: "1=1",
{ child2: _data.child2 },
)
.andWhere(
_data.child3 != undefined && _data.child3 != null
? _data.child3[0] != null
? `current_holders.orgChild3Id IN (:...child3)`
: `current_holders.orgChild3Id is null`
: "1=1",
{ child3: _data.child3 },
)
.andWhere(
_data.child4 != undefined && _data.child4 != null
? _data.child4[0] != null
? `current_holders.orgChild4Id IN (:...child4)`
: `current_holders.orgChild4Id is null`
: "1=1",
{ child4: _data.child4 },
)
.andWhere(
new Brackets((qb) => {
qb.orWhere(body.keyword ? queryLike : "1=1", { keyword: `%${body.keyword}%` });