เพิ่มฟิวหน่วยงานผู้ค้ำ

This commit is contained in:
Kittapath 2024-04-18 16:17:37 +07:00
parent 109bea3fc8
commit a840274150
5 changed files with 84 additions and 7 deletions

View file

@ -239,7 +239,7 @@ export class DevelopmentEmployeeHistoryController extends Controller {
{ year: body.year },
)
.andWhere(
body.root != null && body.root != undefined ? "developmentHistory.rootId = :root" : "1=1",
body.root != null && body.root != undefined ? "developmentHistory.root = :root" : "1=1",
{
root: body.root,
},

View file

@ -230,12 +230,9 @@ export class DevelopmentOfficerHistoryController extends Controller {
: "1=1",
{ year: body.year },
)
.andWhere(
body.root != null && body.root != undefined ? "development.rootId = :root" : "1=1",
{
root: body.root,
},
)
.andWhere(body.root != null && body.root != undefined ? "development.root = :root" : "1=1", {
root: body.root,
})
.andWhere(body.root != null ? "developmentHistory.root = :root" : "1=1", { root: body.root })
.andWhere("developmentHistory.type = :type", { type: type })
.andWhere(

View file

@ -238,7 +238,11 @@ export class DevelopmentScholarshipController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทุนการศึกษา/ฝึกอบรมนี้");
}
const formattedData = {
rootId: getDevelopment.rootId ? getDevelopment.rootId : null,
root: getDevelopment.root ? getDevelopment.root : null,
org: getDevelopment.org ? getDevelopment.org : null,
orgRootShortName: getDevelopment.orgRootShortName ? getDevelopment.orgRootShortName : null,
orgRevisionId: getDevelopment.orgRevisionId ? getDevelopment.orgRevisionId : null,
rank: getDevelopment.rank ? getDevelopment.rank : null,
prefix: getDevelopment.prefix ? getDevelopment.prefix : null,
firstName: getDevelopment.firstName ? getDevelopment.firstName : null,
@ -252,6 +256,15 @@ export class DevelopmentScholarshipController extends Controller {
: null,
posTypeId: getDevelopment.posTypeId ? getDevelopment.posTypeId : null,
posTypeName: getDevelopment.posType?.posTypeName ? getDevelopment.posType?.posTypeName : null,
guarantorRootId: getDevelopment.guarantorRootId ? getDevelopment.guarantorRootId : null,
guarantorRoot: getDevelopment.guarantorRoot ? getDevelopment.guarantorRoot : null,
guarantorOrg: getDevelopment.guarantorOrg ? getDevelopment.guarantorOrg : null,
guarantorOrgRootShortName: getDevelopment.guarantorOrgRootShortName
? getDevelopment.guarantorOrgRootShortName
: null,
guarantorOrgRevisionId: getDevelopment.guarantorOrgRevisionId
? getDevelopment.guarantorOrgRevisionId
: null,
guarantorRank: getDevelopment.guarantorRank ? getDevelopment.guarantorRank : null,
guarantorPrefix: getDevelopment.guarantorPrefix ? getDevelopment.guarantorPrefix : null,
guarantorFirstName: getDevelopment.guarantorFirstName

View file

@ -137,6 +137,41 @@ export class DevelopmentScholarship extends EntityBase {
@JoinColumn({ name: "posTypeId" })
posType: PosType;
@Column({
nullable: true,
comment: "id หน่วยงาน",
default: null,
})
guarantorRootId: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงาน",
default: null,
})
guarantorRoot: string;
@Column({
nullable: true,
comment: "ชื่อหน่วยงานที่สังกัด",
default: null,
})
guarantorOrg: string;
@Column({
nullable: true,
comment: "ชื่อย่อหน่วยงาน",
default: null,
})
guarantorOrgRootShortName: string;
@Column({
nullable: true,
comment: "id revision",
default: null,
})
guarantorOrgRevisionId: string;
@Column({
nullable: true,
comment: "ยศ(ผู้ค้ำ)",
@ -549,6 +584,11 @@ export class CreateDevelopmentScholarship {
posExecutive: string | null;
posLevelId: string | null;
posTypeId: string | null;
guarantorRootId: string | null;
guarantorRoot: string | null;
guarantorOrg: string | null;
guarantorOrgRootShortName: string | null;
guarantorOrgRevisionId: string | null;
guarantorRank?: string | null;
guarantorPrefix: string | null;
guarantorFirstName: string | null;
@ -609,6 +649,11 @@ export class UpdateDevelopmentScholarship {
posExecutive: string | null;
posLevelId: string | null;
posTypeId: string | null;
guarantorRootId?: string | null;
guarantorRoot?: string | null;
guarantorOrg?: string | null;
guarantorOrgRootShortName?: string | null;
guarantorOrgRevisionId?: string | null;
guarantorRank?: string | null;
guarantorPrefix: string | null;
guarantorFirstName: string | null;

View file

@ -0,0 +1,22 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableDevscholarAddGuarantorOrg1713431125506 implements MigrationInterface {
name = 'UpdateTableDevscholarAddGuarantorOrg1713431125506'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`guarantorRootId\` varchar(255) NULL COMMENT 'id หน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`guarantorRoot\` varchar(255) NULL COMMENT 'ชื่อหน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`guarantorOrg\` varchar(255) NULL COMMENT 'ชื่อหน่วยงานที่สังกัด'`);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`guarantorOrgRootShortName\` varchar(255) NULL COMMENT 'ชื่อย่อหน่วยงาน'`);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`guarantorOrgRevisionId\` varchar(255) NULL COMMENT 'id revision'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`guarantorOrgRevisionId\``);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`guarantorOrgRootShortName\``);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`guarantorOrg\``);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`guarantorRoot\``);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`guarantorRootId\``);
}
}