hrms-api-org/src/entities/ProfileChangePosition.ts
Suphonchai Phoonsawat 4852131651 add dpis controller
2024-10-07 14:53:27 +07:00

291 lines
10 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { ChangePosition } from "./ChangePosition";
@Entity("profileChangePosition")
export class ProfileChangePosition extends EntityBase {
@Column({ nullable: true, comment: "เหตุผลที่รับโอนราชการ", type: "text", default: null })
reason: string;
@Column({ nullable: true, comment: "วุฒิ/สาขาเดิม", default: null })
educationOld: string;
@Column({ nullable: true, comment: "สังกัดเดิม ตำแหน่ง", default: null })
organizationPositionOld: string;
@Column({ nullable: true, comment: "สังกัดเดิม", default: null })
organizationOld: string;
@Column({ nullable: true, comment: "ตำแหน่งเดิม", default: null })
positionOld: string;
@Column({ nullable: true, comment: "ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท", default: null })
positionTypeOld: string;
@Column({ nullable: true, comment: "ข้อมูลหน่วยงานเดิม ระดับ", default: null })
positionLevelOld: string;
@Column({ nullable: true, comment: "ข้อมูลหน่วยงานเดิม เลขที่", default: null })
positionNumberOld: string;
@Column({
nullable: true,
comment: "ข้อมูลหน่วยงานเดิม เงินเดือน",
type: "double",
default: null,
})
amountOld: number;
@Column({
nullable: true,
type: "datetime",
comment: "ดำรงตำแหน่งในระดับปัจจุบันเมื่อ",
default: null,
})
dateCurrent: Date;
@Column({ nullable: true, comment: "profile Id", default: null })
profileId: string;
@Column({ nullable: true, comment: "คำนำหน้า", default: null })
prefix: string;
@Column({ nullable: true, comment: "ชื่อ", default: null })
firstName: string;
@Column({ nullable: true, comment: "นามสกุล", default: null })
lastName: string;
@Column({ nullable: true, comment: "เลขบัตรประชาชน", default: null })
citizenId: string;
@Column({ nullable: true, type: "datetime", comment: "วันเกิด", default: null })
birthDate: Date;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน root", default: null })
root: string;
@Column({ nullable: true, comment: "id หน่วยงาน root", default: null })
rootId: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน root", default: null })
rootShortName: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน child1", default: null })
child1: string;
@Column({ nullable: true, comment: "id หน่วยงาน child1", default: null })
child1Id: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child1", default: null })
child1ShortName: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน child2", default: null })
child2: string;
@Column({ nullable: true, comment: "id หน่วยงาน child2", default: null })
child2Id: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child2", default: null })
child2ShortName: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน child3", default: null })
child3: string;
@Column({ nullable: true, comment: "id หน่วยงาน child3", default: null })
child3Id: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child3", default: null })
child3ShortName: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน child4", default: null })
child4: string;
@Column({ nullable: true, comment: "id หน่วยงาน child4", default: null })
child4Id: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child4", default: null })
child4ShortName: string;
@Column({ nullable: true, comment: "ระดับโครงสร้าง", type: "int", default: null })
node: number;
@Column({ nullable: true, comment: "id โครงสร้าง", type: "uuid", default: null })
nodeId: string;
@Column({ nullable: true, comment: "id อัตรากำลัง", default: null })
posmasterId: string;
@Column({ nullable: true, comment: "id revision", default: null })
orgRevisionId: string;
@Column({ nullable: true, comment: "id ตำแหน่ง", default: null })
positionId: string;
@Column({ nullable: true, comment: "สายงาน", default: null })
positionField: string;
@Column({ nullable: true, comment: "เลขที่ตำแหน่ง", type: "int", default: null })
posMasterNo: number;
@Column({ nullable: true, comment: "ชื่อตำแหน่งในสายงาน", default: null })
position: string;
@Column({ nullable: true, comment: "id ประเภทตำแหน่ง", default: null })
posTypeId: string;
@Column({ nullable: true, comment: "ชื่อประเภทตำแหน่ง", default: null })
posTypeName: string;
@Column({ nullable: true, comment: "id ระดับตำแหน่ง", default: null })
posLevelId: string;
@Column({ nullable: true, comment: "ชื่อระดับตำแหน่ง", default: null })
posLevelName: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน root old", default: null })
rootOld: string;
@Column({ nullable: true, comment: "id หน่วยงาน root old", default: null })
rootOldId: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน root old", default: null })
rootShortNameOld: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน child1 old", default: null })
child1Old: string;
@Column({ nullable: true, comment: "id หน่วยงาน child1 old", default: null })
child1OldId: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child1 old", default: null })
child1ShortNameOld: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน child2 old", default: null })
child2Old: string;
@Column({ nullable: true, comment: "id หน่วยงาน child2 old", default: null })
child2OldId: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child2 old", default: null })
child2ShortNameOld: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน child3 old", default: null })
child3Old: string;
@Column({ nullable: true, comment: "id หน่วยงาน child3 old", default: null })
child3OldId: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child3 old", default: null })
child3ShortNameOld: string;
@Column({ nullable: true, comment: "ชื่อหน่วยงาน child4 old", default: null })
child4Old: string;
@Column({ nullable: true, comment: "id หน่วยงาน child4 old", default: null })
child4OldId: string;
@Column({ nullable: true, comment: "ชื่อย่อหน่วยงาน child4 old", default: null })
child4ShortNameOld: string;
@Column({ nullable: true, comment: "เลขที่ตำแหน่ง old", type: "int", default: null })
posMasterNoOld: number;
@Column({ nullable: true, comment: "id ประเภทตำแหน่ง old", default: null })
posTypeOldId: string;
@Column({ nullable: true, comment: "ชื่อประเภทตำแหน่ง old", default: null })
posTypeNameOld: string;
@Column({ nullable: true, comment: "id ระดับตำแหน่ง old", default: null })
posLevelOldId: string;
@Column({ nullable: true, comment: "ชื่อระดับตำแหน่ง old", default: null })
posLevelNameOld: string;
@Column({ nullable: true, comment: "สถานะ", type: "text", default: null })
status: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ChangePosition",
default: null,
})
changePositionId: string;
@ManyToOne(() => ChangePosition, (v) => v.profileChangePosition)
@JoinColumn({ name: "changePositionId" })
profile: ChangePosition;
}
//เพิ่มรายชื่อผู้ที่ย้ายสับเปลี่ยนตำแหน่ง
export class CreateProfileChangePosition {
changePositionId: string;
profiles: ProfileItem[];
}
export class ProfileItem {
profileId: string;
prefix: string;
firstName: string;
lastName: string;
citizenId: string;
birthDate: Date | null;
positionOld: string | null;
positionTypeOld: string | null;
positionLevelOld: string | null;
positionNumberOld: string | null;
organizationOld: string | null;
organizationPositionOld?: string | null;
amountOld: number | null;
educationOld: string | null;
rootOld: string | null;
rootOldId: string | null;
rootShortNameOld: string | null;
child1Old: string | null;
child1OldId: string | null;
child1ShortNameOld: string | null;
child2Old: string | null;
child2OldId: string | null;
child2ShortNameOld: string | null;
child3Old: string | null;
child3OldId: string | null;
child3ShortNameOld: string | null;
child4Old: string | null;
child4OldId: string | null;
child4ShortNameOld: string | null;
posMasterNoOld: number | null;
posTypeOldId: string | null;
posTypeNameOld: string | null;
posLevelOldId: string | null;
posLevelNameOld: string | null;
}
//แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย
export type UpdateProfileChangePosition = {
educationOld: string;
posMasterNoOld: number;
positionTypeOld: string;
positionLevelOld: string;
organizationPositionOld: string;
amountOld: number;
dateCurrent: Date;
reason: string | null;
};
//เลือกหน่วยงานที่รับย้าย
export type SelectProfileChangePosition = {
posmasterId: string;
node: number;
nodeId: string;
orgRevisionId: string;
positionId: string;
posMasterNo: number;
position: string;
positionField: string;
posTypeId: string | null;
posTypeName: string;
posLevelId: string | null;
posLevelName: string;
};