diff --git a/src/controllers/KpiUserEvaluationController.ts b/src/controllers/KpiUserEvaluationController.ts index 45bff04..521e3eb 100644 --- a/src/controllers/KpiUserEvaluationController.ts +++ b/src/controllers/KpiUserEvaluationController.ts @@ -300,6 +300,15 @@ export class KpiUserEvaluationController extends Controller { kpiUserEvaluation.posTypeName = x.posTypeName; kpiUserEvaluation.posExecutiveName = x.posExecutiveName; kpiUserEvaluation.org = x.root; + kpiUserEvaluation.orgId = x.rootId; + kpiUserEvaluation.child1 = x.child1; + kpiUserEvaluation.child1Id = x.child1Id; + kpiUserEvaluation.child2 = x.child2; + kpiUserEvaluation.child2Id = x.child2Id; + kpiUserEvaluation.child3 = x.child3; + kpiUserEvaluation.child3Id = x.child3Id; + kpiUserEvaluation.child4 = x.child4; + kpiUserEvaluation.child4Id = x.child4Id; }) .catch((x) => { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ"); @@ -317,6 +326,15 @@ export class KpiUserEvaluationController extends Controller { kpiUserEvaluation.posTypeName = x.posTypeName; kpiUserEvaluation.posExecutiveName = x.posExecutiveName; kpiUserEvaluation.org = x.root; + kpiUserEvaluation.orgId = x.rootId; + kpiUserEvaluation.child1 = x.child1; + kpiUserEvaluation.child1Id = x.child1Id; + kpiUserEvaluation.child2 = x.child2; + kpiUserEvaluation.child2Id = x.child2Id; + kpiUserEvaluation.child3 = x.child3; + kpiUserEvaluation.child3Id = x.child3Id; + kpiUserEvaluation.child4 = x.child4; + kpiUserEvaluation.child4Id = x.child4Id; }) .catch((x) => { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ"); diff --git a/src/entities/kpiUserEvaluation.ts b/src/entities/kpiUserEvaluation.ts index 9168238..2409b8e 100644 --- a/src/entities/kpiUserEvaluation.ts +++ b/src/entities/kpiUserEvaluation.ts @@ -72,6 +72,78 @@ export class KpiUserEvaluation extends EntityBase { }) org: string; + @Column({ + nullable: true, + comment: "สังกัด", + length: 255, + default: null, + }) + orgId: string; + + @Column({ + nullable: true, + comment: "child1", + length: 255, + default: null, + }) + child1: string; + + @Column({ + nullable: true, + comment: "child1", + length: 255, + default: null, + }) + child1Id: string; + + @Column({ + nullable: true, + comment: "child2", + length: 255, + default: null, + }) + child2: string; + + @Column({ + nullable: true, + comment: "child2", + length: 255, + default: null, + }) + child2Id: string; + + @Column({ + nullable: true, + comment: "child3", + length: 255, + default: null, + }) + child3: string; + + @Column({ + nullable: true, + comment: "child3", + length: 255, + default: null, + }) + child3Id: string; + + @Column({ + nullable: true, + comment: "child4", + length: 255, + default: null, + }) + child4: string; + + @Column({ + nullable: true, + comment: "child4", + length: 255, + default: null, + }) + child4Id: string; + @Column({ nullable: true, comment: "คำนำหน้าผู้ประเมิน", diff --git a/src/migration/1720492941912-add_table_kpi_add_root.ts b/src/migration/1720492941912-add_table_kpi_add_root.ts new file mode 100644 index 0000000..9f26df4 --- /dev/null +++ b/src/migration/1720492941912-add_table_kpi_add_root.ts @@ -0,0 +1,30 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class AddTableKpiAddRoot1720492941912 implements MigrationInterface { + name = 'AddTableKpiAddRoot1720492941912' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`orgId\` varchar(255) NULL COMMENT 'สังกัด'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child1\` varchar(255) NULL COMMENT 'child1'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child1Id\` varchar(255) NULL COMMENT 'child1'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child2\` varchar(255) NULL COMMENT 'child2'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child2Id\` varchar(255) NULL COMMENT 'child2'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child3\` varchar(255) NULL COMMENT 'child3'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child3Id\` varchar(255) NULL COMMENT 'child3'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child4\` varchar(255) NULL COMMENT 'child4'`); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child4Id\` varchar(255) NULL COMMENT 'child4'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child4Id\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child4\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child3Id\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child3\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child2Id\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child2\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child1Id\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child1\``); + await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`orgId\``); + } + +}