From 906789545040e204b154549aa538d522138d847b Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 26 Nov 2024 17:33:39 +0700 Subject: [PATCH] no message --- src/controllers/PositionController.ts | 33 ++++++++++++++++++--------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index bf457458..eca0908f 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -1408,6 +1408,8 @@ export class PositionController extends Controller { typeCondition.current_holderId = IsNull(); } } + } else { + body.isAll = true; } let findPosition: any; let masterId = new Array(); @@ -1464,9 +1466,15 @@ export class PositionController extends Controller { } } - const revisionCondition = { + let revisionCondition: any = { orgRevisionId: body.revisionId, }; + if (_exitsRole == true) { + revisionCondition = { + orgRevisionId: body.revisionId, + authRoleId: In(_authRoleId), + }; + } const conditions = [ { @@ -1494,16 +1502,19 @@ export class PositionController extends Controller { .leftJoinAndSelect("current_holder.posType", "posType") .leftJoinAndSelect("current_holder.posLevel", "posLevel") .where(conditions) - .orWhere( - new Brackets((qb) => { - if (body.keyword != null && body.keyword != "" && _exitsRole) { - qb.andWhere("posMaster.authRoleId IN (:...authRoleId)", { authRoleId: _authRoleId }) - .andWhere(checkChildConditions) - .andWhere(typeCondition) - .andWhere(revisionCondition); - } - }), - ) + // .orWhere( + // new Brackets((qb) => { + // qb.andWhere( + // body.keyword != null && body.keyword != "" && _exitsRole + // ? `posMaster.authRoleId IN (:...authRoleId)'` + // : "1=1", + // { authRoleId: _authRoleId }, + // ) + // .andWhere(checkChildConditions) + // .andWhere(typeCondition) + // .andWhere(revisionCondition); + // }), + // ) .orWhere( new Brackets((qb) => { qb.andWhere(