diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 0fb31946..8f41674c 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -856,7 +856,6 @@ export class PositionController extends Controller { if (body.type === 0) { typeCondition = { - orgRevisionId: body.revisionId, orgRootId: body.id, }; if (!body.isAll) { @@ -869,7 +868,6 @@ export class PositionController extends Controller { } } else if (body.type === 1) { typeCondition = { - orgRevisionId: body.revisionId, orgChild1Id: body.id, }; if (!body.isAll) { @@ -882,7 +880,6 @@ export class PositionController extends Controller { } } else if (body.type === 2) { typeCondition = { - orgRevisionId: body.revisionId, orgChild2Id: body.id, }; if (!body.isAll) { @@ -895,7 +892,6 @@ export class PositionController extends Controller { } } else if (body.type === 3) { typeCondition = { - orgRevisionId: body.revisionId, orgChild3Id: body.id, }; if (!body.isAll) { @@ -908,7 +904,6 @@ export class PositionController extends Controller { } } else if (body.type === 4) { typeCondition = { - orgRevisionId: body.revisionId, orgChild4Id: body.id, }; searchShortName = `CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; @@ -955,10 +950,14 @@ export class PositionController extends Controller { masterId = [...new Set(masterId)]; } + const revisionCondition = { + orgRevisionId: body.revisionId, + }; const conditions = [ { ...checkChildConditions, ...typeCondition, + ...revisionCondition, ...(body.keyword && (masterId.length > 0 ? { id: In(masterId) } @@ -1005,6 +1004,7 @@ export class PositionController extends Controller { qb.where(searchShortName) .andWhere(checkChildConditions) .andWhere(typeCondition) + .andWhere(revisionCondition); }), ) .orWhere( @@ -1019,6 +1019,7 @@ export class PositionController extends Controller { ) .andWhere(checkChildConditions) .andWhere(typeCondition) + .andWhere(revisionCondition); }), ) .orderBy("posMaster.posMasterOrder", "ASC")