sort and add field

This commit is contained in:
AdisakKanthawilang 2025-03-24 17:59:47 +07:00
parent dc9ac66896
commit a47c804969
4 changed files with 69 additions and 1 deletions

View file

@ -158,10 +158,24 @@ export class ProfileSalaryTempController extends Controller {
);
}),
)
// .andWhere(
// rootId != undefined &&
// rootId != null
// ? `current_holders.orgRootId = :rootId`
// : "1=1",
// {
// rootId: rootId,
// }
// )
.andWhere("current_holders.orgRootId = :rootId", {
rootId: rootId,
})
.orderBy("current_holders.posMasterNo", "ASC")
.orderBy("orgRoot.orgRootOrder", "ASC")
.addOrderBy("orgChild1.orgChild1Order", "ASC")
.addOrderBy("orgChild2.orgChild2Order", "ASC")
.addOrderBy("orgChild3.orgChild3Order", "ASC")
.addOrderBy("orgChild4.orgChild4Order", "ASC")
.addOrderBy("current_holders.posMasterNo", "ASC")
// .orderBy(`${sortBy}`, sort)
.skip((page - 1) * pageSize)
.take(pageSize)