map profilesalary

This commit is contained in:
mamoss 2025-03-25 09:36:38 +07:00
parent 4a87969337
commit b01f074afe
3 changed files with 27 additions and 18 deletions

View file

@ -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<string, any> }) {
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++;

View file

@ -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;
}

View file

@ -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;
}