Migrate update employeePosLevel.posLevelName Change Int to Number
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m18s

This commit is contained in:
harid 2026-02-24 13:28:57 +07:00
parent e8890133bb
commit cdbdfce7af
4 changed files with 53 additions and 17 deletions

View file

@ -251,7 +251,7 @@ export class EmployeeTempPositionController extends Controller {
switch (type) {
case "positionName":
findData = await this.employeePosDictRepository.find({
where: { posDictName: Like(`%${keyword}%`), posLevel: { posLevelName: 1 } },
where: { posDictName: Like(`%${keyword}%`), posLevel: { posLevelName: "1" } },
relations: ["posType", "posLevel"],
order: {
posDictName: "ASC",
@ -274,7 +274,7 @@ export class EmployeeTempPositionController extends Controller {
select: ["id"],
});
findData = await this.employeePosDictRepository.find({
where: { posTypeId: In(findEmpTypes.map((x) => x.id)), posLevel: { posLevelName: 1 } },
where: { posTypeId: In(findEmpTypes.map((x) => x.id)), posLevel: { posLevelName: "1" } },
relations: ["posType", "posLevel"],
order: {
posDictName: "ASC",
@ -292,19 +292,19 @@ export class EmployeeTempPositionController extends Controller {
break;
case "positionLevel":
if (!isNaN(Number(keyword))) {
if (!keyword) {
let findEmpLevels;
if (Number(keyword) === 0) {
if (keyword === "0") {
findEmpLevels = await this.employeePosLevelRepository.find();
} else {
findEmpLevels = await this.employeePosLevelRepository.find({
where: { posLevelName: Number(keyword) },
where: { posLevelName: keyword },
});
}
findData = await this.employeePosDictRepository.find({
where: {
posLevelId: In(findEmpLevels.map((x) => x.id)),
posLevel: { posLevelName: 1 },
posLevel: { posLevelName: "1" },
},
relations: ["posType", "posLevel"],
order: {
@ -323,7 +323,7 @@ export class EmployeeTempPositionController extends Controller {
} else {
//กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย
findData = await this.employeePosDictRepository.find({
where: { posLevel: { posLevelName: 1 } },
where: { posLevel: { posLevelName: "1" } },
relations: ["posType", "posLevel"],
order: {
posDictName: "ASC",
@ -343,7 +343,7 @@ export class EmployeeTempPositionController extends Controller {
default:
findData = await this.employeePosDictRepository.find({
where: { posLevel: { posLevelName: 1 } },
where: { posLevel: { posLevelName: "1" } },
relations: ["posType", "posLevel"],
order: {
posDictName: "ASC",

View file

@ -395,12 +395,14 @@ export class ImportDataController extends Controller {
}
var positionType = "";
var positionLevel = 0;
// var positionLevel = 0;
var positionLevel = "0";
const workLevel = item.WORK_LEVEL;
const part1 = workLevel.split("/")[0]; // "ส 2"
const value2 = part1.split(" ")[1]; // "2"
if (value2) {
positionLevel = parseInt(value2);
// positionLevel = parseInt(value2);
positionLevel = value2;
}
if (item.CATEGORY_SAL_CODE == "11") {
positionType = "บริการพื้นฐาน";
@ -530,12 +532,14 @@ export class ImportDataController extends Controller {
}
var positionType = "";
var positionLevel = 0;
// var positionLevel = 0;
var positionLevel = "0";
const value2 = item.POSITION_LEVEL;
// const part1 = workLevel.split("/")[0]; // "ส 2"
// const value2 = part1.split(" ")[1]; // "2"
if (value2) {
positionLevel = parseInt(value2);
// positionLevel = parseInt(value2);
positionLevel = value2;
}
if (item.CATEGORY_SAL_CODE == "11") {
positionType = "บริการพื้นฐาน";
@ -4340,12 +4344,14 @@ export class ImportDataController extends Controller {
let position = new EmployeePosition();
var positionType = "";
var positionLevel = 0;
// var positionLevel = 0;
var positionLevel = "0";
const workLevel = item.WORK_LEVEL;
const part1 = workLevel.split("/")[0]; // "ส 2"
const value2 = part1.split(" ")[1]; // "2"
if (value2) {
positionLevel = parseInt(value2);
// positionLevel = parseInt(value2);
positionLevel = value2;
}
if (item.CATEGORY_SAL_CODE == "11") {
positionType = "บริการพื้นฐาน";