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