diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index e97d576..a3df41d 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -3214,7 +3214,8 @@ export class ReportController extends Controller { const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { - isNext: false, + type: In(["NONE"]), + // amountSpecial: MoreThan(0),xx salaryOrg: { snapshot: "SNAP2", rootId: rootId, @@ -3505,6 +3506,7 @@ export class ReportController extends Controller { rootId: rootId, salaryPeriodId: salaryPeriodId, }, + isGood: true, type: Not("NONE"), }, order: { @@ -3901,7 +3903,8 @@ export class ReportController extends Controller { const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { - isNext: true, + // isNext: true, + amountSpecial: MoreThan(0), salaryOrg: { snapshot: "SNAP2", rootId: rootId, @@ -4915,8 +4918,8 @@ export class ReportController extends Controller { const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { - amountSpecial: Not(IsNull()), type: Not("NONE"), + amountSpecial: MoreThan(0), salaryOrg: { snapshot: "SNAP2", rootId: rootId, @@ -5101,7 +5104,8 @@ export class ReportController extends Controller { const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { - type: "NONE", + type: In(["NONE"]), + // amountSpecial: MoreThan(0),xx salaryOrg: { snapshot: "SNAP2", rootId: rootId, @@ -5573,7 +5577,7 @@ export class ReportController extends Controller { const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { - type: Not("NONE"), + isGood: true, salaryOrg: { snapshot: "SNAP2", rootId: rootId, @@ -5858,7 +5862,8 @@ export class ReportController extends Controller { relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { isRetired: true, - isNext: false, + type: In(["NONE"]), + // amountSpecial: MoreThan(0),xxx salaryOrg: { snapshot: "SNAP2", rootId: rootId, @@ -6267,8 +6272,8 @@ export class ReportController extends Controller { const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { - type: Not(In(["NONE", "PENDING"])), - amountSpecial: 0, + type: In(["NONE"]), + // amountSpecial: MoreThan(0),xxx salaryOrg: { snapshot: "SNAP2", rootId: rootId, @@ -7727,7 +7732,7 @@ export class ReportController extends Controller { positionSalaryAmount: item.positionSalaryAmount, })); - return new HttpSuccess(_salaryRank); + return new HttpSuccess(_salaryRank.length); } /** diff --git a/src/entities/SalaryProfileEmployee.ts b/src/entities/SalaryProfileEmployee.ts index 32ea450..0f98cec 100644 --- a/src/entities/SalaryProfileEmployee.ts +++ b/src/entities/SalaryProfileEmployee.ts @@ -370,6 +370,13 @@ export class SalaryProfileEmployee extends EntityBase { }) duration: string; + @Column({ + nullable: true, + comment: "ดีเด่น", + default: null, + }) + isGood: boolean; + @Column({ nullable: true, comment: "การลงโทษทางวินัย", diff --git a/src/migration/1711035132085-update_table_profileemployee_add_groupNew1.ts b/src/migration/1711035132085-update_table_profileemployee_add_groupNew1.ts deleted file mode 100644 index 42c65c7..0000000 --- a/src/migration/1711035132085-update_table_profileemployee_add_groupNew1.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableProfileemployeeAddGroupNew11711035132085 implements MigrationInterface { - name = 'UpdateTableProfileemployeeAddGroupNew11711035132085' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`group\``); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`group\` double NULL COMMENT 'กลุ่มบัญชีการจ้าง'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`group\``); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`group\` int NULL COMMENT 'กลุ่มบัญชีการจ้าง'`); - } - -} diff --git a/src/migration/1711081845764-update_table_profileemployee_add_groupNew2.ts b/src/migration/1711081845764-update_table_profileemployee_add_groupNew2.ts deleted file mode 100644 index 06578d1..0000000 --- a/src/migration/1711081845764-update_table_profileemployee_add_groupNew2.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableProfileemployeeAddGroupNew21711081845764 implements MigrationInterface { - name = 'UpdateTableProfileemployeeAddGroupNew21711081845764' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`positionSalaryAmountPer\` double NOT NULL COMMENT 'เปอร์เซ็นเงินพิเศษ' DEFAULT '0'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`positionSalaryAmountPer\``); - } - -} diff --git a/src/migration/1711596443220-update_table_salaryprofile_add_root.ts b/src/migration/1711596443220-update_table_salaryprofile_add_root.ts deleted file mode 100644 index c48d5c9..0000000 --- a/src/migration/1711596443220-update_table_salaryprofile_add_root.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableSalaryprofileAddRoot1711596443220 implements MigrationInterface { - name = 'UpdateTableSalaryprofileAddRoot1711596443220' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryOrg\` ADD \`root\` varchar(255) NULL COMMENT 'orgRoot'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryOrg\` DROP COLUMN \`root\``); - } - -} diff --git a/src/migration/1711631590179-update_table_salaryprofile_add_root1.ts b/src/migration/1711631590179-update_table_salaryprofile_add_root1.ts deleted file mode 100644 index fd75907..0000000 --- a/src/migration/1711631590179-update_table_salaryprofile_add_root1.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableSalaryprofileAddRoot11711631590179 implements MigrationInterface { - name = 'UpdateTableSalaryprofileAddRoot11711631590179' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryOrgEmployee\` ADD \`root\` varchar(255) NULL COMMENT 'orgRoot'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryOrgEmployee\` DROP COLUMN \`root\``); - } - -} diff --git a/src/migration/1712043041340-update_table_salaryProfileEmployee_add_isSpecial.ts b/src/migration/1712043041340-update_table_salaryProfileEmployee_add_isSpecial.ts deleted file mode 100644 index ccab8d4..0000000 --- a/src/migration/1712043041340-update_table_salaryProfileEmployee_add_isSpecial.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableSalaryProfileEmployeeAddIsSpecial1712043041340 implements MigrationInterface { - name = 'UpdateTableSalaryProfileEmployeeAddIsSpecial1712043041340' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`isSpecial\` tinyint NULL COMMENT 'ฉ'`); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`isSpecial\` tinyint NULL COMMENT 'ฉ'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`isSpecial\``); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`isSpecial\``); - } - -} diff --git a/src/migration/1713980385738-update_table_salaryprofile_add_profileId.ts b/src/migration/1713980385738-update_table_salaryprofile_add_profileId.ts deleted file mode 100644 index 25883df..0000000 --- a/src/migration/1713980385738-update_table_salaryprofile_add_profileId.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableSalaryprofileAddProfileId1713980385738 implements MigrationInterface { - name = 'UpdateTableSalaryprofileAddProfileId1713980385738' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`profileId\` varchar(40) NULL COMMENT 'ไอดีโปรไฟล์'`); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`profileId\` varchar(40) NULL COMMENT 'ไอดีโปรไฟล์'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`profileId\``); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`profileId\``); - } - -} diff --git a/src/migration/1716881317736-update_table_salaryProfile_add_rank.ts b/src/migration/1716881317736-update_table_salaryProfile_add_rank.ts deleted file mode 100644 index 70b1ff4..0000000 --- a/src/migration/1716881317736-update_table_salaryProfile_add_rank.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableSalaryProfileAddRank1716881317736 implements MigrationInterface { - name = 'UpdateTableSalaryProfileAddRank1716881317736' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`rank\` varchar(255) NULL COMMENT 'ยศ'`); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`rank\` varchar(255) NULL COMMENT 'ยศ'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`rank\``); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`rank\``); - } - -} diff --git a/src/migration/1718606376807-update_table_salaryprofile_add_result.ts b/src/migration/1718606376807-update_table_salaryprofile_add_result.ts deleted file mode 100644 index f5b4641..0000000 --- a/src/migration/1718606376807-update_table_salaryprofile_add_result.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableSalaryprofileAddResult1718606376807 implements MigrationInterface { - name = 'UpdateTableSalaryprofileAddResult1718606376807' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`result\``); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`result\` double NULL COMMENT 'ผลการประเมินผลการปฏิบัติราชการ'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`result\``); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`result\` varchar(255) NULL COMMENT 'ผลการประเมินผลการปฏิบัติราชการ'`); - } - -} diff --git a/src/migration/1743787344650-update_table_salaryorg_add_isclose.ts b/src/migration/1743787344650-update_table_salaryorg_add_isclose.ts deleted file mode 100644 index 0adae74..0000000 --- a/src/migration/1743787344650-update_table_salaryorg_add_isclose.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableSalaryorgAddIsclose1743787344650 implements MigrationInterface { - name = 'UpdateTableSalaryorgAddIsclose1743787344650' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryOrg\` ADD \`isClose\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0`); - await queryRunner.query(`ALTER TABLE \`salaryOrgEmployee\` ADD \`isClose\` tinyint NOT NULL COMMENT 'สถานะการใช้งาน' DEFAULT 0`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryOrgEmployee\` DROP COLUMN \`isClose\``); - await queryRunner.query(`ALTER TABLE \`salaryOrg\` DROP COLUMN \`isClose\``); - } - -} diff --git a/src/migration/1743847173845-update_table_salaryorg_add_order.ts b/src/migration/1743847173845-update_table_salaryorg_add_order.ts deleted file mode 100644 index 1a6bcba..0000000 --- a/src/migration/1743847173845-update_table_salaryorg_add_order.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateTableSalaryorgAddOrder1743847173845 implements MigrationInterface { - name = 'UpdateTableSalaryorgAddOrder1743847173845' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`rootOrder\` varchar(40) NULL COMMENT 'order orgRoot'`); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`child1Order\` varchar(40) NULL COMMENT 'Order orgChild1'`); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`child2Order\` varchar(40) NULL COMMENT 'Order orgChild2'`); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`child3Order\` varchar(40) NULL COMMENT 'Order orgChild3'`); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`child4Order\` varchar(40) NULL COMMENT 'Order orgChild4'`); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`rootOrder\` varchar(40) NULL COMMENT 'Order orgRoot'`); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`child1Order\` varchar(40) NULL COMMENT 'Order orgChild1'`); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`child2Order\` varchar(40) NULL COMMENT 'Order orgChild2'`); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`child3Order\` varchar(40) NULL COMMENT 'Order orgChild3'`); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`child4Order\` varchar(40) NULL COMMENT 'Order orgChild4'`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`child4Order\``); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`child3Order\``); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`child2Order\``); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`child1Order\``); - await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`rootOrder\``); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`child4Order\``); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`child3Order\``); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`child2Order\``); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`child1Order\``); - await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`rootOrder\``); - } - -} diff --git a/src/migration/1746095843641-update300420250045.ts b/src/migration/1746095843641-update300420250045.ts new file mode 100644 index 0000000..a68a14e --- /dev/null +++ b/src/migration/1746095843641-update300420250045.ts @@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class Update3004202500451746095843641 implements MigrationInterface { + name = "Update3004202500451746095843641"; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `ALTER TABLE \`salaryProfileEmployee\` ADD \`isGood\` tinyint NULL COMMENT 'ดีเด่น'`, + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`isGood\``); + } +}