orgTreeOrder เพิ่มหน่วยงาน
This commit is contained in:
parent
145e64b655
commit
019ded1aa3
5 changed files with 35 additions and 0 deletions
|
|
@ -134,6 +134,12 @@ export class OrgChild4Controller extends Controller {
|
|||
if (!validOrgChild4Ranks.includes(requestBody.orgChild4Rank.toUpperCase())) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgChild4Rank");
|
||||
}
|
||||
const order:any = await this.child4Repository.findOne({
|
||||
where: {
|
||||
orgChild3Id: requestBody.orgChild3Id
|
||||
},
|
||||
order: { orgChild4Order: "DESC" }
|
||||
})
|
||||
try {
|
||||
const child4 = Object.assign(new OrgChild4(), requestBody) as OrgChild4;
|
||||
child4.orgChild4Name = requestBody.orgChild4Name;
|
||||
|
|
@ -146,6 +152,7 @@ export class OrgChild4Controller extends Controller {
|
|||
child4.orgChild2Id = String(child3?.orgChild2Id);
|
||||
child4.orgRevisionId = String(child3?.orgRevisionId);
|
||||
child4.orgChild3Id = String(child3?.id);
|
||||
child4.orgChild4Order = order.orgChild4Order == null ? 1 : order.orgChild4Order+1;
|
||||
await this.child4Repository.save(child4);
|
||||
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue