From 5dc3e25aca67f32b0b5b4fc7c02c48f2e457f2ce Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 15 Oct 2024 13:56:29 +0700 Subject: [PATCH] =?UTF-8?q?fix=20=E0=B9=81=E0=B8=95=E0=B9=88=E0=B8=87?= =?UTF-8?q?=E0=B8=95=E0=B8=B1=E0=B9=89=E0=B8=87-=E0=B9=80=E0=B8=A5?= =?UTF-8?q?=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=99-=E0=B8=A2=E0=B9=89?= =?UTF-8?q?=E0=B8=B2=E0=B8=A2=20=E0=B9=84=E0=B8=A1=E0=B9=88=E0=B8=AA?= =?UTF-8?q?=E0=B9=88=E0=B8=87=E0=B9=80=E0=B8=87=E0=B8=B4=E0=B8=99=E0=B9=80?= =?UTF-8?q?=E0=B8=94=E0=B8=B7=E0=B8=AD=E0=B8=99=E0=B8=9B=E0=B8=B1=E0=B8=88?= =?UTF-8?q?=E0=B8=88=E0=B8=B8=E0=B8=9A=E0=B8=B1=E0=B8=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ProfileController.ts | 8 +++++++- src/controllers/ProfileEmployeeController.ts | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 2b06b51d..178f4584 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -3978,7 +3978,12 @@ export class ProfileController extends Controller { // await new permission().PermissionOrgUserGet(request, "SYS_REGISTRY_OFFICER", id);//ไม่แน่ใจOFFปิดไว้ก่อน const profile = await this.profileRepo.findOne({ where: { id: id }, - relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"], + relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot", "profileSalary"], + order: { + profileSalary: { + order: "DESC", + } + } }); if (!profile) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ"); @@ -4155,6 +4160,7 @@ export class ProfileController extends Controller { posNo: shortName, isPosmasterAct: data.length > 0, posmasterAct: data, + salary: profile && profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null, }; if (_profile.child4Id != null) { diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index f4222790..e3c8ed77 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -3705,7 +3705,12 @@ export class ProfileEmployeeController extends Controller { async getProfileByProfileid(@Request() request: RequestWithUser, @Path() id: string) { const profile = await this.profileRepo.findOne({ where: { id: id }, - relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot"], + relations: ["posLevel", "posType", "current_holders", "current_holders.orgRoot", "profileSalarys"], + order: { + profileSalarys: { + order: "DESC" + } + } }); if (!profile) { throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลบุคคลนี้ในระบบ"); @@ -3826,6 +3831,7 @@ export class ProfileEmployeeController extends Controller { node: null, nodeId: null, posNo: shortName, + salary: profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null }; if (_profile.child4Id != null) {