Merge branch 'develop' into adiDev
This commit is contained in:
commit
c0b14fe189
12 changed files with 383 additions and 87 deletions
|
|
@ -30,6 +30,8 @@ import { CommandSalary } from "../entities/CommandSalary";
|
|||
import { CommandRecive } from "../entities/CommandRecive";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
import Extension from "../interfaces/extension";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
|
||||
@Route("api/v1/org/command")
|
||||
@Tags("Command")
|
||||
|
|
@ -47,6 +49,7 @@ export class CommandController extends Controller {
|
|||
private commandSalaryRepository = AppDataSource.getRepository(CommandSalary);
|
||||
private commandReciveRepository = AppDataSource.getRepository(CommandRecive);
|
||||
private profileRepository = AppDataSource.getRepository(Profile);
|
||||
private profileEmployeeRepository = AppDataSource.getRepository(ProfileEmployee);
|
||||
private orgRevisionRepo = AppDataSource.getRepository(OrgRevision);
|
||||
|
||||
/**
|
||||
|
|
@ -276,7 +279,7 @@ export class CommandController extends Controller {
|
|||
prefix: x.prefix,
|
||||
firstName: x.firstName,
|
||||
lastName: x.lastName,
|
||||
profileId: x.profileId,
|
||||
// profileId: x.profileId,
|
||||
order: x.order,
|
||||
remarkVertical: x.remarkVertical,
|
||||
remarkHorizontal: x.remarkHorizontal,
|
||||
|
|
@ -828,9 +831,9 @@ export class CommandController extends Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* API ทำคำสั่งใหม่
|
||||
* API ออกคำสั่ง
|
||||
*
|
||||
* @summary API ทำคำสั่งใหม่
|
||||
* @summary API ออกคำสั่ง
|
||||
*
|
||||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
|
|
@ -841,7 +844,10 @@ export class CommandController extends Controller {
|
|||
requestBody: { sign?: boolean },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
const command = await this.commandRepository.findOne({ where: { id: id } });
|
||||
const command = await this.commandRepository.findOne({
|
||||
where: { id: id },
|
||||
relations: ["commandType", "commandRecives"],
|
||||
});
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
}
|
||||
|
|
@ -858,7 +864,28 @@ export class CommandController extends Controller {
|
|||
) {
|
||||
command.status = "WAITING";
|
||||
} else {
|
||||
command.status = "REPORTED";
|
||||
const path = this.commandTypePath(command.commandType.code);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
|
||||
await new CallAPI()
|
||||
.PostData(request, path + "/excecute", {
|
||||
refIds: command.commandRecives
|
||||
.filter((x) => x.refId != null)
|
||||
.map((x) => ({
|
||||
refId: x.refId,
|
||||
commandAffectDate: command.commandAffectDate,
|
||||
commandNo: command.commandNo,
|
||||
commandYear: command.commandYear,
|
||||
templateDoc: command.positionDetail,
|
||||
amount: x.amount,
|
||||
positionSalaryAmount: x.positionSalaryAmount,
|
||||
mouthSalaryAmount: x.mouthSalaryAmount,
|
||||
})),
|
||||
})
|
||||
.then(async (res) => {
|
||||
command.status = "REPORTED";
|
||||
})
|
||||
.catch((e) => {});
|
||||
}
|
||||
command.lastUpdateUserId = request.user.sub;
|
||||
command.lastUpdateFullName = request.user.name;
|
||||
|
|
@ -875,7 +902,7 @@ export class CommandController extends Controller {
|
|||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
@Get("tab4/cover/{id}")
|
||||
async GetByIdTab4Cover(@Path() id: string) {
|
||||
async GetByIdTab4Cover(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
const command = await this.commandRepository.findOne({
|
||||
where: { id },
|
||||
relations: ["commandType"],
|
||||
|
|
@ -918,38 +945,234 @@ export class CommandController extends Controller {
|
|||
* @param {string} id Id คำสั่ง
|
||||
*/
|
||||
@Get("tab4/attachment/{id}")
|
||||
async GetByIdTab4Attachment(@Path() id: string) {
|
||||
async GetByIdTab4Attachment(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
const command = await this.commandRepository.findOne({
|
||||
where: { id },
|
||||
relations: ["commandType"],
|
||||
relations: ["commandType", "commandRecives"],
|
||||
});
|
||||
if (!command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลคำสั่งนี้");
|
||||
}
|
||||
|
||||
const _command = {
|
||||
issue: "...................................",
|
||||
commandNo: command.commandNo,
|
||||
commandYear: command.commandYear,
|
||||
commandTitle: command.issue,
|
||||
detailHeader: command.detailHeader,
|
||||
detailBody: command.detailBody,
|
||||
detailFooter: command.detailFooter,
|
||||
commandDate:
|
||||
command.commandAffectDate == null
|
||||
? ""
|
||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(command.commandAffectDate)),
|
||||
commandExcecuteDate:
|
||||
command.commandExcecuteDate == null
|
||||
? ""
|
||||
: Extension.ToThaiNumber(Extension.ToThaiFullDate2(command.commandExcecuteDate)),
|
||||
name: "...................................",
|
||||
position: "...................................",
|
||||
};
|
||||
let _command: any = [];
|
||||
const path = this.commandTypePath(command.commandType.code);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
|
||||
await new CallAPI()
|
||||
.PostData(request, path + "/attachment", {
|
||||
refIds: command.commandRecives.map((x) => x.refId),
|
||||
})
|
||||
.then(async (res) => {
|
||||
console.log(res);
|
||||
_command = res;
|
||||
})
|
||||
.catch(() => {});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: command.commandType.fileAttachment,
|
||||
reportName: "xlsx-report",
|
||||
data: _command,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API สร้างรายการ body คำสั่ง
|
||||
*
|
||||
* @summary API สร้างรายการ body คำสั่ง
|
||||
*
|
||||
*/
|
||||
@Post("person")
|
||||
async PostPerson(
|
||||
@Body()
|
||||
requestBody: {
|
||||
commandTypeId?: string | null;
|
||||
commandNo?: string | null;
|
||||
commandYear?: number | null;
|
||||
commandId?: string | null;
|
||||
persons: {
|
||||
refId: string;
|
||||
citizenId: string;
|
||||
prefix: string;
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
}[];
|
||||
},
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
let command = new Command();
|
||||
let commandCode = null;
|
||||
if (
|
||||
requestBody.commandId != undefined &&
|
||||
requestBody.commandId != null &&
|
||||
requestBody.commandId != ""
|
||||
) {
|
||||
const _command = await this.commandRepository.findOne({
|
||||
where: { id: requestBody.commandId },
|
||||
relations: ["commandRecives", "commandType"],
|
||||
order: {
|
||||
commandRecives: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!_command) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบคำสั่งนี้ในระบบ");
|
||||
}
|
||||
commandCode = _command.commandType.code;
|
||||
command = _command;
|
||||
} else {
|
||||
command = Object.assign(new Command(), requestBody);
|
||||
if (!requestBody.commandTypeId) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่ง");
|
||||
}
|
||||
const commandType = await this.commandTypeRepository.findOne({
|
||||
where: { id: requestBody.commandTypeId },
|
||||
});
|
||||
|
||||
if (!commandType) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
}
|
||||
commandCode = commandType.code;
|
||||
command.detailHeader = commandType.detailHeader;
|
||||
command.detailBody = commandType.detailBody;
|
||||
command.detailFooter = commandType.detailFooter;
|
||||
command.isAttachment = commandType.isAttachment;
|
||||
command.status = "NEW";
|
||||
command.issue = commandType.name;
|
||||
command.createdUserId = request.user.sub;
|
||||
command.createdFullName = request.user.name;
|
||||
command.createdAt = new Date();
|
||||
command.lastUpdateUserId = request.user.sub;
|
||||
command.lastUpdateFullName = request.user.name;
|
||||
command.lastUpdatedAt = new Date();
|
||||
await this.commandRepository.save(command);
|
||||
}
|
||||
|
||||
const path = this.commandTypePath(commandCode);
|
||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||
await new CallAPI()
|
||||
.PostData(request, path, {
|
||||
refIds: requestBody.persons.map((x) => x.refId),
|
||||
})
|
||||
.then(async (res) => {
|
||||
let order =
|
||||
command.commandRecives == null || command.commandRecives.length <= 0
|
||||
? 0
|
||||
: command.commandRecives[0].order;
|
||||
await Promise.all(
|
||||
requestBody.persons.map(async (item) => {
|
||||
const _commandRecive = await this.commandReciveRepository.findOne({
|
||||
where: {
|
||||
commandId: command.id,
|
||||
refId: item.refId,
|
||||
},
|
||||
});
|
||||
if (_commandRecive) return;
|
||||
order = order + 1;
|
||||
let commandRecive = new CommandRecive();
|
||||
commandRecive = Object.assign(new CommandRecive(), item);
|
||||
commandRecive.order = order;
|
||||
commandRecive.commandId = command.id;
|
||||
commandRecive.createdUserId = request.user.sub;
|
||||
commandRecive.createdFullName = request.user.name;
|
||||
commandRecive.createdAt = new Date();
|
||||
commandRecive.lastUpdateUserId = request.user.sub;
|
||||
commandRecive.lastUpdateFullName = request.user.name;
|
||||
commandRecive.lastUpdatedAt = new Date();
|
||||
await this.commandReciveRepository.save(commandRecive);
|
||||
}),
|
||||
);
|
||||
})
|
||||
.catch(() => {});
|
||||
return new HttpSuccess(command.id);
|
||||
}
|
||||
|
||||
commandTypePath(commandCode: string) {
|
||||
switch (commandCode) {
|
||||
case "C-PM-01":
|
||||
return "/placement/recruit/report";
|
||||
case "C-PM-02":
|
||||
return "/placement/candidate/report";
|
||||
case "C-PM-03":
|
||||
return "/placement/appoint/report";
|
||||
case "C-PM-04":
|
||||
return "/placement/move/report";
|
||||
case "C-PM-05":
|
||||
return "/placement/appointment/appoint/report";
|
||||
case "C-PM-06":
|
||||
return "/placement/appointment/slip/report";
|
||||
case "C-PM-07":
|
||||
return "/placement/appointment/move/report";
|
||||
case "C-PM-08":
|
||||
return "/retirement/other/appoint/report";
|
||||
case "C-PM-09":
|
||||
return "/retirement/other/out/report";
|
||||
case "C-PM-10":
|
||||
return "/xxxxxx";
|
||||
case "C-PM-11":
|
||||
return "/order/command11/report";
|
||||
case "C-PM-12":
|
||||
return "/order/command12/report";
|
||||
case "C-PM-13":
|
||||
return "/placement/transfer/command/report";
|
||||
case "C-PM-14":
|
||||
return "/placement/Receive/command/report";
|
||||
case "C-PM-15":
|
||||
return "/placement/officer/command/report";
|
||||
case "C-PM-16":
|
||||
return "/placement/repatriation/command/report";
|
||||
case "C-PM-17":
|
||||
return "/retirement/resign/command/report";
|
||||
case "C-PM-18":
|
||||
return "/retirement/out/command/report";
|
||||
case "C-PM-19":
|
||||
return "/order/command19/report";
|
||||
case "C-PM-20":
|
||||
return "/order/command20/report";
|
||||
case "C-PM-21":
|
||||
return "/order/command21/report";
|
||||
case "C-PM-22":
|
||||
return "/placement/appointment/employee-appoint/report";
|
||||
case "C-PM-23":
|
||||
return "/retirement/resign/employee/report";
|
||||
case "C-PM-24":
|
||||
return "/placement/appointment/employee-move/report";
|
||||
case "C-PM-25":
|
||||
return "/order/command25/report";
|
||||
case "C-PM-26":
|
||||
return "/order/command26/report";
|
||||
case "C-PM-27":
|
||||
return "/order/command27/report";
|
||||
case "C-PM-28":
|
||||
return "/order/command28/report";
|
||||
case "C-PM-29":
|
||||
return "/order/command29/report";
|
||||
case "C-PM-30":
|
||||
return "/order/command30/report";
|
||||
case "C-PM-31":
|
||||
return "/order/command31/report";
|
||||
case "C-PM-32":
|
||||
return "/order/command32/report";
|
||||
case "C-PM-33":
|
||||
return "/order/command33/report";
|
||||
case "C-PM-34":
|
||||
return "/order/command34/report";
|
||||
case "C-PM-35":
|
||||
return "/order/command35/report";
|
||||
case "C-PM-36":
|
||||
return "/order/command36/report";
|
||||
case "C-PM-37":
|
||||
return "/order/command37/report";
|
||||
case "C-PM-38":
|
||||
return "/order/command38/report";
|
||||
case "C-PM-39":
|
||||
return "/placement/slip/report";
|
||||
case "C-PM-40":
|
||||
return "/order/command40/report";
|
||||
case "C-PM-41":
|
||||
return "/retirement/resign/leave-cancel/report";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -621,7 +621,8 @@ export class OrganizationController extends Controller {
|
|||
// let attrOwnership = null;
|
||||
if (
|
||||
orgRevision.orgRevisionIsDraft == true &&
|
||||
orgRevision.orgRevisionIsCurrent == false
|
||||
orgRevision.orgRevisionIsCurrent == false &&
|
||||
request.user.role.includes("SUPER_ADMIN")
|
||||
// attrOwnership == false
|
||||
) {
|
||||
const profile = await this.profileRepo.findOne({
|
||||
|
|
@ -4786,7 +4787,10 @@ export class OrganizationController extends Controller {
|
|||
child3: null,
|
||||
child4: null,
|
||||
};
|
||||
if (orgRevision.orgRevisionIsDraft == true && orgRevision.orgRevisionIsCurrent == false) {
|
||||
if (
|
||||
(orgRevision.orgRevisionIsDraft == true && orgRevision.orgRevisionIsCurrent == false) ||
|
||||
system != "SYS_ORG"
|
||||
) {
|
||||
_data = await new permission().PermissionOrgList(request, system.trim().toUpperCase());
|
||||
}
|
||||
const orgRootData = await AppDataSource.getRepository(OrgRoot)
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ export class PermissionOrgController extends Controller {
|
|||
*/
|
||||
@Get()
|
||||
async GetActiveRootIdAdmin(@Request() request: RequestWithUser) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
const orgRevisionActive = await this.orgRevisionRepository.findOne({
|
||||
where: { orgRevisionIsCurrent: false, orgRevisionIsDraft: true },
|
||||
});
|
||||
|
|
@ -76,9 +76,9 @@ export class PermissionOrgController extends Controller {
|
|||
searchField?: "fullName" | "position" | "posNo" | "postype" | "poslevel",
|
||||
@Query() searchKeyword: string = "",
|
||||
) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
let queryLike =
|
||||
"CONCAT(profile.prefix, profile.firstName, ' ', profile.lastName) LIKE :keyword";
|
||||
if (searchField == "postype") {
|
||||
|
|
@ -233,9 +233,9 @@ export class PermissionOrgController extends Controller {
|
|||
searchKeyword: string;
|
||||
},
|
||||
) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
let profiles: any = [];
|
||||
if (requestBody.id != null) {
|
||||
const _permissionOrg = await this.orgRootRepository.findOne({
|
||||
|
|
@ -423,9 +423,9 @@ export class PermissionOrgController extends Controller {
|
|||
@Request() request: RequestWithUser,
|
||||
@Body() requestBody: { nodeId: string; personId: string },
|
||||
) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
const orgRoot = await this.orgRootRepository.findOne({
|
||||
where: { id: requestBody.nodeId },
|
||||
});
|
||||
|
|
@ -472,9 +472,9 @@ export class PermissionOrgController extends Controller {
|
|||
*/
|
||||
@Delete("{id}")
|
||||
async Delete(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
}
|
||||
// if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||
// throw new HttpError(HttpStatus.FORBIDDEN, "ไม่มีสิทธิ์ใช้งานระบบนี้");
|
||||
// }
|
||||
// const orgRoot = await this.orgRootRepository.findOne({
|
||||
// where: { id: nodeId },
|
||||
// relations: ["permissionOrgRoots"],
|
||||
|
|
|
|||
|
|
@ -840,9 +840,13 @@ export class PositionController extends Controller {
|
|||
}
|
||||
let _null: any = null;
|
||||
posMaster.isDirector = requestBody.isDirector;
|
||||
posMaster.isStaff = requestBody.isStaff == null || requestBody.isStaff == undefined ? _null : requestBody.isStaff;
|
||||
posMaster.isStaff =
|
||||
requestBody.isStaff == null || requestBody.isStaff == undefined ? _null : requestBody.isStaff;
|
||||
// posMaster.isOfficer = requestBody.isOfficer;
|
||||
posMaster.positionSign = requestBody.positionSign == null || requestBody.positionSign == undefined ? _null : requestBody.positionSign;
|
||||
posMaster.positionSign =
|
||||
requestBody.positionSign == null || requestBody.positionSign == undefined
|
||||
? _null
|
||||
: requestBody.positionSign;
|
||||
posMaster.posMasterNo = requestBody.posMasterNo;
|
||||
posMaster.posMasterNoPrefix = requestBody.posMasterNoPrefix;
|
||||
posMaster.posMasterNoSuffix = requestBody.posMasterNoSuffix;
|
||||
|
|
@ -1101,6 +1105,7 @@ export class PositionController extends Controller {
|
|||
revisionId: string;
|
||||
type: number;
|
||||
isAll: boolean;
|
||||
isBlank: boolean;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
keyword?: string;
|
||||
|
|
@ -1127,6 +1132,9 @@ export class PositionController extends Controller {
|
|||
searchShortName = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
} else {
|
||||
}
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
} else if (body.type === 1) {
|
||||
typeCondition = {
|
||||
orgChild1Id: body.id,
|
||||
|
|
@ -1138,6 +1146,9 @@ export class PositionController extends Controller {
|
|||
searchShortName = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
} else {
|
||||
}
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
} else if (body.type === 2) {
|
||||
typeCondition = {
|
||||
orgChild2Id: body.id,
|
||||
|
|
@ -1149,6 +1160,9 @@ export class PositionController extends Controller {
|
|||
searchShortName = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
} else {
|
||||
}
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
} else if (body.type === 3) {
|
||||
typeCondition = {
|
||||
orgChild3Id: body.id,
|
||||
|
|
@ -1160,11 +1174,17 @@ export class PositionController extends Controller {
|
|||
searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
} else {
|
||||
}
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
} else if (body.type === 4) {
|
||||
typeCondition = {
|
||||
orgChild4Id: body.id,
|
||||
};
|
||||
searchShortName = `CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
|
||||
if (body.isBlank == true) {
|
||||
typeCondition.current_holderId = IsNull();
|
||||
}
|
||||
}
|
||||
let findPosition: any;
|
||||
let masterId = new Array();
|
||||
|
|
|
|||
|
|
@ -3478,7 +3478,6 @@ export class ProfileEmployeeController extends Controller {
|
|||
body: {
|
||||
result: {
|
||||
id: string;
|
||||
personId: string;
|
||||
templateDoc: string;
|
||||
amount: Double | null;
|
||||
positionSalaryAmount: Double | null;
|
||||
|
|
|
|||
|
|
@ -3179,7 +3179,6 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
body: {
|
||||
result: {
|
||||
id: string;
|
||||
personId: string;
|
||||
templateDoc: string;
|
||||
amount: Double | null;
|
||||
positionSalaryAmount: Double | null;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { Entity, Column, JoinColumn, ManyToOne, OneToMany, Double } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Command } from "./Command";
|
||||
import { Profile } from "./Profile";
|
||||
|
||||
@Entity("commandRecive")
|
||||
export class CommandRecive extends EntityBase {
|
||||
|
|
@ -37,22 +36,6 @@ export class CommandRecive extends EntityBase {
|
|||
})
|
||||
lastName: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ตำแหน่ง",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
position: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "หน่วยงาน",
|
||||
length: 255,
|
||||
default: null,
|
||||
})
|
||||
org: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ลำดับแสดงผล",
|
||||
|
|
@ -100,6 +83,14 @@ export class CommandRecive extends EntityBase {
|
|||
})
|
||||
mouthSalaryAmount: Double;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "refId",
|
||||
default: null,
|
||||
})
|
||||
refId: string;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง command",
|
||||
|
|
@ -110,15 +101,25 @@ export class CommandRecive extends EntityBase {
|
|||
@JoinColumn({ name: "commandId" })
|
||||
command: Command;
|
||||
|
||||
@Column({
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
})
|
||||
profileId: string;
|
||||
// @Column({
|
||||
// length: 40,
|
||||
// comment: "คีย์นอก(FK)ของตาราง profile",
|
||||
// })
|
||||
// profileId: string;
|
||||
|
||||
@ManyToOne(() => Profile, (profile) => profile.commandRecives)
|
||||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
// @ManyToOne(() => Profile, (profile) => profile.commandRecives)
|
||||
// @JoinColumn({ name: "profileId" })
|
||||
// profile: Profile;
|
||||
|
||||
// @Column({
|
||||
// length: 40,
|
||||
// comment: "คีย์นอก(FK)ของตาราง profileEmployee",
|
||||
// })
|
||||
// profileEmployeeId: string;
|
||||
|
||||
// @ManyToOne(() => ProfileEmployee, (profileEmployee) => profileEmployee.commandRecives)
|
||||
// @JoinColumn({ name: "profileEmployeeId" })
|
||||
// profileEmployee: ProfileEmployee;
|
||||
}
|
||||
|
||||
export class CreateCommandRecive {
|
||||
|
|
|
|||
|
|
@ -29,10 +29,8 @@ import { ProfileDiscipline } from "./ProfileDiscipline";
|
|||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
import { ProfileEdit } from "./ProfileEdit";
|
||||
import { ProfileDevelopment } from "./ProfileDevelopment";
|
||||
import { OrgRoot } from "./OrgRoot";
|
||||
import { PermissionOrg } from "./PermissionOrg";
|
||||
import { CommandSend } from "./CommandSend";
|
||||
import { CommandRecive } from "./CommandRecive";
|
||||
import { DevelopmentRequest } from "./DevelopmentRequest";
|
||||
|
||||
@Entity("profile")
|
||||
|
|
@ -380,9 +378,6 @@ export class Profile extends EntityBase {
|
|||
@OneToMany(() => CommandSend, (v) => v.profile)
|
||||
commandSends: CommandSend[];
|
||||
|
||||
@OneToMany(() => CommandRecive, (v) => v.profile)
|
||||
commandRecives: CommandRecive[];
|
||||
|
||||
@ManyToOne(() => PosLevel, (posLevel) => posLevel.profiles)
|
||||
@JoinColumn({ name: "posLevelId" })
|
||||
posLevel: PosLevel;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,4 @@
|
|||
import {
|
||||
Entity,
|
||||
Column,
|
||||
OneToMany,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
Double,
|
||||
} from "typeorm";
|
||||
import { Entity, Column, OneToMany, JoinColumn, ManyToOne, Double } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Profile } from "./Profile";
|
||||
import { ProfileEmployee } from "./ProfileEmployee";
|
||||
|
|
@ -174,7 +167,7 @@ export class CreateProfileSalary {
|
|||
positionType: string | null;
|
||||
positionLevel: string | null;
|
||||
refCommandNo: string | null;
|
||||
commandType?: string | null;
|
||||
// commandType?: string | null;
|
||||
templateDoc: string | null;
|
||||
}
|
||||
|
||||
|
|
|
|||
22
src/migration/1727795520589-update_ProfileDevelopment1.ts
Normal file
22
src/migration/1727795520589-update_ProfileDevelopment1.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateProfileDevelopment11727795520589 implements MigrationInterface {
|
||||
name = 'UpdateProfileDevelopment11727795520589'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP FOREIGN KEY \`FK_fb29bfd315d0d43d0b49b362995\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`org\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`position\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`profileId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`refId\` varchar(40) NULL COMMENT 'refId'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`refId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`org\` varchar(255) NULL COMMENT 'หน่วยงาน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD CONSTRAINT \`FK_fb29bfd315d0d43d0b49b362995\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||
}
|
||||
|
||||
}
|
||||
20
src/migration/1727851675456-update_ProfileDevelopment2.ts
Normal file
20
src/migration/1727851675456-update_ProfileDevelopment2.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateProfileDevelopment21727851675456 implements MigrationInterface {
|
||||
name = 'UpdateProfileDevelopment21727851675456'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`lastName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`prefix\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`fullName\` varchar(255) NULL COMMENT 'ชื่อ-สกุล'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`fullName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า'`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`lastName\` varchar(255) NULL COMMENT 'สกุล'`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
|
||||
}
|
||||
|
||||
}
|
||||
20
src/migration/1727852313568-update_ProfileDevelopment3.ts
Normal file
20
src/migration/1727852313568-update_ProfileDevelopment3.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateProfileDevelopment31727852313568 implements MigrationInterface {
|
||||
name = 'UpdateProfileDevelopment31727852313568'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`fullName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า'`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`firstName\` varchar(255) NULL COMMENT 'ชื่อ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`lastName\` varchar(255) NULL COMMENT 'สกุล'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`lastName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`firstName\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`prefix\``);
|
||||
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`fullName\` varchar(255) NULL COMMENT 'ชื่อ-สกุล'`);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue