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

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")
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 },

View file

@ -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 },
});