เพิ่มฟิวคำสั่ง
This commit is contained in:
parent
90f754c0bd
commit
963a76df10
5 changed files with 51 additions and 3 deletions
|
|
@ -145,6 +145,10 @@ export class CommandController extends Controller {
|
||||||
if (!commandType) {
|
if (!commandType) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||||
}
|
}
|
||||||
|
command.detailHeader = commandType.detailHeader;
|
||||||
|
command.detailBody = commandType.detailBody;
|
||||||
|
command.detailFooter = commandType.detailFooter;
|
||||||
|
command.isAttachment = commandType.isAttachment;
|
||||||
command.status = "DRAFT";
|
command.status = "DRAFT";
|
||||||
command.issue = commandType.name;
|
command.issue = commandType.name;
|
||||||
command.createdUserId = request.user.sub;
|
command.createdUserId = request.user.sub;
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,16 @@ export class CommandSysController extends Controller {
|
||||||
@Get("list")
|
@Get("list")
|
||||||
async GetResult() {
|
async GetResult() {
|
||||||
const _commandSys = await this.commandSysRepository.find({
|
const _commandSys = await this.commandSysRepository.find({
|
||||||
select: ["id", "sysName", "sysDescription", "createdAt", "lastUpdatedAt", "createdFullName", "lastUpdateFullName"],
|
select: [
|
||||||
order: { id: "ASC" },
|
"id",
|
||||||
|
"sysName",
|
||||||
|
"sysDescription",
|
||||||
|
"createdAt",
|
||||||
|
"lastUpdatedAt",
|
||||||
|
"createdFullName",
|
||||||
|
"lastUpdateFullName",
|
||||||
|
],
|
||||||
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(_commandSys);
|
return new HttpSuccess(_commandSys);
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +87,11 @@ export class CommandSysController extends Controller {
|
||||||
) {
|
) {
|
||||||
const _commandSys = Object.assign(new CommandSys(), requestBody);
|
const _commandSys = Object.assign(new CommandSys(), requestBody);
|
||||||
const checkName = await this.commandSysRepository.findOne({
|
const checkName = await this.commandSysRepository.findOne({
|
||||||
where: { id: requestBody.id,sysName: requestBody.sysName,sysDescription: requestBody.sysDescription },
|
where: {
|
||||||
|
id: requestBody.id,
|
||||||
|
sysName: requestBody.sysName,
|
||||||
|
sysDescription: requestBody.sysDescription,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (checkName) {
|
if (checkName) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { CommandSend } from "./CommandSend";
|
||||||
|
|
||||||
@Entity("command")
|
@Entity("command")
|
||||||
export class Command extends EntityBase {
|
export class Command extends EntityBase {
|
||||||
|
// NEW = ใหม่
|
||||||
// DRAFT = แบบร่าง
|
// DRAFT = แบบร่าง
|
||||||
// PENDING = รอผู้มีอำนาจ
|
// PENDING = รอผู้มีอำนาจ
|
||||||
// WAITING = รอออกคำสั่ง
|
// WAITING = รอออกคำสั่ง
|
||||||
|
|
@ -87,6 +88,12 @@ export class Command extends EntityBase {
|
||||||
})
|
})
|
||||||
commandTypeId: string;
|
commandTypeId: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "สถานะบัญชีแนบท้าย",
|
||||||
|
default: true,
|
||||||
|
})
|
||||||
|
isAttachment: boolean;
|
||||||
|
|
||||||
@ManyToOne(() => CommandType, (commandType) => commandType.commands)
|
@ManyToOne(() => CommandType, (commandType) => commandType.commands)
|
||||||
@JoinColumn({ name: "commandTypeId" })
|
@JoinColumn({ name: "commandTypeId" })
|
||||||
commandType: CommandType;
|
commandType: CommandType;
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,13 @@ export class CommandSys {
|
||||||
})
|
})
|
||||||
sysDescription: string;
|
sysDescription: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "ลำดับแสดงผล",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
order: number;
|
||||||
|
|
||||||
@OneToMany(() => CommandType, (commandType) => commandType.commandTypeSys)
|
@OneToMany(() => CommandType, (commandType) => commandType.commandTypeSys)
|
||||||
commandTypes: CommandType[];
|
commandTypes: CommandType[];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateCommandAddIsAttachment1727081490162 implements MigrationInterface {
|
||||||
|
name = 'UpdateCommandAddIsAttachment1727081490162'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandSys\` ADD \`order\` int NULL COMMENT 'ลำดับแสดงผล'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`command\` ADD \`isAttachment\` tinyint NOT NULL COMMENT 'สถานะบัญชีแนบท้าย' DEFAULT 1`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` ADD \`FLAG_PERSON_TYPE\` text NULL`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`HR_POSITION_OFFICER\` DROP COLUMN \`FLAG_PERSON_TYPE\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`isAttachment\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandSys\` DROP COLUMN \`order\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue