sort ข้อมูลหลัก

This commit is contained in:
Bright 2024-11-27 10:20:40 +07:00
parent 94f92b5c9a
commit 2df1e19dc3
13 changed files with 171 additions and 57 deletions

View file

@ -288,12 +288,17 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posDictName: Like(`%${keyword}%`) },
relations: ["posType", "posLevel"],
order: {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posTypeRank: "ASC",
createdAt: "DESC"
},
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
}
},
});
break;
@ -306,12 +311,17 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posTypeId: In(findEmpTypes.map((x) => x.id)) },
relations: ["posType", "posLevel"],
order: {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posTypeRank: "ASC",
createdAt: "DESC"
},
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
}
},
});
break;
@ -324,24 +334,34 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posLevelId: In(findEmpLevels.map((x) => x.id)) },
relations: ["posType", "posLevel"],
order: {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posTypeRank: "ASC",
createdAt: "DESC"
},
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
}
},
});
} else {
//กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย
findData = await this.employeePosDictRepository.find({
relations: ["posType", "posLevel"],
order: {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posTypeRank: "ASC",
createdAt: "DESC"
},
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
}
},
});
}
@ -350,12 +370,17 @@ export class EmployeePositionController extends Controller {
default:
findData = await this.employeePosDictRepository.find({
relations: ["posType", "posLevel"],
order: {
order: {
posDictName: "ASC",
createdAt: "DESC",
posType:{
posTypeRank: "ASC",
createdAt: "DESC"
},
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
}
},
});
break;