diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index 547ec5ae..1d02bfaf 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -1996,6 +1996,7 @@ export class EmployeePositionController extends Controller { dataMaster.isSit = requestBody.isSit; dataMaster.current_holderId = requestBody.profileId; + dataMaster.next_holderId = requestBody.profileId; await this.employeePosMasterRepository.save(dataMaster); return new HttpSuccess(); diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 93525bc9..6a54d831 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -384,8 +384,10 @@ export class ProfileController extends Controller { ) .andWhere( new Brackets((qb) => { - qb.where("next_holders.id IS NULL").orWhere("next_holders.id NOT IN (:...ids)", { - ids: orgRevision.posMasters.map((x) => x.next_holderId), + qb.where("profile.id NOT IN (:...ids)", { + ids: orgRevision.posMasters + .filter((x) => x.next_holderId != null) + .map((x) => x.next_holderId), }); }), ) diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 7c420ad9..6b7e2bbb 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -379,8 +379,10 @@ export class ProfileEmployeeController extends Controller { ) .andWhere( new Brackets((qb) => { - qb.where("next_holders.id IS NULL").orWhere("next_holders.id NOT IN (:...ids)", { - ids: orgRevision.posMasters.map((x) => x.next_holderId), + qb.where("profile.id NOT IN (:...ids)", { + ids: orgRevision.posMasters + .filter((x) => x.next_holderId != null) + .map((x) => x.next_holderId), }); }), )