Migrate update employeePosLevel.posLevelName Change Int to Number
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m18s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m18s
This commit is contained in:
parent
e8890133bb
commit
cdbdfce7af
4 changed files with 53 additions and 17 deletions
|
|
@ -251,7 +251,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "positionName":
|
case "positionName":
|
||||||
findData = await this.employeePosDictRepository.find({
|
findData = await this.employeePosDictRepository.find({
|
||||||
where: { posDictName: Like(`%${keyword}%`), posLevel: { posLevelName: 1 } },
|
where: { posDictName: Like(`%${keyword}%`), posLevel: { posLevelName: "1" } },
|
||||||
relations: ["posType", "posLevel"],
|
relations: ["posType", "posLevel"],
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
|
|
@ -274,7 +274,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
select: ["id"],
|
select: ["id"],
|
||||||
});
|
});
|
||||||
findData = await this.employeePosDictRepository.find({
|
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"],
|
relations: ["posType", "posLevel"],
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
|
|
@ -292,19 +292,19 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "positionLevel":
|
case "positionLevel":
|
||||||
if (!isNaN(Number(keyword))) {
|
if (!keyword) {
|
||||||
let findEmpLevels;
|
let findEmpLevels;
|
||||||
if (Number(keyword) === 0) {
|
if (keyword === "0") {
|
||||||
findEmpLevels = await this.employeePosLevelRepository.find();
|
findEmpLevels = await this.employeePosLevelRepository.find();
|
||||||
} else {
|
} else {
|
||||||
findEmpLevels = await this.employeePosLevelRepository.find({
|
findEmpLevels = await this.employeePosLevelRepository.find({
|
||||||
where: { posLevelName: Number(keyword) },
|
where: { posLevelName: keyword },
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
findData = await this.employeePosDictRepository.find({
|
findData = await this.employeePosDictRepository.find({
|
||||||
where: {
|
where: {
|
||||||
posLevelId: In(findEmpLevels.map((x) => x.id)),
|
posLevelId: In(findEmpLevels.map((x) => x.id)),
|
||||||
posLevel: { posLevelName: 1 },
|
posLevel: { posLevelName: "1" },
|
||||||
},
|
},
|
||||||
relations: ["posType", "posLevel"],
|
relations: ["posType", "posLevel"],
|
||||||
order: {
|
order: {
|
||||||
|
|
@ -323,7 +323,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
} else {
|
} else {
|
||||||
//กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย
|
//กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย
|
||||||
findData = await this.employeePosDictRepository.find({
|
findData = await this.employeePosDictRepository.find({
|
||||||
where: { posLevel: { posLevelName: 1 } },
|
where: { posLevel: { posLevelName: "1" } },
|
||||||
relations: ["posType", "posLevel"],
|
relations: ["posType", "posLevel"],
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
|
|
@ -343,7 +343,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
|
|
||||||
default:
|
default:
|
||||||
findData = await this.employeePosDictRepository.find({
|
findData = await this.employeePosDictRepository.find({
|
||||||
where: { posLevel: { posLevelName: 1 } },
|
where: { posLevel: { posLevelName: "1" } },
|
||||||
relations: ["posType", "posLevel"],
|
relations: ["posType", "posLevel"],
|
||||||
order: {
|
order: {
|
||||||
posDictName: "ASC",
|
posDictName: "ASC",
|
||||||
|
|
|
||||||
|
|
@ -395,12 +395,14 @@ export class ImportDataController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
var positionType = "";
|
var positionType = "";
|
||||||
var positionLevel = 0;
|
// var positionLevel = 0;
|
||||||
|
var positionLevel = "0";
|
||||||
const workLevel = item.WORK_LEVEL;
|
const workLevel = item.WORK_LEVEL;
|
||||||
const part1 = workLevel.split("/")[0]; // "ส 2"
|
const part1 = workLevel.split("/")[0]; // "ส 2"
|
||||||
const value2 = part1.split(" ")[1]; // "2"
|
const value2 = part1.split(" ")[1]; // "2"
|
||||||
if (value2) {
|
if (value2) {
|
||||||
positionLevel = parseInt(value2);
|
// positionLevel = parseInt(value2);
|
||||||
|
positionLevel = value2;
|
||||||
}
|
}
|
||||||
if (item.CATEGORY_SAL_CODE == "11") {
|
if (item.CATEGORY_SAL_CODE == "11") {
|
||||||
positionType = "บริการพื้นฐาน";
|
positionType = "บริการพื้นฐาน";
|
||||||
|
|
@ -530,12 +532,14 @@ export class ImportDataController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
var positionType = "";
|
var positionType = "";
|
||||||
var positionLevel = 0;
|
// var positionLevel = 0;
|
||||||
|
var positionLevel = "0";
|
||||||
const value2 = item.POSITION_LEVEL;
|
const value2 = item.POSITION_LEVEL;
|
||||||
// const part1 = workLevel.split("/")[0]; // "ส 2"
|
// const part1 = workLevel.split("/")[0]; // "ส 2"
|
||||||
// const value2 = part1.split(" ")[1]; // "2"
|
// const value2 = part1.split(" ")[1]; // "2"
|
||||||
if (value2) {
|
if (value2) {
|
||||||
positionLevel = parseInt(value2);
|
// positionLevel = parseInt(value2);
|
||||||
|
positionLevel = value2;
|
||||||
}
|
}
|
||||||
if (item.CATEGORY_SAL_CODE == "11") {
|
if (item.CATEGORY_SAL_CODE == "11") {
|
||||||
positionType = "บริการพื้นฐาน";
|
positionType = "บริการพื้นฐาน";
|
||||||
|
|
@ -4340,12 +4344,14 @@ export class ImportDataController extends Controller {
|
||||||
|
|
||||||
let position = new EmployeePosition();
|
let position = new EmployeePosition();
|
||||||
var positionType = "";
|
var positionType = "";
|
||||||
var positionLevel = 0;
|
// var positionLevel = 0;
|
||||||
|
var positionLevel = "0";
|
||||||
const workLevel = item.WORK_LEVEL;
|
const workLevel = item.WORK_LEVEL;
|
||||||
const part1 = workLevel.split("/")[0]; // "ส 2"
|
const part1 = workLevel.split("/")[0]; // "ส 2"
|
||||||
const value2 = part1.split(" ")[1]; // "2"
|
const value2 = part1.split(" ")[1]; // "2"
|
||||||
if (value2) {
|
if (value2) {
|
||||||
positionLevel = parseInt(value2);
|
// positionLevel = parseInt(value2);
|
||||||
|
positionLevel = value2;
|
||||||
}
|
}
|
||||||
if (item.CATEGORY_SAL_CODE == "11") {
|
if (item.CATEGORY_SAL_CODE == "11") {
|
||||||
positionType = "บริการพื้นฐาน";
|
positionType = "บริการพื้นฐาน";
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,13 @@ enum EmployeePosLevelAuthoritys {
|
||||||
export class EmployeePosLevel extends EntityBase {
|
export class EmployeePosLevel extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
comment: "ชื่อระดับชั้นงาน",
|
comment: "ชื่อระดับชั้นงาน",
|
||||||
type: "int",
|
// type: "int",
|
||||||
|
nullable: true,
|
||||||
|
length: 255,
|
||||||
|
default: null,
|
||||||
})
|
})
|
||||||
posLevelName: number;
|
// posLevelName: number;
|
||||||
|
posLevelName: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "ระดับของระดับชั้นงาน",
|
comment: "ระดับของระดับชั้นงาน",
|
||||||
|
|
@ -59,7 +63,7 @@ export class EmployeePosLevel extends EntityBase {
|
||||||
|
|
||||||
export class CreateEmployeePosLevel {
|
export class CreateEmployeePosLevel {
|
||||||
@Column()
|
@Column()
|
||||||
posLevelName: number;
|
posLevelName: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
posLevelRank: number;
|
posLevelRank: number;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateEmployeePosLevelChangeDatatypeFieldPosLevelName1771910056470 implements MigrationInterface {
|
||||||
|
name = 'UpdateEmployeePosLevelChangeDatatypeFieldPosLevelName1771910056470'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
// await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP COLUMN \`posLevelName\``);
|
||||||
|
// await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD \`posLevelName\` varchar(255) NULL COMMENT 'ชื่อระดับชั้นงาน'`);
|
||||||
|
await queryRunner.query(`
|
||||||
|
ALTER TABLE \`employeePosLevel\`
|
||||||
|
MODIFY \`posLevelName\` varchar(255) NULL
|
||||||
|
COMMENT 'ชื่อระดับชั้นงาน'
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
// await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP COLUMN \`posLevelName\``);
|
||||||
|
// await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD \`posLevelName\` int NOT NULL COMMENT 'ชื่อระดับชั้นงาน'`);
|
||||||
|
await queryRunner.query(`
|
||||||
|
ALTER TABLE \`employeePosLevel\`
|
||||||
|
MODIFY \`posLevelName\` int NOT NULL
|
||||||
|
COMMENT 'ชื่อระดับชั้นงาน'
|
||||||
|
`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue