fix find positionLevel

This commit is contained in:
Bright 2024-11-27 11:38:09 +07:00
parent 1155be4116
commit 5e8b372323
2 changed files with 9 additions and 7 deletions

View file

@ -328,9 +328,15 @@ export class EmployeePositionController extends Controller {
case "positionLevel":
if (!isNaN(Number(keyword))) {
const findEmpLevels: EmployeePosLevel[] = await this.employeePosLevelRepository.find({
where: { posLevelName: Number(keyword) },
});
let findEmpLevels;
if(Number(keyword) === 0) {
findEmpLevels = await this.employeePosLevelRepository.find();
}
else {
findEmpLevels = await this.employeePosLevelRepository.find({
where: { posLevelName: Number(keyword) },
});
}
findData = await this.employeePosDictRepository.find({
where: { posLevelId: In(findEmpLevels.map((x) => x.id)) },
relations: ["posType", "posLevel"],

View file

@ -672,10 +672,6 @@ export class PositionController extends Controller {
case "positionExecutive":
const findExecutive: PosExecutive[] = await this.posExecutiveRepository.find({
where: { posExecutiveName: Like(`%${keyword}%`) },
order: {
// posExecutiveName: "ASC"
posExecutivePriority: "ASC"
},
select: ["id"],
});
findPosDict = await this.posDictRepository.find({