org_010 - 012

This commit is contained in:
Bright 2024-01-25 15:54:03 +07:00
parent 55119a72f5
commit 6d136f8a97
4 changed files with 195 additions and 28 deletions

View file

@ -1,4 +1,4 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot";
import { OrgChild2 } from "./OrgChild2";

View file

@ -1,24 +1,17 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot";
import { OrgChild1 } from "./OrgChild1";
import { OrgChild2 } from "./OrgChild2";
import { OrgChild4 } from "./OrgChild4";
// ENUM orgChild3Rank
enum OrgChild3Rank {
DEPARTMENT = "department",
OFFICE = "office",
DIVISION = "division",
SECTION = "section",
}
@Entity("orgChild3")
export class OrgChild3 extends EntityBase {
// @Column({
// comment: "",
// length: 40,
// default: "00000000-0000-0000-0000-000000000000",
// })
// orgChild3Id: string;
@Column({
nullable: true,
@ -49,7 +42,6 @@ export class OrgChild3 extends EntityBase {
comment: "ระดับส่วนราชการ",
type: "enum",
enum: OrgChild3Rank,
// default: OrgChild3Rank.DEPARTMENT,
})
orgChild3Rank: OrgChild3Rank;
@ -82,7 +74,7 @@ export class OrgChild3 extends EntityBase {
@Column({
nullable: true,
comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0
comment: "สถานะของหน่วยงาน",
default: true
})
orgChild3IsNormal: boolean;
@ -105,21 +97,47 @@ export class OrgChild3 extends EntityBase {
})
orgChild2Id: string;
// @ManyToOne(() => OrgRoot, orgRoot => orgRoot.orgChild3s)
// @JoinColumn({ name: "orgRootId" })
// orgRoot: OrgRoot;
// @ManyToOne(() => OrgChild1, orgChild1 => orgChild1.orgChild3s)
// @JoinColumn({ name: "orgChild1Id" })
// orgChild1: OrgChild1;
@ManyToOne(() => OrgChild2, orgChild2 => orgChild2.orgChild3s)
@JoinColumn({ name: "orgChild2Id" })
orgChild2: OrgChild2;
//child table 4
@OneToMany(() => OrgChild4, orgChild4 => orgChild4.orgChild3)
orgChild4s: OrgChild4[];
}
export type UpdateOrgChild3 = Partial<OrgChild3>;
export class CreateOrgChild3 {
@Column()
orgChild3Name: string;
@Column()
orgChild3ShortName: string;
@Column()
orgChild3Code: string;
@Column()
orgChild3Rank: string;
@Column()
orgChild3Order: number;
@Column()
orgChild3PhoneEx: string;
@Column()
orgChild3PhoneIn: string;
@Column()
orgChild3Fax: string;
@Column()
orgChild3IsNormal: boolean;
@Column('uuid')
orgChild2Id: string;
}
export type UpdateOrgChild3 = Partial<CreateOrgChild3> & { orgChild3Rank?: OrgChild3Rank };;