diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index 80c3cf56..6fe61849 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -1087,6 +1087,9 @@ export class EmployeePositionController extends Controller { .leftJoinAndSelect("posMaster.current_holder", "current_holder") .leftJoinAndSelect("posMaster.next_holder", "next_holder") .leftJoinAndSelect("posMaster.orgRevision", "orgRevision") + .leftJoinAndSelect("posMaster.positions", "positions") + .leftJoinAndSelect("positions.posType", "posType") + .leftJoinAndSelect("positions.posLevel", "posLevel") .where(conditions) .orWhere( new Brackets((qb) => { @@ -1132,6 +1135,21 @@ export class EmployeePositionController extends Controller { .andWhere(revisionCondition); }), ) + .orWhere( + new Brackets((qb) => { + qb.andWhere( + body.keyword != null && body.keyword != "" + ? `CONCAT(posType.posTypeShortName,' ',posLevel.posLevelName) like '%${body.keyword}%'` + : "1=1", + { + keyword: `%${body.keyword}%`, + }, + ) + .andWhere(checkChildConditions) + .andWhere(typeCondition) + .andWhere(revisionCondition); + }), + ) .orderBy("posMaster.posMasterOrder", "ASC") .skip((body.page - 1) * body.pageSize) .take(body.pageSize) diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index eb707207..e20eaa7d 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -864,6 +864,7 @@ export class ProfileEmployeeTempController extends Controller { } Object.assign(record, body); + record.prefixMain = record.prefix; record.createdUserId = request.user.sub; record.createdFullName = request.user.name; record.createdAt = new Date();