This commit is contained in:
kittapath 2025-01-31 18:04:19 +07:00
parent 609d17b5f4
commit 3db9258e1b
6 changed files with 176 additions and 1 deletions

View file

@ -79,18 +79,23 @@ export class kpiPlanController extends Controller {
.then((x) => {
kpiPlan.root = x.root;
kpiPlan.rootId = x.rootId;
kpiPlan.rootDnaId = x.rootDnaId;
kpiPlan.rootShortName = x.rootShortName;
kpiPlan.child1 = requestBody.node <= 0 ? null : x.child1;
kpiPlan.child1Id = requestBody.node <= 0 ? null : x.child1Id;
kpiPlan.child1DnaId = requestBody.node <= 0 ? null : x.child1DnaId;
kpiPlan.child1ShortName = requestBody.node <= 0 ? null : x.child1ShortName;
kpiPlan.child2 = requestBody.node <= 1 ? null : x.child2;
kpiPlan.child2Id = requestBody.node <= 1 ? null : x.child2Id;
kpiPlan.child2DnaId = requestBody.node <= 1 ? null : x.child2DnaId;
kpiPlan.child2ShortName = requestBody.node <= 1 ? null : x.child2ShortName;
kpiPlan.child3 = requestBody.node <= 2 ? null : x.child3;
kpiPlan.child3Id = requestBody.node <= 2 ? null : x.child3Id;
kpiPlan.child3DnaId = requestBody.node <= 2 ? null : x.child3DnaId;
kpiPlan.child3ShortName = requestBody.node <= 2 ? null : x.child3ShortName;
kpiPlan.child4 = requestBody.node <= 3 ? null : x.child4;
kpiPlan.child4Id = requestBody.node <= 3 ? null : x.child4Id;
kpiPlan.child4DnaId = requestBody.node <= 3 ? null : x.child4DnaId;
kpiPlan.child4ShortName = requestBody.node <= 3 ? null : x.child4ShortName;
})
.catch((x) => {});
@ -250,18 +255,23 @@ export class kpiPlanController extends Controller {
.then((x) => {
kpiPlan.root = x.root;
kpiPlan.rootId = x.rootId;
kpiPlan.rootDnaId = x.rootDnaId;
kpiPlan.rootShortName = x.rootShortName;
kpiPlan.child1 = requestBody.node <= 0 ? null : x.child1;
kpiPlan.child1Id = requestBody.node <= 0 ? null : x.child1Id;
kpiPlan.child1DnaId = requestBody.node <= 0 ? null : x.child1DnaId;
kpiPlan.child1ShortName = requestBody.node <= 0 ? null : x.child1ShortName;
kpiPlan.child2 = requestBody.node <= 1 ? null : x.child2;
kpiPlan.child2Id = requestBody.node <= 1 ? null : x.child2Id;
kpiPlan.child2DnaId = requestBody.node <= 1 ? null : x.child2DnaId;
kpiPlan.child2ShortName = requestBody.node <= 1 ? null : x.child2ShortName;
kpiPlan.child3 = requestBody.node <= 2 ? null : x.child3;
kpiPlan.child3Id = requestBody.node <= 2 ? null : x.child3Id;
kpiPlan.child3DnaId = requestBody.node <= 2 ? null : x.child3DnaId;
kpiPlan.child3ShortName = requestBody.node <= 2 ? null : x.child3ShortName;
kpiPlan.child4 = requestBody.node <= 3 ? null : x.child4;
kpiPlan.child4Id = requestBody.node <= 3 ? null : x.child4Id;
kpiPlan.child4DnaId = requestBody.node <= 3 ? null : x.child4DnaId;
kpiPlan.child4ShortName = requestBody.node <= 3 ? null : x.child4ShortName;
})
.catch((x) => {});

View file

@ -53,7 +53,10 @@ export class kpiRoleController extends Controller {
.where("kpiPeriod.year = :year", { year: requestBody.year })
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
.getOne();
const year = requestBody.year && parseInt(requestBody.year) > 0?parseInt(requestBody.year) + 543:"ดังกล่าว";
const year =
requestBody.year && parseInt(requestBody.year) > 0
? parseInt(requestBody.year) + 543
: "ดังกล่าว";
if (!kpiPeriod) {
throw new HttpError(
HttpStatusCode.NOT_FOUND,
@ -69,18 +72,23 @@ export class kpiRoleController extends Controller {
.then((x) => {
kpiRole.root = x.root;
kpiRole.rootId = x.rootId;
kpiRole.rootDnaId = x.rootDnaId;
kpiRole.rootShortName = x.rootShortName;
kpiRole.child1 = requestBody.node <= 0 ? null : x.child1;
kpiRole.child1Id = requestBody.node <= 0 ? null : x.child1Id;
kpiRole.child1DnaId = requestBody.node <= 0 ? null : x.child1DnaId;
kpiRole.child1ShortName = requestBody.node <= 0 ? null : x.child1ShortName;
kpiRole.child2 = requestBody.node <= 1 ? null : x.child2;
kpiRole.child2Id = requestBody.node <= 1 ? null : x.child2Id;
kpiRole.child2DnaId = requestBody.node <= 1 ? null : x.child2DnaId;
kpiRole.child2ShortName = requestBody.node <= 1 ? null : x.child2ShortName;
kpiRole.child3 = requestBody.node <= 2 ? null : x.child3;
kpiRole.child3Id = requestBody.node <= 2 ? null : x.child3Id;
kpiRole.child3DnaId = requestBody.node <= 2 ? null : x.child3DnaId;
kpiRole.child3ShortName = requestBody.node <= 2 ? null : x.child3ShortName;
kpiRole.child4 = requestBody.node <= 3 ? null : x.child4;
kpiRole.child4Id = requestBody.node <= 3 ? null : x.child4Id;
kpiRole.child4DnaId = requestBody.node <= 3 ? null : x.child4DnaId;
kpiRole.child4ShortName = requestBody.node <= 3 ? null : x.child4ShortName;
})
.catch((x) => {});
@ -238,18 +246,23 @@ export class kpiRoleController extends Controller {
.then((x) => {
kpiRole.root = x.root;
kpiRole.rootId = x.rootId;
kpiRole.rootDnaId = x.rootDnaId;
kpiRole.rootShortName = x.rootShortName;
kpiRole.child1 = requestBody.node <= 0 ? null : x.child1;
kpiRole.child1Id = requestBody.node <= 0 ? null : x.child1Id;
kpiRole.child1DnaId = requestBody.node <= 0 ? null : x.child1DnaId;
kpiRole.child1ShortName = requestBody.node <= 0 ? null : x.child1ShortName;
kpiRole.child2 = requestBody.node <= 1 ? null : x.child2;
kpiRole.child2Id = requestBody.node <= 1 ? null : x.child2Id;
kpiRole.child2DnaId = requestBody.node <= 1 ? null : x.child2DnaId;
kpiRole.child2ShortName = requestBody.node <= 1 ? null : x.child2ShortName;
kpiRole.child3 = requestBody.node <= 2 ? null : x.child3;
kpiRole.child3Id = requestBody.node <= 2 ? null : x.child3Id;
kpiRole.child3DnaId = requestBody.node <= 2 ? null : x.child3DnaId;
kpiRole.child3ShortName = requestBody.node <= 2 ? null : x.child3ShortName;
kpiRole.child4 = requestBody.node <= 3 ? null : x.child4;
kpiRole.child4Id = requestBody.node <= 3 ? null : x.child4Id;
kpiRole.child4DnaId = requestBody.node <= 3 ? null : x.child4DnaId;
kpiRole.child4ShortName = requestBody.node <= 3 ? null : x.child4ShortName;
})
.catch((x) => {});

View file

@ -112,6 +112,13 @@ export class KpiPlan extends EntityBase {
})
rootId: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน",
default: null,
})
rootDnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน",
@ -133,6 +140,13 @@ export class KpiPlan extends EntityBase {
})
child1Id: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน child1",
default: null,
})
child1DnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child1",
@ -154,6 +168,13 @@ export class KpiPlan extends EntityBase {
})
child2Id: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน child2",
default: null,
})
child2DnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child2",
@ -175,6 +196,13 @@ export class KpiPlan extends EntityBase {
})
child3Id: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน child3",
default: null,
})
child3DnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child3",
@ -196,6 +224,13 @@ export class KpiPlan extends EntityBase {
})
child4Id: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน child4",
default: null,
})
child4DnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child4",

View file

@ -104,6 +104,13 @@ export class KpiRole extends EntityBase {
})
rootId: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน",
default: null,
})
rootDnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน",
@ -125,6 +132,13 @@ export class KpiRole extends EntityBase {
})
child1Id: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน child1",
default: null,
})
child1DnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child1",
@ -146,6 +160,13 @@ export class KpiRole extends EntityBase {
})
child2Id: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน child2",
default: null,
})
child2DnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child2",
@ -167,6 +188,13 @@ export class KpiRole extends EntityBase {
})
child3Id: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน child3",
default: null,
})
child3DnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child3",
@ -188,6 +216,13 @@ export class KpiRole extends EntityBase {
})
child4Id: string;
@Column({
nullable: true,
comment: "id Dna หน่วยงาน child4",
default: null,
})
child4DnaId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน child4",

View file

@ -82,6 +82,14 @@ export class KpiUserEvaluation extends EntityBase {
})
orgId: string;
@Column({
nullable: true,
comment: "สังกัดDna",
length: 255,
default: null,
})
orgDnaId: string;
@Column({
nullable: true,
comment: "child1",
@ -98,6 +106,14 @@ export class KpiUserEvaluation extends EntityBase {
})
child1Id: string;
@Column({
nullable: true,
comment: "child1Dna",
length: 255,
default: null,
})
child1DnaId: string;
@Column({
nullable: true,
comment: "child2",
@ -114,6 +130,14 @@ export class KpiUserEvaluation extends EntityBase {
})
child2Id: string;
@Column({
nullable: true,
comment: "child2Dna",
length: 255,
default: null,
})
child2DnaId: string;
@Column({
nullable: true,
comment: "child3",
@ -130,6 +154,14 @@ export class KpiUserEvaluation extends EntityBase {
})
child3Id: string;
@Column({
nullable: true,
comment: "child3Dna",
length: 255,
default: null,
})
child3DnaId: string;
@Column({
nullable: true,
comment: "child4",
@ -146,6 +178,14 @@ export class KpiUserEvaluation extends EntityBase {
})
child4Id: string;
@Column({
nullable: true,
comment: "child4 Dna",
length: 255,
default: null,
})
child4DnaId: string;
@Column({
nullable: true,
comment: "คำนำหน้าผู้ประเมิน",

View file

@ -0,0 +1,42 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class Updateroleadddna1738321374131 implements MigrationInterface {
name = 'Updateroleadddna1738321374131'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiPlan\` ADD \`rootDnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` ADD \`child1DnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน child1'`);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` ADD \`child2DnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน child2'`);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` ADD \`child3DnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน child3'`);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` ADD \`child4DnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน child4'`);
await queryRunner.query(`ALTER TABLE \`kpiRole\` ADD \`rootDnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`kpiRole\` ADD \`child1DnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน child1'`);
await queryRunner.query(`ALTER TABLE \`kpiRole\` ADD \`child2DnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน child2'`);
await queryRunner.query(`ALTER TABLE \`kpiRole\` ADD \`child3DnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน child3'`);
await queryRunner.query(`ALTER TABLE \`kpiRole\` ADD \`child4DnaId\` varchar(255) NULL COMMENT 'id Dna หน่วยงาน child4'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`orgDnaId\` varchar(255) NULL COMMENT 'สังกัดDna'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child1DnaId\` varchar(255) NULL COMMENT 'child1Dna'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child2DnaId\` varchar(255) NULL COMMENT 'child2Dna'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child3DnaId\` varchar(255) NULL COMMENT 'child3Dna'`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD \`child4DnaId\` varchar(255) NULL COMMENT 'child4 Dna'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child4DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child3DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child2DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`child1DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP COLUMN \`orgDnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiRole\` DROP COLUMN \`child4DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiRole\` DROP COLUMN \`child3DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiRole\` DROP COLUMN \`child2DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiRole\` DROP COLUMN \`child1DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiRole\` DROP COLUMN \`rootDnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` DROP COLUMN \`child4DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` DROP COLUMN \`child3DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` DROP COLUMN \`child2DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` DROP COLUMN \`child1DnaId\``);
await queryRunner.query(`ALTER TABLE \`kpiPlan\` DROP COLUMN \`rootDnaId\``);
}
}