เพิ่มชื่อจังหวัด

This commit is contained in:
mamoss 2025-03-28 11:32:36 +07:00
parent 27fe258408
commit 1e33f6d4ea
2 changed files with 47 additions and 12 deletions

View file

@ -7560,13 +7560,24 @@ export class OrganizationController extends Controller {
*/ */
@Get("root/search/sort") @Get("root/search/sort")
async searchSortRootLevelType(@Request() request: RequestWithUser) { async searchSortRootLevelType(@Request() request: RequestWithUser) {
const root = await this.orgRootRepository.find({ const root1 = await this.orgRootRepository.find({
where: { where: {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },
DEPARTMENT_CODE: Not("50"),
}, },
order: { isDeputy: "DESC", DEPARTMENT_CODE: "ASC", orgRootName: "ASC" }, order: { isDeputy: "DESC", orgRootOrder: "ASC" },
select: ["orgRootName"], 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({ const child1 = await this.child1Repository.find({
where: { where: {
orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true }, orgRevision: { orgRevisionIsDraft: false, orgRevisionIsCurrent: true },

View file

@ -274,6 +274,12 @@ export class OrganizationDotnetController extends Controller {
async GetProfileByKeycloakIdAsync(@Path() keycloakId: string) { async GetProfileByKeycloakIdAsync(@Path() keycloakId: string) {
const profile = await this.profileRepo.findOne({ const profile = await this.profileRepo.findOne({
relations: [ relations: [
"registrationProvince",
"registrationDistrict",
"registrationSubDistrict",
"currentProvince",
"currentDistrict",
"currentSubDistrict",
"posLevel", "posLevel",
"posType", "posType",
"profileSalary", "profileSalary",
@ -303,6 +309,12 @@ export class OrganizationDotnetController extends Controller {
if (!profile) { if (!profile) {
const profile = await this.profileEmpRepo.findOne({ const profile = await this.profileEmpRepo.findOne({
relations: [ relations: [
"registrationProvince",
"registrationDistrict",
"registrationSubDistrict",
"currentProvince",
"currentDistrict",
"currentSubDistrict",
"posLevel", "posLevel",
"posType", "posType",
"profileSalary", "profileSalary",
@ -524,10 +536,17 @@ export class OrganizationDotnetController extends Controller {
registrationProvinceId: profile.registrationProvinceId, registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId, registrationDistrictId: profile.registrationDistrictId,
registrationSubDistrictId: profile.registrationSubDistrictId, registrationSubDistrictId: profile.registrationSubDistrictId,
registrationProvince: profile.registrationProvince.id,
registrationDistrict: profile.registrationDistrict.id,
registrationSubDistrict: profile.registrationSubDistrict.id,
registrationZipCode: profile.registrationZipCode, registrationZipCode: profile.registrationZipCode,
currentAddress: profile.currentAddress, currentAddress: profile.currentAddress,
currentProvinceId: profile.currentProvinceId, currentProvinceId: profile.currentProvinceId,
currentDistrictId: profile.currentDistrictId,
currentSubDistrictId: profile.currentSubDistrictId, currentSubDistrictId: profile.currentSubDistrictId,
currentProvince: profile.currentProvince.id,
currentDistrict: profile.currentDistrict.id,
currentSubDistrict: profile.currentSubDistrict.id,
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
@ -810,10 +829,17 @@ export class OrganizationDotnetController extends Controller {
registrationProvinceId: profile.registrationProvinceId, registrationProvinceId: profile.registrationProvinceId,
registrationDistrictId: profile.registrationDistrictId, registrationDistrictId: profile.registrationDistrictId,
registrationSubDistrictId: profile.registrationSubDistrictId, registrationSubDistrictId: profile.registrationSubDistrictId,
registrationProvince: profile.registrationProvince.id,
registrationDistrict: profile.registrationDistrict.id,
registrationSubDistrict: profile.registrationSubDistrict.id,
registrationZipCode: profile.registrationZipCode, registrationZipCode: profile.registrationZipCode,
currentAddress: profile.currentAddress, currentAddress: profile.currentAddress,
currentProvinceId: profile.currentProvinceId, currentProvinceId: profile.currentProvinceId,
currentDistrictId: profile.currentDistrictId,
currentSubDistrictId: profile.currentSubDistrictId, currentSubDistrictId: profile.currentSubDistrictId,
currentProvince: profile.currentProvince.id,
currentDistrict: profile.currentDistrict.id,
currentSubDistrict: profile.currentSubDistrict.id,
currentZipCode: profile.currentZipCode, currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId, dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate, dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
@ -3319,13 +3345,12 @@ export class OrganizationDotnetController extends Controller {
where: { orgRevisionIsCurrent: true }, where: { orgRevisionIsCurrent: true },
}); });
if(body.revisionId){ if (body.revisionId) {
findRevision = await this.orgRevisionRepo.findOne({ findRevision = await this.orgRevisionRepo.findOne({
where: { id: body.revisionId }, where: { id: body.revisionId },
}); });
} }
const profile_ = await Promise.all( const profile_ = await Promise.all(
profile.map((item: Profile) => { profile.map((item: Profile) => {
const shortName = const shortName =
@ -3490,13 +3515,12 @@ export class OrganizationDotnetController extends Controller {
where: { orgRevisionIsCurrent: true }, where: { orgRevisionIsCurrent: true },
}); });
if(body.revisionId){ if (body.revisionId) {
findRevision = await this.orgRevisionRepo.findOne({ findRevision = await this.orgRevisionRepo.findOne({
where: { id: body.revisionId }, where: { id: body.revisionId },
}); });
} }
const profile_ = await Promise.all( const profile_ = await Promise.all(
profile.map((item: Profile) => { profile.map((item: Profile) => {
const shortName = const shortName =
@ -3638,11 +3662,11 @@ export class OrganizationDotnetController extends Controller {
], ],
}); });
let findRevision = await this.orgRevisionRepo.findOne({ let findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true }, where: { orgRevisionIsCurrent: true },
}); });
if(body.revisionId){ if (body.revisionId) {
findRevision = await this.orgRevisionRepo.findOne({ findRevision = await this.orgRevisionRepo.findOne({
where: { id: body.revisionId }, 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 }, where: { orgRevisionIsCurrent: true },
}); });
if(body.revisionId){ if (body.revisionId) {
findRevision = await this.orgRevisionRepo.findOne({ findRevision = await this.orgRevisionRepo.findOne({
where: { id: body.revisionId }, where: { id: body.revisionId },
}); });