add createdAt, lastUpdatedAt, lastUpdateFullName #805

This commit is contained in:
Bright 2024-11-22 18:11:15 +07:00
parent 6f1e2339f5
commit 416cd49a27
5 changed files with 137 additions and 22 deletions

View file

@ -288,7 +288,13 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posDictName: Like(`%${keyword}%`) },
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
order: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
},
});
break;
@ -300,7 +306,13 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posTypeId: In(findEmpTypes.map((x) => x.id)) },
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
order: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
},
});
break;
@ -312,13 +324,25 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posLevelId: In(findEmpLevels.map((x) => x.id)) },
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
order: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
},
});
} else {
//กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย
findData = await this.employeePosDictRepository.find({
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
order: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
},
});
}
break;
@ -326,7 +350,13 @@ export class EmployeePositionController extends Controller {
default:
findData = await this.employeePosDictRepository.find({
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
order: {
posLevel: {
posLevelName: "ASC",
createdAt: "DESC"
},
createdAt: "DESC"
},
});
break;
}
@ -354,6 +384,9 @@ export class EmployeePositionController extends Controller {
posTypeShortName: posTypeShortName,
posLevelId: item.posLevelId,
posLevelName: `${posTypeShortName} ${posLevelName}`,
createdAt: item.createdAt,
lastUpdatedAt: item.lastUpdatedAt,
lastUpdateFullName: item.lastUpdateFullName
};
}),
);