migrate db
This commit is contained in:
parent
7891429d77
commit
b349dd5944
6 changed files with 52 additions and 17 deletions
|
|
@ -317,6 +317,7 @@ export class CommandController extends Controller {
|
||||||
command.detailBody = commandType.detailBody;
|
command.detailBody = commandType.detailBody;
|
||||||
command.detailFooter = commandType.detailFooter;
|
command.detailFooter = commandType.detailFooter;
|
||||||
command.isAttachment = commandType.isAttachment;
|
command.isAttachment = commandType.isAttachment;
|
||||||
|
command.isUploadAttachment = commandType.isUploadAttachment;
|
||||||
command.status = "NEW";
|
command.status = "NEW";
|
||||||
command.issue = commandType.name;
|
command.issue = commandType.name;
|
||||||
command.createdUserId = request.user.sub;
|
command.createdUserId = request.user.sub;
|
||||||
|
|
@ -358,6 +359,7 @@ export class CommandController extends Controller {
|
||||||
detailFooter: command.detailFooter,
|
detailFooter: command.detailFooter,
|
||||||
isBangkok: command.isBangkok,
|
isBangkok: command.isBangkok,
|
||||||
isAttachment: command.isAttachment,
|
isAttachment: command.isAttachment,
|
||||||
|
isUploadAttachment: command.isUploadAttachment,
|
||||||
commandAffectDate: command.commandAffectDate,
|
commandAffectDate: command.commandAffectDate,
|
||||||
commandExcecuteDate: command.commandExcecuteDate,
|
commandExcecuteDate: command.commandExcecuteDate,
|
||||||
commandTypeName: command.commandType?.name || null,
|
commandTypeName: command.commandType?.name || null,
|
||||||
|
|
@ -963,6 +965,7 @@ export class CommandController extends Controller {
|
||||||
isDraft: command.isDraft,
|
isDraft: command.isDraft,
|
||||||
isSign: command.isSign,
|
isSign: command.isSign,
|
||||||
isAttachment: command.isAttachment,
|
isAttachment: command.isAttachment,
|
||||||
|
isUploadAttachment: command.isUploadAttachment,
|
||||||
isSalary: command.commandType ? command.commandType.isSalary : null,
|
isSalary: command.commandType ? command.commandType.isSalary : null,
|
||||||
};
|
};
|
||||||
return new HttpSuccess(_command);
|
return new HttpSuccess(_command);
|
||||||
|
|
@ -1853,6 +1856,7 @@ export class CommandController extends Controller {
|
||||||
command.detailBody = commandType.detailBody;
|
command.detailBody = commandType.detailBody;
|
||||||
command.detailFooter = commandType.detailFooter;
|
command.detailFooter = commandType.detailFooter;
|
||||||
command.isAttachment = commandType.isAttachment;
|
command.isAttachment = commandType.isAttachment;
|
||||||
|
command.isUploadAttachment = commandType.isUploadAttachment;
|
||||||
command.status = "NEW";
|
command.status = "NEW";
|
||||||
command.issue = commandType.name;
|
command.issue = commandType.name;
|
||||||
(command.commandAffectDate = requestBody.commandAffectDate
|
(command.commandAffectDate = requestBody.commandAffectDate
|
||||||
|
|
@ -4501,6 +4505,7 @@ export class CommandController extends Controller {
|
||||||
isDraft: command.isDraft,
|
isDraft: command.isDraft,
|
||||||
isSign: command.isSign,
|
isSign: command.isSign,
|
||||||
isAttachment: command.isAttachment,
|
isAttachment: command.isAttachment,
|
||||||
|
isUploadAttachment: command.isUploadAttachment,
|
||||||
};
|
};
|
||||||
return new HttpSuccess(_command);
|
return new HttpSuccess(_command);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ export class CommandTypeController extends Controller {
|
||||||
"detailFooter",
|
"detailFooter",
|
||||||
"subtitle",
|
"subtitle",
|
||||||
"isAttachment",
|
"isAttachment",
|
||||||
|
"isUploadAttachment",
|
||||||
"createdAt",
|
"createdAt",
|
||||||
"lastUpdatedAt",
|
"lastUpdatedAt",
|
||||||
"createdFullName",
|
"createdFullName",
|
||||||
|
|
@ -74,7 +75,7 @@ export class CommandTypeController extends Controller {
|
||||||
async GetAdmin(
|
async GetAdmin(
|
||||||
@Query("page") page: number = 1,
|
@Query("page") page: number = 1,
|
||||||
@Query("pageSize") pageSize: number = 10,
|
@Query("pageSize") pageSize: number = 10,
|
||||||
@Query("keyword") keyword?: string | null ,
|
@Query("keyword") keyword?: string | null,
|
||||||
@Query() isActive?: boolean | null,
|
@Query() isActive?: boolean | null,
|
||||||
) {
|
) {
|
||||||
const [commandTypes, total] = await this.commandTypeRepository
|
const [commandTypes, total] = await this.commandTypeRepository
|
||||||
|
|
@ -88,19 +89,15 @@ export class CommandTypeController extends Controller {
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.where(
|
qb.where(keyword != null && keyword != "" ? "commandType.name LIKE :keyword" : "1=1", {
|
||||||
keyword != null && keyword != "" ? "commandType.name LIKE :keyword" : "1=1",
|
keyword: `%${keyword}%`,
|
||||||
{
|
}).orWhere(
|
||||||
keyword: `%${keyword}%`,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
.orWhere(
|
|
||||||
keyword != null && keyword != "" ? "commandType.detailBody LIKE :keyword" : "1=1",
|
keyword != null && keyword != "" ? "commandType.detailBody LIKE :keyword" : "1=1",
|
||||||
{
|
{
|
||||||
keyword: `%${keyword}%`,
|
keyword: `%${keyword}%`,
|
||||||
},
|
},
|
||||||
)
|
);
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.orderBy("commandType.order", "ASC")
|
.orderBy("commandType.order", "ASC")
|
||||||
.skip((page - 1) * pageSize)
|
.skip((page - 1) * pageSize)
|
||||||
|
|
@ -133,6 +130,7 @@ export class CommandTypeController extends Controller {
|
||||||
"detailFooter",
|
"detailFooter",
|
||||||
"subtitle",
|
"subtitle",
|
||||||
"isAttachment",
|
"isAttachment",
|
||||||
|
"isUploadAttachment",
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
if (!_commandType) {
|
if (!_commandType) {
|
||||||
|
|
@ -153,14 +151,14 @@ export class CommandTypeController extends Controller {
|
||||||
detailFooter: _commandType.detailFooter,
|
detailFooter: _commandType.detailFooter,
|
||||||
subtitle: _commandType.subtitle,
|
subtitle: _commandType.subtitle,
|
||||||
isAttachment: _commandType.isAttachment,
|
isAttachment: _commandType.isAttachment,
|
||||||
|
isUploadAttachment: _commandType.isUploadAttachment,
|
||||||
name1: "๑. ..........................ประธาน",
|
name1: "๑. ..........................ประธาน",
|
||||||
name2: "๒. ..........................กรรมการ",
|
name2: "๒. ..........................กรรมการ",
|
||||||
name3: "๓. ..........................กรรมการ",
|
name3: "๓. ..........................กรรมการ",
|
||||||
name4: "๔. ..........................กรรมการ",
|
name4: "๔. ..........................กรรมการ",
|
||||||
};
|
};
|
||||||
_commandType = _commandType10;
|
_commandType = _commandType10;
|
||||||
}
|
} else if (["C-PM-21", "C-PM-23"].includes(_commandType.code)) {
|
||||||
else if (["C-PM-21", "C-PM-23"].includes(_commandType.code)) {
|
|
||||||
let _commandType21and23: any;
|
let _commandType21and23: any;
|
||||||
_commandType21and23 = {
|
_commandType21and23 = {
|
||||||
id: _commandType.id,
|
id: _commandType.id,
|
||||||
|
|
@ -175,6 +173,7 @@ export class CommandTypeController extends Controller {
|
||||||
detailFooter: _commandType.detailFooter,
|
detailFooter: _commandType.detailFooter,
|
||||||
subtitle: _commandType.subtitle,
|
subtitle: _commandType.subtitle,
|
||||||
isAttachment: _commandType.isAttachment,
|
isAttachment: _commandType.isAttachment,
|
||||||
|
isUploadAttachment: _commandType.isUploadAttachment,
|
||||||
name1: "๑. ..........................ประธาน",
|
name1: "๑. ..........................ประธาน",
|
||||||
name2: "๒. ..........................กรรมการ",
|
name2: "๒. ..........................กรรมการ",
|
||||||
name3: "๓. ..........................กรรมการ",
|
name3: "๓. ..........................กรรมการ",
|
||||||
|
|
@ -191,9 +190,9 @@ export class CommandTypeController extends Controller {
|
||||||
amount: "",
|
amount: "",
|
||||||
dateRetire: "",
|
dateRetire: "",
|
||||||
dateExecute: "",
|
dateExecute: "",
|
||||||
remark: ""
|
remark: "",
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
};
|
};
|
||||||
_commandType = _commandType21and23;
|
_commandType = _commandType21and23;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -410,8 +410,8 @@ export class ImportDataController extends Controller {
|
||||||
profileSalary.profileEmployeeId = _item.id;
|
profileSalary.profileEmployeeId = _item.id;
|
||||||
profileSalary.refCommandNo = item.MP_COMMAND_NUM;
|
profileSalary.refCommandNo = item.MP_COMMAND_NUM;
|
||||||
profileSalary.posNo = item.POS_NUM_NAME + item.POS_NUM_CODE;
|
profileSalary.posNo = item.POS_NUM_NAME + item.POS_NUM_CODE;
|
||||||
profileSalary.position = item.FLAG_TO_NAME;
|
// profileSalary.position = item.FLAG_TO_NAME;
|
||||||
profileSalary.positionLine = item.WORK_LINE_NAME;
|
profileSalary.position = item.WORK_LINE_NAME;
|
||||||
profileSalary.positionPathSide = item.SPECIALIST_NAME;
|
profileSalary.positionPathSide = item.SPECIALIST_NAME;
|
||||||
profileSalary.positionExecutive = item.ADMIN_NAME;
|
profileSalary.positionExecutive = item.ADMIN_NAME;
|
||||||
profileSalary.templateDoc = item.REMARK;
|
profileSalary.templateDoc = item.REMARK;
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,12 @@ export class Command extends EntityBase {
|
||||||
})
|
})
|
||||||
isAttachment: boolean;
|
isAttachment: boolean;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "อัปโหลดบัญชีแนบท้าย",
|
||||||
|
default: true,
|
||||||
|
})
|
||||||
|
isUploadAttachment: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "ออกคำสั่งแบบ Digital Signature",
|
comment: "ออกคำสั่งแบบ Digital Signature",
|
||||||
default: null,
|
default: null,
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,12 @@ export class CommandType extends EntityBase {
|
||||||
})
|
})
|
||||||
isAttachment: boolean;
|
isAttachment: boolean;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "อัปโหลดบัญชีแนบท้าย",
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
isUploadAttachment: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "สถานะแก้ไขเงินเดือน",
|
comment: "สถานะแก้ไขเงินเดือน",
|
||||||
default: true,
|
default: true,
|
||||||
|
|
@ -126,6 +132,9 @@ export class CreateCommandType {
|
||||||
@Column()
|
@Column()
|
||||||
isAttachment: boolean;
|
isAttachment: boolean;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
isUploadAttachment: boolean;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
isSalary?: boolean | null;
|
isSalary?: boolean | null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableCommandtypeAddIsUploadAttachment1736221443955 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableCommandtypeAddIsUploadAttachment1736221443955'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandType\` ADD \`isUploadAttachment\` tinyint NOT NULL COMMENT 'อัปโหลดบัญชีแนบท้าย' DEFAULT 0`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isUploadAttachment\` tinyint NOT NULL COMMENT 'อัปโหลดบัญชีแนบท้าย' DEFAULT 1`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isUploadAttachment\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandType\` DROP COLUMN \`isUploadAttachment\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue