From b01f074afec9c1e7128de1e4e5e2e9bc6c49bc86 Mon Sep 17 00:00:00 2001 From: mamoss <> Date: Tue, 25 Mar 2025 09:36:38 +0700 Subject: [PATCH] map profilesalary --- src/controllers/ImportDataController.ts | 10 ++++++---- src/entities/HR_POSITION_OFFICER.ts | 21 +++++++++++++++++++++ src/entities/OFFICER.ts | 14 -------------- 3 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 src/entities/HR_POSITION_OFFICER.ts diff --git a/src/controllers/ImportDataController.ts b/src/controllers/ImportDataController.ts index b0ff4187..94f7fdb3 100644 --- a/src/controllers/ImportDataController.ts +++ b/src/controllers/ImportDataController.ts @@ -53,6 +53,7 @@ import { HR_FUND_COURSE_CODE } from "../entities/HR_FUND_COURSE_CODE"; import { HR_MAJOR_CODE } from "../entities/HR_MAJOR_CODE"; // import { uuidv7 } from "uuidv7"; import { ProfileSalaries } from "../entities/ProfileSalaries"; +import { HR_POSITION_OFFICER } from "../entities/HR_POSITION_OFFICER"; @Route("api/v1/org/upload") @Tags("UPLOAD") @Security("bearerAuth") @@ -81,6 +82,7 @@ export class ImportDataController extends Controller { private educationLevelRepo = AppDataSource.getRepository(EducationLevel); private HR_MAJOR_CODERepo = AppDataSource.getRepository(HR_MAJOR_CODE); private HR_FUND_COURSE_CODERepo = AppDataSource.getRepository(HR_FUND_COURSE_CODE); + private HR_POSITION_OFFICERRepo = AppDataSource.getRepository(HR_POSITION_OFFICER); private provincsRepo = AppDataSource.getRepository(ProvinceImport); private amphurRepo = AppDataSource.getRepository(AmphurImport); private subDistrictRepo = AppDataSource.getRepository(SubDistrictImport); @@ -2629,12 +2631,12 @@ export class ImportDataController extends Controller { @Post("update-profileSalary") async UpdateProfileSalary(@Request() request: { user: Record }) { let rowCount = 0; - const profileSalarys: any = await this.salaryRepo.find({ where: { refId: IsNull() } }); + const profileSalarys: any = await this.salaryRepo.find({ where: { refId: Not(IsNull()) } }); for await (const _item of profileSalarys) { - const OFFICER = await this.OFFICERRepo.findOne({ - select: ["ID", "POS_NUM_CODE_SIT", "POS_NUM_CODE_SIT_ABB"], - where: { ID: _item.refId }, + const OFFICER = await this.HR_POSITION_OFFICERRepo.findOne({ + select: ["id", "POS_NUM_CODE_SIT", "POS_NUM_CODE_SIT_ABB"], + where: { id: _item.refId }, }); if (OFFICER) { rowCount++; diff --git a/src/entities/HR_POSITION_OFFICER.ts b/src/entities/HR_POSITION_OFFICER.ts new file mode 100644 index 00000000..0f57a9f8 --- /dev/null +++ b/src/entities/HR_POSITION_OFFICER.ts @@ -0,0 +1,21 @@ +import { Entity, Column, PrimaryGeneratedColumn } from "typeorm"; + +@Entity("HR_POSITION_OFFICER") +export class HR_POSITION_OFFICER { + @PrimaryGeneratedColumn() + id!: number; + + @Column({ + nullable: true, + type: "text", + default: null, + }) + POS_NUM_CODE_SIT: string; + + @Column({ + nullable: true, + type: "text", + default: null, + }) + POS_NUM_CODE_SIT_ABB: string; +} diff --git a/src/entities/OFFICER.ts b/src/entities/OFFICER.ts index 2adac143..87ce4739 100644 --- a/src/entities/OFFICER.ts +++ b/src/entities/OFFICER.ts @@ -172,18 +172,4 @@ export class OFFICER { default: null, }) ADMIN_NAME: string; - - @Column({ - nullable: true, - type: "text", - default: null, - }) - POS_NUM_CODE_SIT: string; - - @Column({ - nullable: true, - type: "text", - default: null, - }) - POS_NUM_CODE_SIT_ABB: string; }