เกนเงินเดือนลูกจ้าง

This commit is contained in:
Kittapath 2024-03-14 16:20:47 +07:00
parent 8577745a54
commit ff39403172
10 changed files with 570 additions and 26 deletions

View file

@ -0,0 +1,47 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { EmployeePosType } from "./EmployeePosType";
import { SalaryFormulaEmployee } from "./SalaryFormulaEmployee";
enum EmployeePosLevelAuthoritys {
HEAD = "HEAD",
DEPUTY = "DEPUTY",
GOVERNOR = "GOVERNOR",
}
@Entity("employeePosLevel")
export class EmployeePosLevel extends EntityBase {
@Column({
comment: "ชื่อระดับชั้นงาน",
type: "int",
})
posLevelName: number;
@Column({
comment: "ระดับของระดับชั้นงาน",
type: "int",
})
posLevelRank: number;
@Column({
nullable: true,
comment:
"ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ",
type: "enum",
enum: EmployeePosLevelAuthoritys,
default: null,
})
posLevelAuthority: EmployeePosLevelAuthoritys;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง employeePosType",
})
posTypeId: string;
@ManyToOne(() => EmployeePosType, (posType) => posType.posLevels)
@JoinColumn({ name: "posTypeId" })
posType: EmployeePosType;
@OneToMany(() => SalaryFormulaEmployee, (salaryFormulaEmployee) => salaryFormulaEmployee.posLevel)
salaryPosLevels: SalaryFormulaEmployee[];
}

View file

@ -0,0 +1,34 @@
import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { EmployeePosLevel } from "./EmployeePosLevel";
import { SalaryFormulaEmployee } from "./SalaryFormulaEmployee";
@Entity("employeePosType")
export class EmployeePosType extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อกลุ่มงาน",
length: 255,
default: null,
})
posTypeName: string;
@Column({
comment: "ระดับของกลุ่มงาน",
})
posTypeRank: number;
@Column({
nullable: true,
comment: "ชื่อย่อกลุ่มงาน",
length: 255,
default: null,
})
posTypeShortName: string;
@OneToMany(() => EmployeePosLevel, (posLevel) => posLevel.posType)
posLevels: EmployeePosLevel[];
@OneToMany(() => SalaryFormulaEmployee, (salaryFormulaEmployee) => salaryFormulaEmployee.posType)
salaryPosTypes: SalaryFormulaEmployee[];
}

View file

@ -1,9 +1,10 @@
import { Entity, Column, OneToMany } from "typeorm";
import { Entity, Column, OneToMany, ManyToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { SalaryRankEmployees } from "./SalaryRankEmployees";
import { SalaryRankEmployee } from "./SalaryRankEmployee";
import { SalaryFormulaEmployee } from "./SalaryFormulaEmployee";
@Entity("salaryEmployees")
export class SalaryEmployees extends EntityBase {
@Entity("salaryEmployee")
export class SalaryEmployee extends EntityBase {
@Column({
comment: "ชื่อผัง",
length: 255,
@ -54,11 +55,20 @@ export class SalaryEmployees extends EntityBase {
})
details: string;
@OneToMany(() => SalaryRankEmployee, (salaryRankEmployee) => salaryRankEmployee.salaryEmployee_)
salaryRankEmployees_: SalaryRankEmployee[];
@OneToMany(
() => SalaryRankEmployees,
(salaryRankEmployees) => salaryRankEmployees.salaryEmployees_,
() => SalaryFormulaEmployee,
(salaryFormulaEmployee) => salaryFormulaEmployee.salaryEmployee,
)
salaryRankEmployees_: SalaryRankEmployees[];
salaryFormulaEmployees: SalaryFormulaEmployee[];
@ManyToMany(
() => SalaryFormulaEmployee,
(salaryFormulaEmployee) => salaryFormulaEmployee.salaryEmployeeMins,
)
salaryFormulaEmployeeMins: SalaryFormulaEmployee[];
}
export class CreateSalaryEmployee {

View file

@ -0,0 +1,140 @@
import { Entity, Column, ManyToOne, JoinColumn, ManyToMany, JoinTable } from "typeorm";
import { EntityBase } from "./base/Base";
import { SalaryEmployee } from "./SalaryEmployee";
import { EmployeePosType } from "./EmployeePosType";
import { EmployeePosLevel } from "./EmployeePosLevel";
@Entity("salaryFormulaEmployee")
export class SalaryFormulaEmployee extends EntityBase {
@Column({
nullable: true,
comment: "ตำแหน่ง",
length: 255,
default: null,
})
position: string;
@Column({
nullable: true,
type: "double",
comment: "ขั้นต่ำสุด",
default: null,
})
salaryMin?: number | null;
@Column({
nullable: true,
type: "double",
comment: "ขั้นสูงสุดเดิม",
default: null,
})
salary?: number | null;
@Column({
nullable: true,
type: "double",
comment: "อัตราค่าจ้างขั้นสูงใหม่",
default: null,
})
salaryMax?: number | null;
@Column({
nullable: true,
comment: "หมายเหตุ",
length: 255,
default: null,
})
details?: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง salaryEmployee",
})
salaryEmployeeId: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง employeePosType",
})
posTypeId: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง employeePosLevel",
})
posLevelId: string;
@ManyToOne(() => SalaryEmployee, (salaryEmployee) => salaryEmployee.salaryFormulaEmployees)
@JoinColumn({ name: "salaryEmployeeId" })
salaryEmployee: SalaryEmployee;
@ManyToOne(() => EmployeePosType, (posType) => posType.salaryPosTypes)
@JoinColumn({ name: "posTypeId" })
posType: EmployeePosType;
@ManyToOne(() => EmployeePosLevel, (posLevel) => posLevel.salaryPosLevels)
@JoinColumn({ name: "posLevelId" })
posLevel: EmployeePosLevel;
@ManyToMany(() => SalaryEmployee, (salaryEmployee) => salaryEmployee.salaryFormulaEmployeeMins)
@JoinTable()
salaryEmployeeMins: SalaryEmployee[];
}
export class CreateSalaryFormulaEmployee {
@Column()
position: string;
@Column()
salaryMin?: number | null;
@Column()
salary?: number | null;
@Column()
salaryMax?: number | null;
@Column()
details?: string;
@Column()
salaryEmployeeId: string;
@Column()
posTypeId: string;
@Column()
posLevelId: string;
@Column()
salaryEmployeeMinIds: string[];
}
export class UpdateSalaryFormulaEmployee {
@Column()
position: string;
@Column()
salaryMin?: number | null;
@Column()
salary?: number | null;
@Column()
salaryMax?: number | null;
@Column()
details?: string;
@Column()
salaryEmployeeId: string;
@Column()
posTypeId: string;
@Column()
posLevelId: string;
@Column()
salaryEmployeeMinIds: string[];
}

View file

@ -1,9 +1,9 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { SalaryEmployees } from "./SalaryEmployees";
import { SalaryEmployee } from "./SalaryEmployee";
@Entity("salaryRankEmployees")
export class SalaryRankEmployees extends EntityBase {
@Entity("salaryRankEmployee")
export class SalaryRankEmployee extends EntityBase {
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง salaryEmployee",
@ -32,9 +32,9 @@ export class SalaryRankEmployees extends EntityBase {
})
salaryDay: number | null;
@ManyToOne(() => SalaryEmployees, (salaryEmployees) => salaryEmployees.salaryRankEmployees_)
@ManyToOne(() => SalaryEmployee, (salaryEmployee) => salaryEmployee.salaryRankEmployees_)
@JoinColumn({ name: "salaryEmployeeId" })
salaryEmployees_: SalaryEmployees;
salaryEmployee_: SalaryEmployee;
}
export class CreateSalaryRankEmployee {