created Salary entity
This commit is contained in:
parent
a429021f6d
commit
570ca11c84
5 changed files with 353 additions and 0 deletions
67
src/entities/PosLevel.ts
Normal file
67
src/entities/PosLevel.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { PosType } from "./PosType";
|
||||
import { profile } from "console";
|
||||
import { Salarys } from "./Salarys";
|
||||
|
||||
enum PosLevelAuthority {
|
||||
HEAD = "HEAD",
|
||||
DEPUTY = "DEPUTY",
|
||||
GOVERNOR = "GOVERNOR",
|
||||
}
|
||||
@Entity("posLevel")
|
||||
export class PosLevel extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อระดับตำแหน่ง",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
posLevelName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับของระดับตำแหน่ง",
|
||||
default: null,
|
||||
})
|
||||
posLevelRank: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment:
|
||||
"ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ",
|
||||
type: "enum",
|
||||
enum: PosLevelAuthority,
|
||||
default: null,
|
||||
})
|
||||
posLevelAuthority: PosLevelAuthority;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "เป็นระดับของประเภทตำแหน่งใด",
|
||||
})
|
||||
posTypeId: string;
|
||||
|
||||
@OneToMany(() => Salarys, (salary) => salary.posLevel_)
|
||||
salarys_: Salarys[];
|
||||
|
||||
@ManyToOne(() => PosType, (posType) => posType.posLevels)
|
||||
@JoinColumn({ name: "posTypeId" })
|
||||
posType: PosType;
|
||||
}
|
||||
|
||||
export class CreatePosLevel {
|
||||
@Column()
|
||||
posLevelName: string;
|
||||
|
||||
@Column()
|
||||
posLevelRank: number;
|
||||
|
||||
@Column()
|
||||
posLevelAuthority: string;
|
||||
|
||||
@Column("uuid")
|
||||
posTypeId: string;
|
||||
}
|
||||
|
||||
export type UpdatePosLevel = Partial<CreatePosLevel> & { posLevelAuthority?: PosLevelAuthority };
|
||||
40
src/entities/PosType.ts
Normal file
40
src/entities/PosType.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { PosLevel } from "./PosLevel";
|
||||
import { Salarys } from "./Salarys";
|
||||
|
||||
@Entity("posType")
|
||||
export class PosType extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อประเภทตำแหน่ง (ทั่วไป วิชาการ อำนวยการ บริหาร)",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
posTypeName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment:
|
||||
"ระดับของประเภทตำแหน่ง ไว้ใช้ระบุว่าประเภทตำแหน่งนี้อยู่ระดับสูงหรือต่ำกว่ากัน โดย 1 = ต่ำกว่า , มากกว่า 1 = สูงกว่า ทั่วไป = 1 วิชาการ = 2 อำนวยการ = 3 บริหาร = 4",
|
||||
default: null,
|
||||
})
|
||||
posTypeRank: number;
|
||||
|
||||
@OneToMany(() => PosLevel, (posLevel) => posLevel.posType)
|
||||
posLevels: PosLevel[];
|
||||
|
||||
@OneToMany(() => Salarys, (salary) => salary.posType_)
|
||||
salarys_: Salarys[];
|
||||
|
||||
}
|
||||
|
||||
export class CreatePosType {
|
||||
@Column()
|
||||
posTypeName: string;
|
||||
|
||||
@Column()
|
||||
posTypeRank: number;
|
||||
}
|
||||
|
||||
export type UpdatePosType = Partial<CreatePosType>;
|
||||
114
src/entities/SalaryRanks.ts
Normal file
114
src/entities/SalaryRanks.ts
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Salarys } from "./Salarys";
|
||||
|
||||
@Entity("salaryRanks")
|
||||
export class SalaryRanks extends EntityBase {
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "Id ผังเงินเดือน",
|
||||
})
|
||||
salaryId: string;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
comment: "เงินเดือนฐาน",
|
||||
})
|
||||
salary: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "double",
|
||||
comment: "0.5 ขั้น",
|
||||
default: null,
|
||||
})
|
||||
salaryHalf: number | null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "double",
|
||||
comment: "0.5 ขั้น(เงินพิเศษ)",
|
||||
default: null,
|
||||
})
|
||||
salaryHalfSpecial: number | null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "double",
|
||||
comment: "1 ขั้น",
|
||||
default: null,
|
||||
})
|
||||
salaryFull: number | null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "double",
|
||||
comment: "1 ขั้น(เงินพิเศษ)",
|
||||
default: null,
|
||||
})
|
||||
salaryFullSpecial: number | null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "double",
|
||||
comment: "1.5 ขั้น",
|
||||
default: null,
|
||||
})
|
||||
salaryFullHalf: number | null;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "double",
|
||||
comment: "1.5 ขั้น(เงินพิเศษ)",
|
||||
default: null,
|
||||
})
|
||||
salaryFullHalfSpecial: number | null;
|
||||
|
||||
@Column({
|
||||
comment: "ทะลุขั้น",
|
||||
})
|
||||
isNext: boolean;
|
||||
|
||||
@Column({
|
||||
comment: "ลำดับ",
|
||||
})
|
||||
rank: number;
|
||||
|
||||
@ManyToOne(() => Salarys, (salarys) => salarys.salaryRanks_)
|
||||
@JoinColumn({ name: "salaryId" })
|
||||
salarys_: Salarys;
|
||||
}
|
||||
|
||||
export class CreateSalaryRank {
|
||||
@Column("uuid")
|
||||
salaryId: string;
|
||||
|
||||
@Column()
|
||||
salary: number;
|
||||
|
||||
@Column()
|
||||
salaryHalf?: number;
|
||||
|
||||
@Column()
|
||||
salaryHalfSpecial?: number;
|
||||
|
||||
@Column()
|
||||
salaryFull?: number;
|
||||
|
||||
@Column()
|
||||
salaryFullSpecial?: number;
|
||||
|
||||
@Column()
|
||||
salaryFullHalf?: number;
|
||||
|
||||
@Column()
|
||||
salaryFullHalfSpecial?: number;
|
||||
|
||||
@Column()
|
||||
isNext: boolean;
|
||||
|
||||
@Column()
|
||||
rank: number;
|
||||
}
|
||||
|
||||
export type UpdateSalaryRank = Partial<CreateSalaryRank>;
|
||||
104
src/entities/Salarys.ts
Normal file
104
src/entities/Salarys.ts
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { SalaryRanks } from "./SalaryRanks";
|
||||
import { PosType } from "./PosType";
|
||||
import { PosLevel } from "./PosLevel";
|
||||
|
||||
@Entity("salarys")
|
||||
export class Salarys extends EntityBase {
|
||||
@Column({
|
||||
comment: "ประเภทผัง",
|
||||
length: 255,
|
||||
})
|
||||
salaryType: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "Id ระดับของตำแหน่ง",
|
||||
})
|
||||
posTypeId: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "Id ประเภทของตำแหน่ง",
|
||||
})
|
||||
posLevelId: string;
|
||||
|
||||
@Column({
|
||||
comment: "สถานะการใช้งาน",
|
||||
})
|
||||
isActive: boolean;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "ให้ไว้ ณ วันที่",
|
||||
default: null,
|
||||
})
|
||||
date: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "วันที่มีผลบังคับใช้",
|
||||
default: null,
|
||||
})
|
||||
startDate: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "วันที่สิ้นสุดบังคับใช้",
|
||||
default: null,
|
||||
})
|
||||
endDate: Date;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "คำอธิบาย",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
details: string;
|
||||
|
||||
@OneToMany(() => SalaryRanks, (salaryRanks) => salaryRanks.salarys_)
|
||||
salaryRanks_: SalaryRanks[];
|
||||
|
||||
@ManyToOne(() => PosType, (posType) => posType.salarys_)
|
||||
@JoinColumn({ name: "posTypeId" })
|
||||
posType_: PosType;
|
||||
|
||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.salarys_)
|
||||
@JoinColumn({ name: "posLevelId" })
|
||||
posLevel_: PosLevel;
|
||||
}
|
||||
|
||||
export class CreateSalaryRank {
|
||||
|
||||
@Column()
|
||||
salaryType: string;
|
||||
|
||||
@Column("uuid")
|
||||
posTypeId: string;
|
||||
|
||||
@Column("uuid")
|
||||
posLevelId: string;
|
||||
|
||||
@Column()
|
||||
isActive: boolean;
|
||||
|
||||
@Column()
|
||||
date?: Date;
|
||||
|
||||
@Column()
|
||||
startDate?: Date;
|
||||
|
||||
@Column()
|
||||
endDate?: Date;
|
||||
|
||||
@Column()
|
||||
detail?: string;
|
||||
|
||||
}
|
||||
|
||||
export type UpdateSalaryRank = Partial<CreateSalaryRank> ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue