ปรับ query report
This commit is contained in:
parent
689d48aadc
commit
86fd868adf
2 changed files with 46 additions and 34 deletions
|
|
@ -43,6 +43,7 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||||
import { Province } from "../entities/Province";
|
import { Province } from "../entities/Province";
|
||||||
import { District } from "../entities/District";
|
import { District } from "../entities/District";
|
||||||
import { SubDistrict } from "../entities/SubDistrict";
|
import { SubDistrict } from "../entities/SubDistrict";
|
||||||
|
import Extension from "../interfaces/extension";
|
||||||
|
|
||||||
@Route("api/v1/org/profile")
|
@Route("api/v1/org/profile")
|
||||||
@Tags("Profile")
|
@Tags("Profile")
|
||||||
|
|
@ -132,6 +133,11 @@ export class ProfileController extends Controller {
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
|
||||||
|
|
||||||
|
let _regisAddres = profile && profile.registrationAddress != null ? profile.registrationAddress : ""
|
||||||
|
let _subDistrict = subDistrict && subDistrict.name != null ? `\r\nตำบล/แขวง ${province?.name}` : ""
|
||||||
|
let _district = district && district.name != null ? `\r\nเขต/อำเภอ ${district?.name}` : ""
|
||||||
|
let _province = province && province.name != null ? `\r\nจังหวัด ${province?.name}` : ""
|
||||||
|
let registrationZipCode = profile && profile.registrationZipCode != null ? ` รหัสไปรษณีย์ ${profile.registrationZipCode}` : ""
|
||||||
let _root = root == null || root == undefined ? "" : `${root.orgRootName}`;
|
let _root = root == null || root == undefined ? "" : `${root.orgRootName}`;
|
||||||
let _child1 = child1 == null || child1 == undefined ? "" : `${child1.orgChild1Name}/`;
|
let _child1 = child1 == null || child1 == undefined ? "" : `${child1.orgChild1Name}/`;
|
||||||
let _child2 = child2 == null || child2 == undefined ? "" : `${child2.orgChild2Name}/`;
|
let _child2 = child2 == null || child2 == undefined ? "" : `${child2.orgChild2Name}/`;
|
||||||
|
|
@ -140,24 +146,24 @@ export class ProfileController extends Controller {
|
||||||
|
|
||||||
const mapData = {
|
const mapData = {
|
||||||
Id: profile.id,
|
Id: profile.id,
|
||||||
CitizenId: profile.citizenId,
|
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
|
||||||
Prefix: profile.prefix,
|
Prefix: profile.prefix != null ? profile.prefix : "",
|
||||||
FirstName: profile.firstName,
|
FirstName: profile.firstName != null ? profile.firstName : "",
|
||||||
LastName: profile.lastName,
|
LastName: profile.lastName != null ? profile.lastName : "",
|
||||||
DateOfBirth: profile.birthDate,
|
DateOfBirth: profile.birthDate != null ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.birthDate)) : "",
|
||||||
DateRetire: profile.dateRetire,
|
DateRetire: profile.dateRetire != null ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.dateRetire)) : "",
|
||||||
RegistrationAddress: `${profile.registrationAddress}\r\nตำบล/แขวง ${province?.name}\r\nเขต/อำเภอ ${district?.name}\r\nจังหวัด ${subDistrict?.name} รหัสไปรษณีย์ ${profile.registrationZipCode}`,
|
RegistrationAddress: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||||
SalaryAmount: profile.profileSalary.length > 0
|
SalaryAmount: profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
|
||||||
? profile.profileSalary[0].amount.toString()
|
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
|
||||||
: null,
|
: "",
|
||||||
Education: profile.profileEducations.length > 0
|
Education: profile.profileEducations.length > 0 && profile.profileEducations[profile.profileEducations.length-1].institute != null
|
||||||
? profile.profileEducations[profile.profileEducations.length-1].institute
|
? profile.profileEducations[profile.profileEducations.length-1].institute
|
||||||
: null,
|
: "",
|
||||||
AppointText: profile.dateAppoint,
|
AppointText: profile.dateAppoint != null ? profile.dateAppoint : "",
|
||||||
SalaryDate: profile.profileSalary.length > 0
|
SalaryDate: profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
|
||||||
? profile.profileSalary[0].date
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.profileSalary[0].date))
|
||||||
: null,
|
: "",
|
||||||
PositionName: profile.position,
|
PositionName: profile.position != null ? profile.position : "",
|
||||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ import { Position } from "../entities/Position";
|
||||||
import { Province } from "../entities/Province";
|
import { Province } from "../entities/Province";
|
||||||
import { District } from "../entities/District";
|
import { District } from "../entities/District";
|
||||||
import { SubDistrict } from "../entities/SubDistrict";
|
import { SubDistrict } from "../entities/SubDistrict";
|
||||||
|
import Extension from "../interfaces/extension";
|
||||||
|
|
||||||
@Route("api/v1/org/profile-employee")
|
@Route("api/v1/org/profile-employee")
|
||||||
@Tags("ProfileEmployee")
|
@Tags("ProfileEmployee")
|
||||||
|
|
@ -122,6 +123,11 @@ export class ProfileEmployeeController extends Controller {
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4;
|
||||||
|
|
||||||
|
let _regisAddres = profile && profile.registrationAddress != null ? profile.registrationAddress : ""
|
||||||
|
let _subDistrict = subDistrict && subDistrict.name != null ? `\r\nตำบล/แขวง ${province?.name}` : ""
|
||||||
|
let _district = district && district.name != null ? `\r\nเขต/อำเภอ ${district?.name}` : ""
|
||||||
|
let _province = province && province.name != null ? `\r\nจังหวัด ${province?.name}` : ""
|
||||||
|
let registrationZipCode = profile && profile.registrationZipCode != null ? ` รหัสไปรษณีย์ ${profile.registrationZipCode}` : ""
|
||||||
let _root = root == null || root == undefined ? "" : `${root.orgRootName}`;
|
let _root = root == null || root == undefined ? "" : `${root.orgRootName}`;
|
||||||
let _child1 = child1 == null || child1 == undefined ? "" : `${child1.orgChild1Name}/`;
|
let _child1 = child1 == null || child1 == undefined ? "" : `${child1.orgChild1Name}/`;
|
||||||
let _child2 = child2 == null || child2 == undefined ? "" : `${child2.orgChild2Name}/`;
|
let _child2 = child2 == null || child2 == undefined ? "" : `${child2.orgChild2Name}/`;
|
||||||
|
|
@ -130,24 +136,24 @@ export class ProfileEmployeeController extends Controller {
|
||||||
|
|
||||||
const mapData = {
|
const mapData = {
|
||||||
Id: profile.id,
|
Id: profile.id,
|
||||||
CitizenId: profile.citizenId,
|
CitizenId: profile.citizenId != null ? Extension.ToThaiNumber(profile.citizenId) : "",
|
||||||
Prefix: profile.prefix,
|
Prefix: profile.prefix != null ? profile.prefix : "",
|
||||||
FirstName: profile.firstName,
|
FirstName: profile.firstName != null ? profile.firstName : "",
|
||||||
LastName: profile.lastName,
|
LastName: profile.lastName != null ? profile.lastName : "",
|
||||||
DateOfBirth: profile.birthDate,
|
DateOfBirth: profile.birthDate != null ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.birthDate)) : "",
|
||||||
DateRetire: profile.dateRetire,
|
DateRetire: profile.dateRetire != null ? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.dateRetire)) : "",
|
||||||
RegistrationAddress: `${profile.registrationAddress}\r\nตำบล/แขวง ${province?.name}\r\nเขต/อำเภอ ${district?.name}\r\nจังหวัด ${subDistrict?.name} รหัสไปรษณีย์ ${profile.registrationZipCode}`,
|
RegistrationAddress: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||||
SalaryAmount: profile.profileSalarys.length > 0
|
SalaryAmount: profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null
|
||||||
? profile.profileSalarys[0].amount
|
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
|
||||||
: null,
|
: "",
|
||||||
Education: profile.profileEducations.length > 0
|
Education: profile.profileEducations.length > 0 && profile.profileEducations[profile.profileEducations.length-1].institute != null
|
||||||
? profile.profileEducations[profile.profileEducations.length-1].institute
|
? profile.profileEducations[profile.profileEducations.length-1].institute
|
||||||
: null,
|
: "",
|
||||||
AppointText: profile.dateAppoint,
|
AppointText: profile.dateAppoint != null ? profile.dateAppoint : "",
|
||||||
SalaryDate: profile.profileSalarys.length > 0
|
SalaryDate: profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
|
||||||
? profile.profileSalarys[0].date
|
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.profileSalarys[0].date))
|
||||||
: null,
|
: "",
|
||||||
PositionName: profile.position,
|
PositionName: profile.position != null ? profile.position : "",
|
||||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue