add table employee
This commit is contained in:
parent
0f7edf5d15
commit
bb3e8b435b
4 changed files with 176 additions and 0 deletions
57
src/entities/EmployeePosDict.ts
Normal file
57
src/entities/EmployeePosDict.ts
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { EmployeePosType } from "./EmployeePosType";
|
||||
import { EmployeePosLevel } from "./EmployeePosLevel";
|
||||
|
||||
@Entity("employeePosDict")
|
||||
export class EmployeePosDict extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อตำแหน่ง",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
posDictName: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง employeePosType",
|
||||
})
|
||||
employeePosTypeId: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง employeePosLevel",
|
||||
})
|
||||
employeePosLevelId: string;
|
||||
|
||||
@ManyToOne(() => EmployeePosType, (employeePosType) => employeePosType)
|
||||
@JoinColumn({ name: "employeePosTypeId" })
|
||||
employeePosType: EmployeePosType;
|
||||
|
||||
@ManyToOne(() => EmployeePosLevel, (employeePosLevel) => employeePosLevel)
|
||||
@JoinColumn({ name: "employeePosLevelId" })
|
||||
employeePosLevel: EmployeePosLevel;
|
||||
}
|
||||
|
||||
export class CreateEmployeePosDict {
|
||||
@Column()
|
||||
posDictName: string | null;
|
||||
|
||||
@Column("uuid")
|
||||
employeePosTypeId: string | null;
|
||||
|
||||
@Column("uuid")
|
||||
employeePosLevelId: string | null;
|
||||
}
|
||||
|
||||
export class UpdateEmployeePosDict {
|
||||
@Column()
|
||||
posDictName: string;
|
||||
|
||||
@Column("uuid")
|
||||
employeePosTypeId: string;
|
||||
|
||||
@Column("uuid")
|
||||
employeePosLevelId: string;
|
||||
}
|
||||
46
src/entities/EmployeePosLevel.ts
Normal file
46
src/entities/EmployeePosLevel.ts
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { EmployeePosDict } from "./EmployeePosDict";
|
||||
import { EmployeePosType } from "./EmployeePosType";
|
||||
|
||||
@Entity("employeePosLevel")
|
||||
export class EmployeePosLevel extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อระดับชั้นงาน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
posLevelName: string;
|
||||
|
||||
@Column({
|
||||
comment: "ระดับของระดับชั้นงาน",
|
||||
type: "int",
|
||||
})
|
||||
posLevelRank: number;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง employeePosType",
|
||||
})
|
||||
employeePosTypeId: string;
|
||||
|
||||
@ManyToOne(() => EmployeePosType, (employeePosType) => employeePosType.employeePosLevels)
|
||||
@JoinColumn({ name: "employeePosTypeId" })
|
||||
employeePosType: EmployeePosType;
|
||||
|
||||
@OneToMany(() => EmployeePosDict, (employeePosDict) => employeePosDict.employeePosLevel)
|
||||
employeePosDicts: EmployeePosDict[];
|
||||
|
||||
}
|
||||
|
||||
export class CreateEmployeePosLevel {
|
||||
@Column()
|
||||
posLevelName: string;
|
||||
|
||||
@Column()
|
||||
posLevelRank: number;
|
||||
|
||||
}
|
||||
|
||||
export type UpdateEmployeePosLevel= Partial<CreateEmployeePosLevel>;
|
||||
49
src/entities/EmployeePosType.ts
Normal file
49
src/entities/EmployeePosType.ts
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import { Entity, Column, OneToMany } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { EmployeePosDict } from "./EmployeePosDict";
|
||||
import { EmployeePosLevel } from "./EmployeePosLevel";
|
||||
|
||||
@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, (employeePosLevel) => employeePosLevel.employeePosType)
|
||||
employeePosLevels: EmployeePosLevel[];
|
||||
|
||||
@OneToMany(() => EmployeePosDict, (employeePosDict) => employeePosDict.employeePosType)
|
||||
employeePosDicts: EmployeePosDict[];
|
||||
|
||||
}
|
||||
|
||||
export class CreateEmployeePosType {
|
||||
@Column()
|
||||
posTypeName: string;
|
||||
|
||||
@Column()
|
||||
posTypeRank: number;
|
||||
|
||||
@Column()
|
||||
posTypeShortName: string;
|
||||
|
||||
}
|
||||
|
||||
export type UpdateEmployeePosType = Partial<CreateEmployeePosType>;
|
||||
Loading…
Add table
Add a link
Reference in a new issue