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)

View file

@ -17,6 +17,21 @@ export class CommandCode extends EntityBase {
default: null,
})
code: number;
@Column({
nullable: true,
comment: "ลำดับ",
default: null,
})
order: number;
@Column({
nullable: true,
comment: "คำสั่ง",
length: 255,
default: null,
})
caption: string;
}
export class CreateCommandCode {
@ -25,6 +40,12 @@ export class CreateCommandCode {
@Column()
code: number;
@Column()
order: number;
@Column()
caption: string;
}
export type UpdateCommandCode = Partial<CreateCommandCode>;

View file

@ -256,6 +256,22 @@ export class ProfileSalary extends EntityBase {
})
commandId: string;
@Column({
nullable: true,
length: 255,
comment: "หน่วยงานที่ออกคำสั่ง",
default: null,
})
posNumCodeSit: string;
@Column({
nullable: true,
length: 255,
comment: "หน่วยงานที่ออกคำสั่ง(ตัวย่อ)",
default: null,
})
posNumCodeSitAbb: string;
@ManyToOne(() => Command, (command) => command.profileSalarys)
@JoinColumn({ name: "commandId" })
command: Command;

View file

@ -277,6 +277,23 @@ export class ProfileSalaryTemp extends EntityBase {
})
salaryId: string;
@Column({
nullable: true,
length: 255,
comment: "หน่วยงานที่ออกคำสั่ง",
default: null,
})
posNumCodeSit: string;
@Column({
nullable: true,
length: 255,
comment: "หน่วยงานที่ออกคำสั่ง(ตัวย่อ)",
default: null,
})
posNumCodeSitAbb: string;
@ManyToOne(() => ProfileSalary, (profileSalary) => profileSalary.profileSalaryTemps)
@JoinColumn({ name: "salaryId" })
profileSalary: ProfileSalary;