diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 576d15cd..779b4aca 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -4609,6 +4609,7 @@ export class ProfileController extends Controller { @Query() node?: number, @Query() nodeId?: string, @Query() isAll?: boolean, + @Query() retireType?: string, ) { let _data = await new permission().PermissionOrgList(request, "SYS_REGISTRY_OFFICER"); let queryLike = @@ -4742,9 +4743,11 @@ export class ProfileController extends Controller { .andWhere( isRetire != undefined && isRetire != null ? isRetire == false - ? `profile.dateLeave IS null` - : `profile.dateLeave IS NOT NULL` - : "1=1", + ? `profile.dateLeave IS NULL` + : isRetire == true && retireType != undefined && retireType != null + ? `profile.dateLeave IS NOT NULL AND profile.leaveType = '${retireType}'` + : `profile.dateLeave IS NOT NULL` + : "1=1" ) .andWhere(nodeCondition, { nodeId: nodeId, diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index a4f2121a..a0ee00a5 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -1488,6 +1488,7 @@ export class ProfileEmployeeController extends Controller { @Query() node?: number, @Query() nodeId?: string, @Query() isAll?: boolean, + @Query() retireType?: string, ) { let _data = await new permission().PermissionOrgList(request, "SYS_REGISTRY_EMP"); let queryLike = @@ -1620,10 +1621,12 @@ export class ProfileEmployeeController extends Controller { ) .andWhere( isRetire != undefined && isRetire != null - ? isRetire == true - ? `profile.dateRetire IS null` - : `profile.dateRetire IS NOT NULL` - : "1=1", + ? isRetire == false + ? `profile.dateLeave IS NULL` + : isRetire == true && retireType != undefined && retireType != null + ? `profile.dateLeave IS NOT NULL AND profile.leaveType = '${retireType}'` + : `profile.dateLeave IS NOT NULL` + : "1=1" ) .andWhere("profileEmployee.employeeClass LIKE :type", { type: "PERM",