diff --git a/src/controllers/EmployeePositionController.ts b/src/controllers/EmployeePositionController.ts index cdfe1b66..547ec5ae 100644 --- a/src/controllers/EmployeePositionController.ts +++ b/src/controllers/EmployeePositionController.ts @@ -269,6 +269,7 @@ export class EmployeePositionController extends Controller { findData = await this.employeePosDictRepository.find({ where: { posDictName: Like(`%${keyword}%`) }, relations: ["posType", "posLevel"], + order: { posLevel: { posLevelName: "ASC" } }, }); break; @@ -280,6 +281,7 @@ 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" } }, }); break; @@ -291,11 +293,13 @@ 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" } }, }); } else { //กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย findData = await this.employeePosDictRepository.find({ relations: ["posType", "posLevel"], + order: { posLevel: { posLevelName: "ASC" } }, }); } break; @@ -303,6 +307,7 @@ export class EmployeePositionController extends Controller { default: findData = await this.employeePosDictRepository.find({ relations: ["posType", "posLevel"], + order: { posLevel: { posLevelName: "ASC" } }, }); break; }