import { Entity, Column, ManyToOne, JoinColumn, OneToOne, 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, comment: "ชื่อส่วนราชการ", length: 255, default: "string", }) orgChild3Name: string; @Column({ nullable: true, comment: "ชื่อย่อส่วนราชการ", length: 16, default: "string", }) orgChild3ShortName: string; @Column({ nullable: true, comment: "รหัสส่วนราชการ", length: 8, default: "string", }) orgChild3Code: string; @Column({ nullable: true, comment: "ระดับส่วนราชการ", type: "enum", enum: OrgChild3Rank, // default: OrgChild3Rank.DEPARTMENT, }) orgChild3Rank: OrgChild3Rank; @Column({ nullable: true, comment: "ลำดับที่ของส่วนราชการภายใน Child เดียวกัน", }) orgChild3Order: number; @Column({ nullable: true, length: 64, comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายนอก", }) orgChild3PhoneEx: string; @Column({ nullable: true, length: 64, comment: "หมายเลขโทรศัพท์ที่ติดต่อจากภายใน", }) orgChild3PhoneIn: string; @Column({ nullable: true, length: 64, comment: "หมายเลขโทรสาร", }) orgChild3Fax: string; @Column({ nullable: true, type: "tinyint", comment: "สถานะของหน่วยงาน", //ปกติ = 1 , ยุกเลิก = 0 }) orgChild3IsNormal: number; @Column({ length: 40, default: "00000000-0000-0000-0000-000000000000", }) fkOrgRootId: string; @Column({ length: 40, default: "00000000-0000-0000-0000-000000000000", }) fkOrgChild1Id: string; @Column({ length: 40, default: "00000000-0000-0000-0000-000000000000", }) fkOrgChild2Id: string; // @ManyToOne(() => OrgRoot, orgRoot => orgRoot.orgChild3s) // @JoinColumn({ name: "fkOrgRootId" }) // orgRoot: OrgRoot; // @ManyToOne(() => OrgChild1, orgChild1 => orgChild1.orgChild3s) // @JoinColumn({ name: "fkOrgChild1Id" }) // orgChild1: OrgChild1; @ManyToOne(() => OrgChild2, orgChild2 => orgChild2.orgChild3s) @JoinColumn({ name: "fkOrgChild2Id" }) orgChild2: OrgChild2; //child table 4 @OneToMany(() => OrgChild4, orgChild4 => orgChild4.orgChild3) orgChild4s: OrgChild4[]; } export type UpdateOrgChild3 = Partial;