เพิ่มแก้ไขโครงสร้าง

This commit is contained in:
kittapath 2024-09-06 09:41:47 +07:00
parent bee2b69f61
commit 98ebf587a3
16 changed files with 565 additions and 410 deletions

View file

@ -1,14 +1,13 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, ManyToMany } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { CreateEmployeePosDict } from "./EmployeePosDict";
import { OrgRevision } from "./OrgRevision";
import { CreateEmployeePosition, EmployeePosition } from "./EmployeePosition";
import { EmployeePosition } from "./EmployeePosition";
import { OrgRoot } from "./OrgRoot";
import { OrgChild1 } from "./OrgChild1";
import { OrgChild2 } from "./OrgChild2";
import { OrgChild3 } from "./OrgChild3";
import { OrgChild4 } from "./OrgChild4";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { AuthRole } from "./AuthRole";

View file

@ -1,4 +1,4 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany, ManyToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgChild1 } from "./OrgChild1";
import { OrgRevision } from "./OrgRevision";
@ -6,6 +6,8 @@ import { OrgChild2 } from "./OrgChild2";
import { OrgChild3 } from "./OrgChild3";
import { OrgChild4 } from "./OrgChild4";
import { PosMaster } from "./PosMaster";
import { Profile } from "./Profile";
import { PermissionOrg } from "./PermissionOrg";
enum OrgRootRank {
DEPARTMENT = "DEPARTMENT",
@ -128,6 +130,9 @@ export class OrgRoot extends EntityBase {
@OneToMany(() => OrgChild4, (orgChild4) => orgChild4.orgChild1)
orgChild4s: OrgChild4[];
@OneToMany(() => PermissionOrg, (permissionOrg) => permissionOrg.orgRootTree)
permissionOrgRoots: PermissionOrg[];
}
export class CreateOrgRoot {

View file

@ -0,0 +1,27 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { OrgRoot } from "./OrgRoot";
import { Profile } from "./Profile";
@Entity("permissionOrg")
export class PermissionOrg extends EntityBase {
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง orgRoot",
})
orgRootId: string;
@Column({
length: 40,
comment: "คีย์นอก(FK)ของตาราง profile",
})
profileId: string;
@ManyToOne(() => OrgRoot, (orgRoot) => orgRoot.permissionOrgRoots)
@JoinColumn({ name: "orgRootId" })
orgRootTree: OrgRoot;
@ManyToOne(() => Profile, (profile) => profile.permissionProfiles)
@JoinColumn({ name: "profileId" })
profileTree: Profile;
}

View file

@ -1,4 +1,4 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, ManyToMany } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { CreatePosDict } from "./PosDict";
import { OrgRevision } from "./OrgRevision";

View file

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

View file

@ -1,4 +1,4 @@
import { Entity, Column, OneToMany, JoinColumn, ManyToOne } from "typeorm";
import { Entity, Column, OneToMany, JoinColumn, ManyToOne, ManyToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { PosMaster } from "./PosMaster";
import { PosLevel } from "./PosLevel";
@ -29,6 +29,8 @@ import { ProfileDiscipline } from "./ProfileDiscipline";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileEdit } from "./ProfileEdit";
import { ProfileDevelopment } from "./ProfileDevelopment";
import { OrgRoot } from "./OrgRoot";
import { PermissionOrg } from "./PermissionOrg";
@Entity("profile")
export class Profile extends EntityBase {
@ -493,6 +495,9 @@ export class Profile extends EntityBase {
default: null,
})
dutyTimeEffectiveDate: Date;
@OneToMany(() => PermissionOrg, (permissionOrg) => permissionOrg.profileTree)
permissionProfiles: PermissionOrg[];
}
@Entity("profileHistory")

View file

@ -3,7 +3,6 @@ import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileDevelopmentHistory } from "./ProfileDevelopmentHistory";
import { DevelopmentProject } from "./developmentProject";
@Entity("profileDevelopment")
export class ProfileDevelopment extends EntityBase {

View file

@ -1,7 +1,6 @@
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { ProfileDevelopment } from "./ProfileDevelopment";
import { DevelopmentProject } from "./developmentProject";
@Entity("profileDevelopmentHistory")
export class ProfileDevelopmentHistory extends EntityBase {

View file

@ -2,9 +2,7 @@ import {
Entity,
Column,
OneToMany,
OneToOne,
JoinColumn,
ManyToMany,
ManyToOne,
Double,
} from "typeorm";

View file

@ -1,15 +1,11 @@
import {
Entity,
Column,
OneToMany,
OneToOne,
JoinColumn,
ManyToMany,
ManyToOne,
Double,
} from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileSalary } from "./ProfileSalary";
@Entity("profileSalaryHistory")

View file

@ -1,7 +1,5 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { Entity, Column } from "typeorm";
import { EntityBase } from "./base/Base";
import { ProfileDevelopment } from "./ProfileDevelopment";
import { ProfileDevelopmentHistory } from "./ProfileDevelopmentHistory";
@Entity("developmentProject")
export class DevelopmentProject extends EntityBase {