Merge branch 'develop' into adiDev

# Conflicts:
#	src/controllers/ProfileController.ts
This commit is contained in:
AdisakKanthawilang 2025-03-05 16:47:23 +07:00
commit 9a92b5da71
9 changed files with 520 additions and 93 deletions

View file

@ -116,12 +116,11 @@ export class ProfileController extends Controller {
private profileLeaveRepository = AppDataSource.getRepository(ProfileLeave);
private posMasterActRepository = AppDataSource.getRepository(PosMasterAct);
private profileChildrenRepository = AppDataSource.getRepository(ProfileChildren);
private changeNameRepository = AppDataSource.getRepository(ProfileChangeName);
private profileActpositionRepo = AppDataSource.getRepository(ProfileActposition);
private dutyRepository = AppDataSource.getRepository(ProfileDuty);
private profileAssessmentsRepository = AppDataSource.getRepository(ProfileAssessment);
private profileAbilityRepo = AppDataSource.getRepository(ProfileAbility);
private changeNameRepository = AppDataSource.getRepository(ProfileChangeName);
private profileActpositionRepo = AppDataSource.getRepository(ProfileActposition);
private dutyRepository = AppDataSource.getRepository(ProfileDuty);
private profileAssessmentsRepository = AppDataSource.getRepository(ProfileAssessment);
private profileAbilityRepo = AppDataSource.getRepository(ProfileAbility);
/**
* report
@ -254,8 +253,11 @@ export class ProfileController extends Controller {
"orgChild4",
"positionExecutive",
],
where: { profileId: id },
order: { commandDateAffect: "ASC" },
where: {
profileId: id,
commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16"]),
},
order: { order: "ASC" },
});
const salarys =
@ -271,6 +273,7 @@ export class ProfileController extends Controller {
orgChild2: item.orgChild2,
orgChild3: item.orgChild3,
orgChild4: item.orgChild4,
positionCee: item.positionCee,
positionExecutive: item.positionExecutive,
}))
: [
@ -877,7 +880,15 @@ export class ProfileController extends Controller {
@Get("kk1/{id}")
public async getKk1new(@Path() id: string, @Request() req: RequestWithUser) {
const profiles = await this.profileRepo.findOne({
relations: ["currentSubDistrict", "currentDistrict", "currentProvince","registrationSubDistrict", "registrationDistrict", "registrationProvince", "profileAvatars"],
relations: [
"currentSubDistrict",
"currentDistrict",
"currentProvince",
"registrationSubDistrict",
"registrationDistrict",
"registrationProvince",
"profileAvatars",
],
order: {
profileAvatars: { createdAt: "ASC" },
},
@ -1014,10 +1025,18 @@ export class ProfileController extends Controller {
? cert_raw.slice(-2).map((item) => ({
certificateType: item.certificateType ?? null,
issuer: item.issuer ?? null,
certificateNo: item.certificateNo?Extension.ToThaiNumber(item.certificateNo):null,
issueDate: item.issueDate?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate)):null,
expireDate: item.expireDate?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate)):null,
issueToExpireDate: item.issueDate?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate)):"" + item.expireDate?" - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate)): null,
certificateNo: item.certificateNo ? Extension.ToThaiNumber(item.certificateNo) : null,
issueDate: item.issueDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate))
: null,
expireDate: item.expireDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate))
: null,
issueToExpireDate: item.issueDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.issueDate))
: "" + item.expireDate
? " - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.expireDate))
: null,
}))
: [
{
@ -1074,8 +1093,9 @@ export class ProfileController extends Controller {
const disciplines =
discipline_raw.length > 0
? discipline_raw.slice(-2).map((item) => ({
disciplineYear:
item.refCommandDate?Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()):null,
disciplineYear: item.refCommandDate
? Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString())
: null,
disciplineDetail: item.detail ?? null,
refNo: Extension.ToThaiNumber(item.refCommandNo) ?? null,
}))
@ -1252,14 +1272,14 @@ export class ProfileController extends Controller {
where: { profileId: id },
});
const children =
children_raw.length > 0
? children_raw.map((item,index) => ({
no: Extension.ToThaiNumber((index+1).toString()),
children_raw.length > 0
? children_raw.map((item, index) => ({
no: Extension.ToThaiNumber((index + 1).toString()),
childrenPrefix: item.childrenPrefix,
childrenFirstName: item.childrenFirstName,
childrenLastName: item.childrenLastName,
childrenFullName: `${item.childrenPrefix}${item.childrenFirstName} ${item.childrenLastName}`,
childrenLive: item.childrenLive == true?"มีชีวิต":"ถึงแก่กรรม",
childrenLive: item.childrenLive == true ? "มีชีวิต" : "ถึงแก่กรรม",
}))
: [
{
@ -1276,9 +1296,11 @@ export class ProfileController extends Controller {
order: { createdAt: "ASC" },
});
const changeName =
changeName_raw.length > 0
changeName_raw.length > 0
? changeName_raw.map((item) => ({
createdAt: item.createdAt?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.createdAt)):null,
createdAt: item.createdAt
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.createdAt))
: null,
status: item.status,
prefix: item.prefix,
firstName: item.firstName,
@ -1293,7 +1315,7 @@ export class ProfileController extends Controller {
lastName: "-",
},
];
const position_raw = await this.salaryRepo.find({
where: {
profileId: id,
@ -1303,16 +1325,26 @@ export class ProfileController extends Controller {
order: { order: "ASC" },
});
const positionList =
position_raw.length > 0
position_raw.length > 0
? position_raw.map((item) => ({
commandDateAffect: item.commandDateAffect?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect)):"",
commandDateSign: item.commandDateSign?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign)):"",
posNo: item.posNoAbb?Extension.ToThaiNumber(item.posNoAbb):"" + item.posNo?Extension.ToThaiNumber(item.posNo):"",
commandDateAffect: item.commandDateAffect
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
: "",
commandDateSign: item.commandDateSign
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign))
: "",
posNo: item.posNoAbb
? Extension.ToThaiNumber(item.posNoAbb)
: "" + item.posNo
? Extension.ToThaiNumber(item.posNo)
: "",
position: item.positionName,
posType: item.positionType,
posLevel: item.positionLevel?Extension.ToThaiNumber(item.positionLevel):"",
amount: item.amount?Extension.ToThaiNumber(Number(item.amount).toLocaleString()):"",
positionSalaryAmount: item.positionSalaryAmount?Extension.ToThaiNumber(Number(item.positionSalaryAmount).toLocaleString()):"",
posLevel: item.positionLevel ? Extension.ToThaiNumber(item.positionLevel) : "",
amount: item.amount ? Extension.ToThaiNumber(Number(item.amount).toLocaleString()) : "",
positionSalaryAmount: item.positionSalaryAmount
? Extension.ToThaiNumber(Number(item.positionSalaryAmount).toLocaleString())
: "",
}))
: [
{
@ -1332,11 +1364,17 @@ export class ProfileController extends Controller {
order: { createdAt: "ASC" },
});
const actposition =
actposition_raw.length > 0
actposition_raw.length > 0
? actposition_raw.map((item) => ({
date: item.dateStart?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart)):"" + item.dateEnd?" - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd)):"",
refCommandDate: item.refCommandDate?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate)):"",
refCommandNo: item.refCommandNo?Extension.ToThaiNumber(item.refCommandNo):"",
date: item.dateStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
: "" + item.dateEnd
? " - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
: "",
refCommandDate: item.refCommandDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
: "",
refCommandNo: item.refCommandNo ? Extension.ToThaiNumber(item.refCommandNo) : "",
position: item.position,
posNo: item.posNo,
}))
@ -1354,51 +1392,61 @@ export class ProfileController extends Controller {
order: { createdAt: "ASC" },
});
const duty =
duty_raw.length > 0
duty_raw.length > 0
? duty_raw.map((item) => ({
date: item.dateStart?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart)):"" + item.dateEnd?" - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd)):"",
refCommandDate: item.refCommandDate?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate)):"",
refCommandNo: item.refCommandNo?Extension.ToThaiNumber(item.refCommandNo):"",
}))
: [
{
date: "-",
refCommandDate: "-",
refCommandNo: "-",
},
];
date: item.dateStart
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateStart))
: "" + item.dateEnd
? " - " + Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.dateEnd))
: "",
refCommandDate: item.refCommandDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.refCommandDate))
: "",
refCommandNo: item.refCommandNo ? Extension.ToThaiNumber(item.refCommandNo) : "",
}))
: [
{
date: "-",
refCommandDate: "-",
refCommandNo: "-",
},
];
const assessments_raw = await this.profileAssessmentsRepository.find({
where: { profileId: id },
order: { createdAt: "ASC" },
});
const assessments =
assessments_raw.length > 0
assessments_raw.length > 0
? assessments_raw.map((item) => ({
year: item.year?Extension.ToThaiNumber(item.year):"",
period: item.period && item.period == "APR"?"เมษายน":"ตุลาคม",
point1: item.point1?Extension.ToThaiNumber((item.point1).toString()):"",
point1Total: item.point1Total?Extension.ToThaiNumber((item.point1Total).toString()):"",
point2: item.point2?Extension.ToThaiNumber((item.point2).toString()):"",
point2Total: item.point2Total?Extension.ToThaiNumber((item.point2Total).toString()):"",
pointSum: item.pointSum?Extension.ToThaiNumber((item.pointSum).toString()):"",
pointSumTh: item.pointSum?Extension.textPoint(item.pointSum):"",
}))
: [
{
year: "-",
period: "-",
point1: "-",
point2: "-",
pointSum: "-",
pointSumTh: "-",
},
];
year: item.year ? Extension.ToThaiNumber(item.year) : "",
period: item.period && item.period == "APR" ? "เมษายน" : "ตุลาคม",
point1: item.point1 ? Extension.ToThaiNumber(item.point1.toString()) : "",
point1Total: item.point1Total
? Extension.ToThaiNumber(item.point1Total.toString())
: "",
point2: item.point2 ? Extension.ToThaiNumber(item.point2.toString()) : "",
point2Total: item.point2Total
? Extension.ToThaiNumber(item.point2Total.toString())
: "",
pointSum: item.pointSum ? Extension.ToThaiNumber(item.pointSum.toString()) : "",
pointSumTh: item.pointSum ? Extension.textPoint(item.pointSum) : "",
}))
: [
{
year: "-",
period: "-",
point1: "-",
point2: "-",
pointSum: "-",
pointSumTh: "-",
},
];
const profileAbility_raw = await this.profileAbilityRepo.find({
where: { profileId: id },
order: { createdAt: "ASC" },
});
const profileAbility =
profileAbility_raw.length > 0
profileAbility_raw.length > 0
? profileAbility_raw.map((item) => ({
field: item.field?item.field:"",
detail: item.detail?item.detail:"",
@ -1448,11 +1496,21 @@ export class ProfileController extends Controller {
firstName: profiles?.firstName != null ? profiles.firstName : "",
lastName: profiles?.lastName != null ? profiles.lastName : "",
position: profiles?.position != null ? profiles.position : "",
amount: profiles?.amount != null ? Extension.ToThaiNumber(profiles.amount.toLocaleString()) : "",
positionSalaryAmount: profiles?.positionSalaryAmount != null ? Extension.ToThaiNumber(profiles.positionSalaryAmount.toLocaleString()) : "",
mouthSalaryAmount: profiles?.mouthSalaryAmount != null ? Extension.ToThaiNumber(profiles.mouthSalaryAmount.toLocaleString()) : "",
amountSpecial: profiles?.amountSpecial != null ? Extension.ToThaiNumber(profiles.amountSpecial.toLocaleString()) : "",
salarySum:sum,
amount:
profiles?.amount != null ? Extension.ToThaiNumber(profiles.amount.toLocaleString()) : "",
positionSalaryAmount:
profiles?.positionSalaryAmount != null
? Extension.ToThaiNumber(profiles.positionSalaryAmount.toLocaleString())
: "",
mouthSalaryAmount:
profiles?.mouthSalaryAmount != null
? Extension.ToThaiNumber(profiles.mouthSalaryAmount.toLocaleString())
: "",
amountSpecial:
profiles?.amountSpecial != null
? Extension.ToThaiNumber(profiles.amountSpecial.toLocaleString())
: "",
salarySum: sum,
ocFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
birthDate: profiles?.birthDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.birthDate))
@ -1472,14 +1530,16 @@ export class ProfileController extends Controller {
profileFamilyFather?.fatherLastName
? `${profileFamilyFather?.fatherPrefix ?? ""}${profileFamilyFather?.fatherFirstName ?? ""} ${profileFamilyFather?.fatherLastName ?? ""}`.trim()
: null,
fatherLive:profileFamilyFather && profileFamilyFather?.fatherLive == true?"มีชีวิต":"ถึงแก่กรรม",
fatherLive:
profileFamilyFather && profileFamilyFather?.fatherLive == true ? "มีชีวิต" : "ถึงแก่กรรม",
motherFullName:
profileFamilyMother?.motherPrefix ||
profileFamilyMother?.motherFirstName ||
profileFamilyMother?.motherLastName
? `${profileFamilyMother?.motherPrefix ?? ""}${profileFamilyMother?.motherFirstName ?? ""} ${profileFamilyMother?.motherLastName ?? ""}`.trim()
: null,
motherLive:profileFamilyMother && profileFamilyMother?.motherLive == true?"มีชีวิต":"ถึงแก่กรรม",
motherLive:
profileFamilyMother && profileFamilyMother?.motherLive == true ? "มีชีวิต" : "ถึงแก่กรรม",
coupleFullName:
profileFamilyCouple?.couplePrefix ||
profileFamilyCouple?.coupleFirstName ||
@ -1487,7 +1547,8 @@ export class ProfileController extends Controller {
? `${profileFamilyCouple?.couplePrefix ?? ""}${profileFamilyCouple?.coupleFirstName ?? ""} ${profileFamilyCouple?.coupleLastName ?? ""}`.trim()
: null,
coupleLastNameOld: profileFamilyCouple?.coupleLastNameOld ?? null,
coupleLive:profileFamilyCouple && profileFamilyCouple?.coupleLive == true?"มีชีวิต":"ถึงแก่กรรม",
coupleLive:
profileFamilyCouple && profileFamilyCouple?.coupleLive == true ? "มีชีวิต" : "ถึงแก่กรรม",
currentAddress:
profiles.currentAddress != null ? Extension.ToThaiNumber(profiles.currentAddress) : "",
currentSubDistrict:
@ -1503,12 +1564,12 @@ export class ProfileController extends Controller {
? Extension.ToThaiNumber(profiles.currentProvince.name)
: "",
currentZipcode:
profiles.currentZipCode != null
? Extension.ToThaiNumber(profiles.currentZipCode)
: "",
profiles.currentZipCode != null ? Extension.ToThaiNumber(profiles.currentZipCode) : "",
fullCurrentAddress: fullCurrentAddress,
registrationAddress:
profiles.registrationAddress != null ? Extension.ToThaiNumber(profiles.registrationAddress) : "",
profiles.registrationAddress != null
? Extension.ToThaiNumber(profiles.registrationAddress)
: "",
registrationSubDistrict:
profiles.registrationSubDistrict != null
? Extension.ToThaiNumber(profiles.registrationSubDistrict.name)

View file

@ -246,8 +246,11 @@ export class ProfileEmployeeController extends Controller {
"positionCee",
"positionExecutive",
],
where: { profileEmployeeId: id },
order: { commandDateAffect: "ASC" },
where: {
profileEmployeeId: id,
commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16"]),
},
order: { order: "ASC" },
});
const salarys =
salary_raw.length > 1
@ -2443,9 +2446,10 @@ export class ProfileEmployeeController extends Controller {
dateRetireLaw: profile.dateRetireLaw,
posMaster: posMaster == null ? null : posMaster.posMasterNo,
posMasterNo: posMaster == null ? null : posMaster.posMasterNo,
posLevelName: profile.posLevel == null && profile.posType == null
? null
: `${profile.posType.posTypeShortName} ${profile.posLevel.posLevelName}`,
posLevelName:
profile.posLevel == null && profile.posType == null
? null
: `${profile.posType.posTypeShortName} ${profile.posLevel.posLevelName}`,
posLevelRank: profile.posLevel == null ? null : profile.posLevel.posLevelRank,
posLevelId: profile.posLevel == null ? null : profile.posLevel.id,
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
@ -2836,9 +2840,10 @@ export class ProfileEmployeeController extends Controller {
posTypeId: item.posTypeId,
posTypeName: item.posType?.posTypeName,
posLevelId: item.posLevelId,
posLevelName: item.posLevel == null && item.posType == null
? null
: `${item.posType?.posTypeShortName} ${item.posLevel?.posLevelName}`,
posLevelName:
item.posLevel == null && item.posType == null
? null
: `${item.posType?.posTypeShortName} ${item.posLevel?.posLevelName}`,
educationDegree:
latestProfileEducation != null && latestProfileEducation.educationLevel != null
? latestProfileEducation.educationLevel
@ -4637,9 +4642,10 @@ export class ProfileEmployeeController extends Controller {
posTypeId: item.posTypeId,
posTypeName: item.posType?.posTypeName,
posLevelId: item.posLevelId,
posLevelName: item.posLevel == null && item.posType == null
? null
: `${item.posType?.posTypeShortName} ${item.posLevel?.posLevelName}`,
posLevelName:
item.posLevel == null && item.posType == null
? null
: `${item.posType?.posTypeShortName} ${item.posLevel?.posLevelName}`,
educationDegree:
latestProfileEducation != null && latestProfileEducation.educationLevel != null
? latestProfileEducation.educationLevel

View file

@ -241,8 +241,11 @@ export class ProfileEmployeeTempController extends Controller {
"positionCee",
"positionExecutive",
],
where: { profileEmployeeId: id },
order: { commandDateAffect: "ASC" },
where: {
profileEmployeeId: id,
commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16"]),
},
order: { order: "ASC" },
});
const salarys =
salary_raw.length > 1

View file

@ -37,7 +37,7 @@ export class ProfileSalaryController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.salaryRepo.find({
where: { profileId: profile.id },
where: { profileId: profile.id, commandCode: In(["5", "6", "7"]) },
order: { order: "ASC" },
});
return new HttpSuccess(record);
@ -50,7 +50,25 @@ export class ProfileSalaryController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const record = await this.salaryRepo.find({
where: { profileId: profile.id },
where: {
profileId: profile.id,
commandCode: In([
"0",
"9",
"1",
"2",
"3",
"4",
"8",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
]),
},
order: { order: "ASC" },
});
return new HttpSuccess(record);

View file

@ -0,0 +1,88 @@
import {
Entity,
Column,
OneToMany,
JoinColumn,
ManyToOne,
Double,
ManyToMany,
JoinTable,
} from "typeorm";
import { EntityBase } from "./base/Base";
@Entity("tenureLevelEmployee")
export class TenureLevelEmployee extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง profileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
comment: "ระดับซี",
default: null,
length: 255,
})
positionCee: string;
@Column({
nullable: true,
comment: "จำนวนวัน",
default: null,
})
days_diff: number;
@Column({
nullable: true,
comment: "จำนวนปีดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Years: number;
@Column({
nullable: true,
comment: "จำนวนเดือนดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Months: number;
@Column({
nullable: true,
comment: "จำนวนวันดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Days: number;
@Column({
nullable: true,
comment: "ชื่อประเภทตำแหน่ง",
default: null,
length: 255,
})
positionType: string;
@Column({
nullable: true,
comment: "ชื่อระดับตำแหน่ง",
default: null,
length: 255,
})
positionLevel: string;
}
export class CreateTenureLevelOfficer {
profileEmployeeId: string;
positionCee: string | null;
days_diff: number | null;
Years: number | null;
Months: number | null;
Days: number | null;
positionType: string | null;
positionLevel: string | null;
}

View file

@ -0,0 +1,88 @@
import {
Entity,
Column,
OneToMany,
JoinColumn,
ManyToOne,
Double,
ManyToMany,
JoinTable,
} from "typeorm";
import { EntityBase } from "./base/Base";
@Entity("tenureLevelOfficer")
export class TenureLevelOfficer extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
@Column({
nullable: true,
comment: "ระดับซี",
default: null,
length: 255,
})
positionCee: string;
@Column({
nullable: true,
comment: "จำนวนวัน",
default: null,
})
days_diff: number;
@Column({
nullable: true,
comment: "จำนวนปีดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Years: number;
@Column({
nullable: true,
comment: "จำนวนเดือนดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Months: number;
@Column({
nullable: true,
comment: "จำนวนวันดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Days: number;
@Column({
nullable: true,
comment: "ชื่อประเภทตำแหน่ง",
default: null,
length: 255,
})
positionType: string;
@Column({
nullable: true,
comment: "ชื่อระดับตำแหน่ง",
default: null,
length: 255,
})
positionLevel: string;
}
export class CreateTenureLevelOfficer {
profileId: string;
positionCee: string | null;
days_diff: number | null;
Years: number | null;
Months: number | null;
Days: number | null;
positionType: string | null;
positionLevel: string | null;
}

View file

@ -0,0 +1,71 @@
import {
Entity,
Column,
OneToMany,
JoinColumn,
ManyToOne,
Double,
ManyToMany,
JoinTable,
} from "typeorm";
import { EntityBase } from "./base/Base";
@Entity("tenurePositionEmployee")
export class TenurePositionEmployee extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
comment: "ชื่อตำแหน่ง",
default: null,
length: 255,
})
positionName: string;
@Column({
nullable: true,
comment: "จำนวนวัน",
default: null,
})
days_diff: number;
@Column({
nullable: true,
comment: "จำนวนปีดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Years: number;
@Column({
nullable: true,
comment: "จำนวนเดือนดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Months: number;
@Column({
nullable: true,
comment: "จำนวนวันดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Days: number;
}
export class CreateTenurePositionEmployee {
profileEmployeeId: string;
positionName: string | null;
days_diff: number | null;
Years: number | null;
Months: number | null;
Days: number | null;
}

View file

@ -0,0 +1,71 @@
import {
Entity,
Column,
OneToMany,
JoinColumn,
ManyToOne,
Double,
ManyToMany,
JoinTable,
} from "typeorm";
import { EntityBase } from "./base/Base";
@Entity("tenurePositionOfficer")
export class TenurePositionOfficer extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
@Column({
nullable: true,
comment: "ชื่อตำแหน่ง",
default: null,
length: 255,
})
positionName: string;
@Column({
nullable: true,
comment: "จำนวนวัน",
default: null,
})
days_diff: number;
@Column({
nullable: true,
comment: "จำนวนปีดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Years: number;
@Column({
nullable: true,
comment: "จำนวนเดือนดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Months: number;
@Column({
nullable: true,
comment: "จำนวนวันดำรงตำแหน่งงปัจจุบัน",
default: null,
})
Days: number;
}
export class CreateTenurePositionOfficer {
profileId: string;
positionName: string | null;
days_diff: number | null;
Years: number | null;
Months: number | null;
Days: number | null;
}

View file

@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddNewTable050320251741164808500 implements MigrationInterface {
name = 'AddNewTable050320251741164808500'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`tenurePositionEmployee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee', \`positionName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่ง', \`days_diff\` int NULL COMMENT 'จำนวนวัน', \`Years\` int NULL COMMENT 'จำนวนปีดำรงตำแหน่งงปัจจุบัน', \`Months\` int NULL COMMENT 'จำนวนเดือนดำรงตำแหน่งงปัจจุบัน', \`Days\` int NULL COMMENT 'จำนวนวันดำรงตำแหน่งงปัจจุบัน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`tenurePositionOfficer\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`positionName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่ง', \`days_diff\` int NULL COMMENT 'จำนวนวัน', \`Years\` int NULL COMMENT 'จำนวนปีดำรงตำแหน่งงปัจจุบัน', \`Months\` int NULL COMMENT 'จำนวนเดือนดำรงตำแหน่งงปัจจุบัน', \`Days\` int NULL COMMENT 'จำนวนวันดำรงตำแหน่งงปัจจุบัน', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`tenureLevelEmployee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profileEmployee', \`positionCee\` varchar(255) NULL COMMENT 'ระดับซี', \`days_diff\` int NULL COMMENT 'จำนวนวัน', \`Years\` int NULL COMMENT 'จำนวนปีดำรงตำแหน่งงปัจจุบัน', \`Months\` int NULL COMMENT 'จำนวนเดือนดำรงตำแหน่งงปัจจุบัน', \`Days\` int NULL COMMENT 'จำนวนวันดำรงตำแหน่งงปัจจุบัน', \`positionType\` varchar(255) NULL COMMENT 'ชื่อประเภทตำแหน่ง', \`positionLevel\` varchar(255) NULL COMMENT 'ชื่อระดับตำแหน่ง', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`tenureLevelOfficer\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`positionCee\` varchar(255) NULL COMMENT 'ระดับซี', \`days_diff\` int NULL COMMENT 'จำนวนวัน', \`Years\` int NULL COMMENT 'จำนวนปีดำรงตำแหน่งงปัจจุบัน', \`Months\` int NULL COMMENT 'จำนวนเดือนดำรงตำแหน่งงปัจจุบัน', \`Days\` int NULL COMMENT 'จำนวนวันดำรงตำแหน่งงปัจจุบัน', \`positionType\` varchar(255) NULL COMMENT 'ชื่อประเภทตำแหน่ง', \`positionLevel\` varchar(255) NULL COMMENT 'ชื่อระดับตำแหน่ง', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP TABLE \`tenureLevelOfficer\``);
await queryRunner.query(`DROP TABLE \`tenureLevelEmployee\``);
await queryRunner.query(`DROP TABLE \`tenurePositionOfficer\``);
await queryRunner.query(`DROP TABLE \`tenurePositionEmployee\``);
}
}