เพิ่มฟิลด์ employeePosLevel.posLevelAuthority
This commit is contained in:
parent
ac1599485a
commit
a069c81d41
3 changed files with 37 additions and 5 deletions
|
|
@ -167,7 +167,7 @@ export class EmployeePosLevelController extends Controller {
|
||||||
async GetEmpLevelById(@Path() id: string) {
|
async GetEmpLevelById(@Path() id: string) {
|
||||||
const getEmpPosLevel = await this.employeePosLevelRepository.findOne({
|
const getEmpPosLevel = await this.employeePosLevelRepository.findOne({
|
||||||
relations: ["posType"],
|
relations: ["posType"],
|
||||||
select: ["id", "posLevelName", "posLevelRank"],
|
select: ["id", "posLevelName", "posLevelRank", "posLevelAuthority"],
|
||||||
where: { id: id },
|
where: { id: id },
|
||||||
});
|
});
|
||||||
if (!getEmpPosLevel) {
|
if (!getEmpPosLevel) {
|
||||||
|
|
@ -178,7 +178,7 @@ export class EmployeePosLevelController extends Controller {
|
||||||
posLevelName: getEmpPosLevel.posLevelName,
|
posLevelName: getEmpPosLevel.posLevelName,
|
||||||
posTypeId: getEmpPosLevel.posType == null ? null : getEmpPosLevel.posType.id,
|
posTypeId: getEmpPosLevel.posType == null ? null : getEmpPosLevel.posType.id,
|
||||||
posTypeName: getEmpPosLevel.posType == null ? null : getEmpPosLevel.posType.posTypeName, //กลุ่มงาน
|
posTypeName: getEmpPosLevel.posType == null ? null : getEmpPosLevel.posType.posTypeName, //กลุ่มงาน
|
||||||
commander: null, //ผู้มีอำนาจสั่งบรรจุ
|
posLevelAuthority: getEmpPosLevel.posLevelAuthority, //ผู้มีอำนาจสั่งบรรจุ
|
||||||
};
|
};
|
||||||
return new HttpSuccess(mapEmpPosLevel);
|
return new HttpSuccess(mapEmpPosLevel);
|
||||||
}
|
}
|
||||||
|
|
@ -193,14 +193,14 @@ export class EmployeePosLevelController extends Controller {
|
||||||
async GetEmpPosLevel() {
|
async GetEmpPosLevel() {
|
||||||
const empPosLevel = await this.employeePosLevelRepository.find({
|
const empPosLevel = await this.employeePosLevelRepository.find({
|
||||||
relations: ["posType"],
|
relations: ["posType"],
|
||||||
select: ["id", "posLevelName", "posLevelRank"],
|
select: ["id", "posLevelName", "posLevelRank", "posLevelAuthority"],
|
||||||
});
|
});
|
||||||
const mapEmpPosLevel = empPosLevel.map((item) => ({
|
const mapEmpPosLevel = empPosLevel.map((item) => ({
|
||||||
id: item.id,
|
id: item.id,
|
||||||
posLevelName: item.posLevelName,
|
posLevelName: item.posLevelName,
|
||||||
posTypeId: item.posType == null ? null : item.posType.id,
|
posTypeId: item.posType == null ? null : item.posType.id,
|
||||||
posTypeName: item.posType == null ? null : item.posType.posTypeName, //กลุ่มงาน
|
posTypeName: item.posType == null ? null : item.posType.posTypeName, //กลุ่มงาน
|
||||||
commander: null, //ผู้มีอำนาจสั่งบรรจุ
|
posLevelAuthority: item.posLevelAuthority, //ผู้มีอำนาจสั่งบรรจุ
|
||||||
}));
|
}));
|
||||||
return new HttpSuccess(mapEmpPosLevel);
|
return new HttpSuccess(mapEmpPosLevel);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,11 @@ import { EntityBase } from "./base/Base";
|
||||||
import { EmployeePosDict } from "./EmployeePosDict";
|
import { EmployeePosDict } from "./EmployeePosDict";
|
||||||
import { EmployeePosType } from "./EmployeePosType";
|
import { EmployeePosType } from "./EmployeePosType";
|
||||||
|
|
||||||
|
enum EmployeePosLevelAuthoritys {
|
||||||
|
HEAD = "HEAD",
|
||||||
|
DEPUTY = "DEPUTY",
|
||||||
|
GOVERNOR = "GOVERNOR",
|
||||||
|
}
|
||||||
@Entity("employeePosLevel")
|
@Entity("employeePosLevel")
|
||||||
export class EmployeePosLevel extends EntityBase {
|
export class EmployeePosLevel extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
|
|
@ -17,6 +22,16 @@ export class EmployeePosLevel extends EntityBase {
|
||||||
})
|
})
|
||||||
posLevelRank: number;
|
posLevelRank: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment:
|
||||||
|
"ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ",
|
||||||
|
type: "enum",
|
||||||
|
enum: EmployeePosLevelAuthoritys,
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
posLevelAuthority: EmployeePosLevelAuthoritys;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
length: 40,
|
length: 40,
|
||||||
comment: "คีย์นอก(FK)ของตาราง employeePosType",
|
comment: "คีย์นอก(FK)ของตาราง employeePosType",
|
||||||
|
|
@ -38,8 +53,11 @@ export class CreateEmployeePosLevel {
|
||||||
@Column()
|
@Column()
|
||||||
posLevelRank: number;
|
posLevelRank: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
posLevelAuthority: string;
|
||||||
|
|
||||||
@Column("uuid")
|
@Column("uuid")
|
||||||
posTypeId: string;
|
posTypeId: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateEmployeePosLevel = Partial<CreateEmployeePosLevel>;
|
export type UpdateEmployeePosLevel = Partial<CreateEmployeePosLevel> & { posLevelAuthority: EmployeePosLevelAuthoritys };
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class AddColumnEmployeePosLevelPosLevelAuthority1710399617760 implements MigrationInterface {
|
||||||
|
name = 'AddColumnEmployeePosLevelPosLevelAuthority1710399617760'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` ADD \`posLevelAuthority\` enum ('HEAD', 'DEPUTY', 'GOVERNOR') NULL COMMENT 'ผู้มีอำนาจสั่งบรรจุของระดับนี้ head = หัวหน้าหน่วยงาน , deputy = ปลัด , governor = ผู้ว่าฯ'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`employeePosLevel\` DROP COLUMN \`posLevelAuthority\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue