fix sort registry and filter node of registry retire

This commit is contained in:
Warunee Tamkoo 2025-10-04 13:54:17 +07:00
parent abab998cd0
commit cd9c1721c1
3 changed files with 301 additions and 162 deletions

View file

@ -5742,6 +5742,8 @@ export class ProfileController extends Controller {
@Query() sortBy: string = "profile.dateLeave",
@Query() sort: "ASC" | "DESC" = "ASC",
) {
let _data = await new permission().PermissionOrgList(request, "SYS_REGISTRY_OFFICER");
const { data, total } = await this.profileLeaveService.getLeaveOfficer(request, {
page,
pageSize,
@ -5756,6 +5758,7 @@ export class ProfileController extends Controller {
retireType,
sortBy,
sort,
_data,
});
// let _data = await new permission().PermissionOrgList(request, "SYS_REGISTRY_OFFICER");
@ -6403,7 +6406,6 @@ export class ProfileController extends Controller {
total: 1,
},
})
// ...existing code...
async listProfile(
@Request() request: RequestWithUser,
@Query("page") page: number = 1,
@ -6587,7 +6589,7 @@ export class ProfileController extends Controller {
}),
)
.addSelect("CASE WHEN current_holders.posMasterNo IS NULL THEN 1 ELSE 0 END", "sort_order")
.orderBy("sort_order", sort)
.orderBy(sortBy ? sortBy : "sort_order", sort)
.addOrderBy("orgRoot.orgRootOrder", sort)
.addOrderBy("orgChild1.orgChild1Order", sort)
.addOrderBy("orgChild2.orgChild2Order", sort)

View file

@ -2674,6 +2674,8 @@ export class ProfileEmployeeController extends Controller {
@Query() sortBy: string = "profileEmployee.dateLeave",
@Query() sort: "ASC" | "DESC" = "DESC",
) {
let _data = await new permission().PermissionOrgList(request, "SYS_REGISTRY_EMP");
const { data, total } = await this.profileLeaveService.getLeaveEmployees(request, {
page,
pageSize,
@ -2688,6 +2690,7 @@ export class ProfileEmployeeController extends Controller {
retireType,
sortBy,
sort,
_data,
});
return new HttpSuccess({ data, total });
@ -2915,7 +2918,7 @@ export class ProfileEmployeeController extends Controller {
nodeId: nodeId,
})
.addSelect("CASE WHEN current_holders.posMasterNo IS NULL THEN 1 ELSE 0 END", "sort_order")
.orderBy("sort_order", sort)
.orderBy(sortBy ? sortBy : "sort_order", sort)
.addOrderBy("orgRoot.orgRootOrder", sort)
.addOrderBy("orgChild1.orgChild1Order", sort)
.addOrderBy("orgChild2.orgChild2Order", sort)