This commit is contained in:
Kittapath 2024-04-19 09:44:46 +07:00
parent c4a975b503
commit a9dd103ff8
16 changed files with 1484 additions and 15 deletions

View file

@ -1,6 +1,7 @@
import { Entity, Column, OneToMany, ManyToOne } from "typeorm";
import { Entity, Column, OneToMany, ManyToOne, ManyToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiCapacityDetail } from "./kpiCapacityDetail";
import { KpiLink } from "./kpiLink";
enum CapacityType {
HEAD = "HEAD",
@ -40,6 +41,9 @@ export class KpiCapacity extends EntityBase {
@OneToMany(() => KpiCapacityDetail, (kpiCapacityDetail) => kpiCapacityDetail.kpiCapacitys)
KpiCapacityDetails: KpiCapacityDetail[];
@ManyToMany(() => KpiLink, (kpiLink) => kpiLink.kpiCapacitys)
kpiLinks: KpiLink[];
}
export class createKpiCapacity {
@Column()

View file

@ -1,5 +1,6 @@
import { Entity, Column } from "typeorm";
import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiLink } from "./kpiLink";
@Entity("kpiGroup")
export class KpiGroup extends EntityBase {
@ -9,8 +10,11 @@ export class KpiGroup extends EntityBase {
default: null,
})
nameGroupKPI: string;
@OneToMany(() => KpiLink, (kpiLink) => kpiLink.kpiGroup)
kpiLinks: KpiLink[];
}
export class creatKpiGroup {
export class createKpiGroup {
@Column()
nameGroupKPI: string;
}

25
src/entities/kpiLink.ts Normal file
View file

@ -0,0 +1,25 @@
import { Entity, Column, ManyToOne, JoinColumn, ManyToMany, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiGroup } from "./kpiGroup";
import { KpiCapacity } from "./kpiCapacity";
import { Position } from "./position";
@Entity("kpiLink")
export class KpiLink extends EntityBase {
@Column({
nullable: true,
length: 40,
comment: "ไอดีกลุ่มงาน",
})
kpiGroupId: string | null;
@ManyToOne(() => KpiGroup, (kpiGroup) => kpiGroup.kpiLinks)
@JoinColumn({ name: "kpiGroupId" })
kpiGroup: KpiGroup;
@ManyToMany(() => KpiCapacity, (kpiCapacity) => kpiCapacity.kpiLinks)
kpiCapacitys: KpiCapacity[];
@OneToMany(() => Position, (position) => position.kpiLink)
positions: Position[];
}

View file

@ -3,6 +3,12 @@ import { EntityBase } from "./base/Base";
@Entity("kpiPeriod")
export class KpiPeriod extends EntityBase {
@Column({
nullable: true,
comment: "ปีงบประมาณ",
})
year: number;
@Column({
nullable: true,
comment: "รอบการประเมิน",
@ -33,6 +39,8 @@ export class KpiPeriod extends EntityBase {
isActive: boolean;
}
export class createKpiPeriod {
@Column()
year: number;
@Column()
durationKPI: string;
@Column()
@ -44,6 +52,8 @@ export class createKpiPeriod {
}
export class updateKpiPeriod {
@Column()
year: number;
@Column()
durationKPI: string;
@Column()

371
src/entities/kpiPlan.ts Normal file
View file

@ -0,0 +1,371 @@
import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiLink } from "./kpiLink";
@Entity("kpiPlan")
export class KpiPlan extends EntityBase {
@Column({
nullable: true,
comment: "ปีงบประมาณ",
})
year: number;
@Column({
nullable: true,
comment: "รอบการประเมิน",
default: null,
})
round: string;
@Column({
nullable: true,
comment: "รหัสตัวชี้วัด",
default: null,
})
including: string;
@Column({
nullable: true,
comment: "ชื่อตัวชี้วัด",
default: null,
})
includingName: string;
@Column({
nullable: true,
comment: "ค่าเป้าหมาย",
default: null,
})
target: string;
@Column({
nullable: true,
comment: "หน่วยนับ",
default: null,
})
unit: number;
@Column({
nullable: true,
comment: "น้ำหนัก",
default: null,
})
weight: number;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 1",
default: null,
})
achievement1: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 2",
default: null,
})
achievement2: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 3",
default: null,
})
achievement3: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 4",
default: null,
})
achievement4: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 5",
default: null,
})
achievement5: string;
@Column({
nullable: true,
comment: "นิยามหรือความหมาย",
default: null,
})
meaning: string;
@Column({
nullable: true,
comment: "สูตรคำนวณ",
default: null,
})
formula: string;
@Column({
nullable: true,
comment: "id หน่วยงาน",
default: null,
})
rootId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน",
default: null,
})
root: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน",
default: null,
})
rootShortName: string;
@Column({
nullable: true,
comment: "id หน่วยงาน child1",
default: null,
})
child1Id: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child1",
default: null,
})
child1: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน child1",
default: null,
})
child1ShortName: string;
@Column({
nullable: true,
comment: "id หน่วยงาน child2",
default: null,
})
child2Id: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child2",
default: null,
})
child2: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน child2",
default: null,
})
child2ShortName: string;
@Column({
nullable: true,
comment: "id หน่วยงาน child3",
default: null,
})
child3Id: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child3",
default: null,
})
child3: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน child3",
default: null,
})
child3ShortName: string;
@Column({
nullable: true,
comment: "id หน่วยงาน child4",
default: null,
})
child4Id: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child4",
default: null,
})
child4: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน child4",
default: null,
})
child4ShortName: string;
@Column({
nullable: true,
comment: "id revision",
default: null,
})
orgRevisionId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง strategyChild1",
default: null,
})
strategyChild1Id: string;
@Column({
nullable: true,
comment: "ชื่อ strategyChild1",
default: null,
})
strategyChild1: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง strategyChild2",
default: null,
})
strategyChild2Id: string;
@Column({
nullable: true,
comment: "ชื่อ strategyChild2",
default: null,
})
strategyChild2: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง strategyChild3",
default: null,
})
strategyChild3Id: string;
@Column({
nullable: true,
comment: "ชื่อ strategyChild3",
default: null,
})
strategyChild3: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง strategyChild4",
default: null,
})
strategyChild4Id: string;
@Column({
nullable: true,
comment: "ชื่อ strategyChild4",
default: null,
})
strategyChild4: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง strategyChild5",
default: null,
})
strategyChild5Id: string;
@Column({
nullable: true,
comment: "ชื่อ strategyChild5",
default: null,
})
strategyChild5: string;
}
export class createKpiPlan {
@Column()
year: number | null;
@Column()
round: string;
@Column()
including: string | null;
@Column()
includingName: string | null;
@Column()
target: string | null;
@Column()
unit: number | null;
@Column()
weight: number | null;
@Column()
achievement1: string | null;
@Column()
achievement2: string | null;
@Column()
achievement3: string | null;
@Column()
achievement4: string | null;
@Column()
achievement5: string | null;
@Column()
meaning: string | null;
@Column()
formula: string | null;
@Column()
node: number;
@Column()
nodeId: string | null;
@Column()
orgRevisionId: string;
@Column()
strategy: number;
@Column()
strategyId: string | null;
}
export class updateKpiPlan {
@Column()
year: number | null;
@Column()
round: string;
@Column()
including: string | null;
@Column()
includingName: string | null;
@Column()
target: string | null;
@Column()
unit: number | null;
@Column()
weight: number | null;
@Column()
achievement1: string | null;
@Column()
achievement2: string | null;
@Column()
achievement3: string | null;
@Column()
achievement4: string | null;
@Column()
achievement5: string | null;
@Column()
meaning: string | null;
@Column()
formula: string | null;
@Column()
node: number;
@Column()
nodeId: string | null;
@Column()
orgRevisionId: string;
@Column()
strategy: number;
@Column()
strategyId: string | null;
}

299
src/entities/kpiRole.ts Normal file
View file

@ -0,0 +1,299 @@
import { Entity, Column, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiLink } from "./kpiLink";
@Entity("kpiRole")
export class KpiRole extends EntityBase {
@Column({
nullable: true,
comment: "ตำแหน่ง",
default: null,
})
position: string;
@Column({
nullable: true,
comment: "ปีงบประมาณ",
})
year: number;
@Column({
nullable: true,
comment: "รอบการประเมิน",
default: null,
})
round: string;
@Column({
nullable: true,
comment: "รหัสตัวชี้วัด",
default: null,
})
including: string;
@Column({
nullable: true,
comment: "ชื่อตัวชี้วัด",
default: null,
})
includingName: string;
@Column({
nullable: true,
comment: "ค่าเป้าหมาย",
default: null,
})
target: string;
@Column({
nullable: true,
comment: "หน่วยนับ",
default: null,
})
unit: number;
@Column({
nullable: true,
comment: "น้ำหนัก",
default: null,
})
weight: number;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 1",
default: null,
})
achievement1: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 2",
default: null,
})
achievement2: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 3",
default: null,
})
achievement3: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 4",
default: null,
})
achievement4: string;
@Column({
nullable: true,
comment: "ผลสำเร็จของงาน 5",
default: null,
})
achievement5: string;
@Column({
nullable: true,
comment: "id หน่วยงาน",
default: null,
})
rootId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน",
default: null,
})
root: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน",
default: null,
})
rootShortName: string;
@Column({
nullable: true,
comment: "id หน่วยงาน child1",
default: null,
})
child1Id: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child1",
default: null,
})
child1: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน child1",
default: null,
})
child1ShortName: string;
@Column({
nullable: true,
comment: "id หน่วยงาน child2",
default: null,
})
child2Id: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child2",
default: null,
})
child2: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน child2",
default: null,
})
child2ShortName: string;
@Column({
nullable: true,
comment: "id หน่วยงาน child3",
default: null,
})
child3Id: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child3",
default: null,
})
child3: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน child3",
default: null,
})
child3ShortName: string;
@Column({
nullable: true,
comment: "id หน่วยงาน child4",
default: null,
})
child4Id: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child4",
default: null,
})
child4: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน child4",
default: null,
})
child4ShortName: string;
@Column({
nullable: true,
comment: "id revision",
default: null,
})
orgRevisionId: string;
@Column({
nullable: true,
comment: "นิยามหรือความหมาย",
default: null,
})
meaning: string;
@Column({
nullable: true,
comment: "สูตรคำนวณ",
default: null,
})
formula: string;
}
export class createKpiRole {
@Column()
position: string | null;
@Column()
year: number | null;
@Column()
round: string;
@Column()
including: string | null;
@Column()
includingName: string | null;
@Column()
target: string | null;
@Column()
unit: number | null;
@Column()
weight: number | null;
@Column()
achievement1: string | null;
@Column()
achievement2: string | null;
@Column()
achievement3: string | null;
@Column()
achievement4: string | null;
@Column()
achievement5: string | null;
@Column()
node: number;
@Column()
nodeId: string | null;
@Column()
orgRevisionId: string;
@Column()
meaning: string | null;
@Column()
formula: string | null;
}
export class updateKpiRole {
@Column()
position: string | null;
@Column()
year: number | null;
@Column()
round: string;
@Column()
including: string | null;
@Column()
includingName: string | null;
@Column()
target: string | null;
@Column()
unit: number | null;
@Column()
weight: number | null;
@Column()
achievement1: string | null;
@Column()
achievement2: string | null;
@Column()
achievement3: string | null;
@Column()
achievement4: string | null;
@Column()
achievement5: string | null;
@Column()
node: number;
@Column()
nodeId: string | null;
@Column()
orgRevisionId: string;
@Column()
meaning: string | null;
@Column()
formula: string | null;
}

24
src/entities/position.ts Normal file
View file

@ -0,0 +1,24 @@
import { Entity, Column, OneToMany, ManyToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { KpiLink } from "./kpiLink";
@Entity("position")
export class Position extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อตำแหน่ง",
default: null,
})
name: string;
@Column({
nullable: true,
length: 40,
comment: "ไอดีเชื่อมโยง",
})
kpiLinkId: string | null;
@ManyToOne(() => KpiLink, (kpiLink) => kpiLink.positions)
@JoinColumn({ name: "kpiLinkId" })
kpiLink: KpiLink;
}