orgTreeOrder เพิ่มหน่วยงาน
This commit is contained in:
parent
145e64b655
commit
019ded1aa3
5 changed files with 35 additions and 0 deletions
|
|
@ -130,6 +130,12 @@ export class OrgChild1Controller {
|
|||
if (chkCode != null) {
|
||||
throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, "รหัสหน่วยงานนี้มีอยู่ในระบบแล้ว");
|
||||
}
|
||||
const order:any = await this.child1Repository.findOne({
|
||||
where: {
|
||||
orgRootId: requestBody.orgRootId
|
||||
},
|
||||
order: { orgChild1Order: "DESC" }
|
||||
})
|
||||
try {
|
||||
const child1 = Object.assign(new OrgChild1(), requestBody) as OrgChild1;
|
||||
child1.orgChild1Name = requestBody.orgChild1Name;
|
||||
|
|
@ -139,6 +145,7 @@ export class OrgChild1Controller {
|
|||
child1.lastUpdateFullName = request.user.name;
|
||||
child1.orgRevisionId = String(rootIdExits?.orgRevisionId);
|
||||
child1.orgRootId = String(rootIdExits?.id);
|
||||
child1.orgChild1Order = order.orgChild1Order == null ? 1 : order.orgChild1Order+1;
|
||||
await this.child1Repository.save(child1);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue