diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index b0f1b71e..d3e85db0 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -985,7 +985,6 @@ export class PositionController extends Controller { }; searchShortName = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; } else { - // searchShortName = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; } } else if (body.type === 1) { typeCondition = { @@ -997,7 +996,6 @@ export class PositionController extends Controller { }; searchShortName = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; } else { - // searchShortName = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; } } else if (body.type === 2) { typeCondition = { @@ -1009,7 +1007,6 @@ export class PositionController extends Controller { }; searchShortName = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; } else { - // searchShortName = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; } } else if (body.type === 3) { typeCondition = { @@ -1021,7 +1018,6 @@ export class PositionController extends Controller { }; searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; } else { - // searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%' or CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`; } } else if (body.type === 4) { typeCondition = { @@ -1086,28 +1082,7 @@ export class PositionController extends Controller { }, ]; - // if (body.keyword) { - // conditions.push({ - // id: masterId.length > 0 ? In(masterId) : false, - // posMasterNo: Like(`%${keywordAsInt}%`), - // }); - // } - - // const [posMaster, total] = await this.posMasterRepository.findAndCount({ - // where: conditions, - // order: { posMasterOrder: "ASC" }, - // relations: [ - // "orgRoot", - // "orgChild1", - // "orgChild2", - // "orgChild3", - // "orgChild4", - // "current_holder", - // "next_holder", - // ], - // skip: (body.page - 1) * body.pageSize, - // take: body.pageSize, - // }); + const [posMaster, total] = await AppDataSource.getRepository(PosMaster) .createQueryBuilder("posMaster") .leftJoinAndSelect("posMaster.orgRoot", "orgRoot") @@ -1118,7 +1093,6 @@ export class PositionController extends Controller { .leftJoinAndSelect("posMaster.current_holder", "current_holder") .leftJoinAndSelect("posMaster.next_holder", "next_holder") .where(conditions) - // // .where("posMaster.orgRevisionId = :revisionId", { revisionId: body.revisionId }) .orWhere( new Brackets((qb) => { qb.andWhere( @@ -1184,7 +1158,6 @@ export class PositionController extends Controller { let shortName = ""; - // if (body.isAll === true) { if ( posMaster.orgRootId !== null && posMaster.orgChild1Id == null && @@ -1226,7 +1199,6 @@ export class PositionController extends Controller { body.type = 4; shortName = posMaster.orgChild4.orgChild4ShortName; } - // } return { id: posMaster.id,