From 1e33f6d4eab2e0710557ac959bd25641989067ad Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Fri, 28 Mar 2025 11:32:36 +0700 Subject: [PATCH 1/3] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88?= =?UTF-8?q?=E0=B8=A1=E0=B8=8A=E0=B8=B7=E0=B9=88=E0=B8=AD=E0=B8=88=E0=B8=B1?= =?UTF-8?q?=E0=B8=87=E0=B8=AB=E0=B8=A7=E0=B8=B1=E0=B8=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/OrganizationController.ts | 15 ++++++- .../OrganizationDotnetController.ts | 44 ++++++++++++++----- 2 files changed, 47 insertions(+), 12 deletions(-) diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index a1a13762..5b4849bd 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -7560,13 +7560,24 @@ export class OrganizationController extends Controller { */ @Get("root/search/sort") async searchSortRootLevelType(@Request() request: RequestWithUser) { - const root = await this.orgRootRepository.find({ + const root1 = await this.orgRootRepository.find({ where: { orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, + DEPARTMENT_CODE: Not("50"), }, - order: { isDeputy: "DESC", DEPARTMENT_CODE: "ASC", orgRootName: "ASC" }, + order: { isDeputy: "DESC", orgRootOrder: "ASC" }, select: ["orgRootName"], }); + const root2 = await this.orgRootRepository.find({ + where: { + orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, + DEPARTMENT_CODE: "50", + }, + order: { orgRootName: "ASC" }, + select: ["orgRootName"], + }); + const root = [root1, root2]; + const child1 = await this.child1Repository.find({ where: { orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index 522c06da..3bcb59ef 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -274,6 +274,12 @@ export class OrganizationDotnetController extends Controller { async GetProfileByKeycloakIdAsync(@Path() keycloakId: string) { const profile = await this.profileRepo.findOne({ relations: [ + "registrationProvince", + "registrationDistrict", + "registrationSubDistrict", + "currentProvince", + "currentDistrict", + "currentSubDistrict", "posLevel", "posType", "profileSalary", @@ -303,6 +309,12 @@ export class OrganizationDotnetController extends Controller { if (!profile) { const profile = await this.profileEmpRepo.findOne({ relations: [ + "registrationProvince", + "registrationDistrict", + "registrationSubDistrict", + "currentProvince", + "currentDistrict", + "currentSubDistrict", "posLevel", "posType", "profileSalary", @@ -524,10 +536,17 @@ export class OrganizationDotnetController extends Controller { registrationProvinceId: profile.registrationProvinceId, registrationDistrictId: profile.registrationDistrictId, registrationSubDistrictId: profile.registrationSubDistrictId, + registrationProvince: profile.registrationProvince.id, + registrationDistrict: profile.registrationDistrict.id, + registrationSubDistrict: profile.registrationSubDistrict.id, registrationZipCode: profile.registrationZipCode, currentAddress: profile.currentAddress, currentProvinceId: profile.currentProvinceId, + currentDistrictId: profile.currentDistrictId, currentSubDistrictId: profile.currentSubDistrictId, + currentProvince: profile.currentProvince.id, + currentDistrict: profile.currentDistrict.id, + currentSubDistrict: profile.currentSubDistrict.id, currentZipCode: profile.currentZipCode, dutyTimeId: profile.dutyTimeId, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, @@ -810,10 +829,17 @@ export class OrganizationDotnetController extends Controller { registrationProvinceId: profile.registrationProvinceId, registrationDistrictId: profile.registrationDistrictId, registrationSubDistrictId: profile.registrationSubDistrictId, + registrationProvince: profile.registrationProvince.id, + registrationDistrict: profile.registrationDistrict.id, + registrationSubDistrict: profile.registrationSubDistrict.id, registrationZipCode: profile.registrationZipCode, currentAddress: profile.currentAddress, currentProvinceId: profile.currentProvinceId, + currentDistrictId: profile.currentDistrictId, currentSubDistrictId: profile.currentSubDistrictId, + currentProvince: profile.currentProvince.id, + currentDistrict: profile.currentDistrict.id, + currentSubDistrict: profile.currentSubDistrict.id, currentZipCode: profile.currentZipCode, dutyTimeId: profile.dutyTimeId, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, @@ -3319,12 +3345,11 @@ export class OrganizationDotnetController extends Controller { where: { orgRevisionIsCurrent: true }, }); - if(body.revisionId){ + if (body.revisionId) { findRevision = await this.orgRevisionRepo.findOne({ where: { id: body.revisionId }, }); } - const profile_ = await Promise.all( profile.map((item: Profile) => { @@ -3490,12 +3515,11 @@ export class OrganizationDotnetController extends Controller { where: { orgRevisionIsCurrent: true }, }); - if(body.revisionId){ + if (body.revisionId) { findRevision = await this.orgRevisionRepo.findOne({ where: { id: body.revisionId }, }); } - const profile_ = await Promise.all( profile.map((item: Profile) => { @@ -3638,11 +3662,11 @@ export class OrganizationDotnetController extends Controller { ], }); - let findRevision = await this.orgRevisionRepo.findOne({ + let findRevision = await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true }, }); - - if(body.revisionId){ + + if (body.revisionId) { findRevision = await this.orgRevisionRepo.findOne({ where: { id: body.revisionId }, }); @@ -3791,11 +3815,11 @@ export class OrganizationDotnetController extends Controller { ], }); - let findRevision = await this.orgRevisionRepo.findOne({ + let findRevision = await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true }, }); - - if(body.revisionId){ + + if (body.revisionId) { findRevision = await this.orgRevisionRepo.findOne({ where: { id: body.revisionId }, }); From 3c3387574875c3e67b0c878e5edf183715bc93f0 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 28 Mar 2025 12:10:12 +0700 Subject: [PATCH 2/3] fix --- src/controllers/OrganizationController.ts | 2 +- src/controllers/OrganizationDotnetController.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index 5b4849bd..66ee363d 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -7576,7 +7576,7 @@ export class OrganizationController extends Controller { order: { orgRootName: "ASC" }, select: ["orgRootName"], }); - const root = [root1, root2]; + const root = [...root1, ...root2]; const child1 = await this.child1Repository.find({ where: { diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index 3bcb59ef..dabc0921 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -536,17 +536,17 @@ export class OrganizationDotnetController extends Controller { registrationProvinceId: profile.registrationProvinceId, registrationDistrictId: profile.registrationDistrictId, registrationSubDistrictId: profile.registrationSubDistrictId, - registrationProvince: profile.registrationProvince.id, - registrationDistrict: profile.registrationDistrict.id, - registrationSubDistrict: profile.registrationSubDistrict.id, + registrationProvince: profile.registrationProvince.name, + registrationDistrict: profile.registrationDistrict.name, + registrationSubDistrict: profile.registrationSubDistrict.name, registrationZipCode: profile.registrationZipCode, currentAddress: profile.currentAddress, currentProvinceId: profile.currentProvinceId, currentDistrictId: profile.currentDistrictId, currentSubDistrictId: profile.currentSubDistrictId, - currentProvince: profile.currentProvince.id, - currentDistrict: profile.currentDistrict.id, - currentSubDistrict: profile.currentSubDistrict.id, + currentProvince: profile.currentProvince.name, + currentDistrict: profile.currentDistrict.name, + currentSubDistrict: profile.currentSubDistrict.name, currentZipCode: profile.currentZipCode, dutyTimeId: profile.dutyTimeId, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, From 13e82ad80f3728299ddc103210c0244f951a458c Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Fri, 28 Mar 2025 12:26:12 +0700 Subject: [PATCH 3/3] edit subrank child1 --- src/controllers/OrgChild1Controller.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controllers/OrgChild1Controller.ts b/src/controllers/OrgChild1Controller.ts index 7f3dde58..7ba65f60 100644 --- a/src/controllers/OrgChild1Controller.ts +++ b/src/controllers/OrgChild1Controller.ts @@ -337,6 +337,8 @@ export class OrgChild1Controller { orgChild1Name: requestBody.orgChild1Name, orgChild1ShortName: requestBody.orgChild1ShortName, orgChild1Code: requestBody.orgChild1Code, + orgChild1Rank: requestBody.orgChild1Rank != null ? requestBody.orgChild1Rank : _null, + orgChild1RankSub: requestBody.orgChild1RankSub, DEPARTMENT_CODE: requestBody.DEPARTMENT_CODE != null ? requestBody.DEPARTMENT_CODE : _null, DIVISION_CODE: requestBody.DIVISION_CODE != null ? requestBody.DIVISION_CODE : _null, SECTION_CODE: requestBody.SECTION_CODE != null ? requestBody.SECTION_CODE : _null,