orgTreeOrder เพิ่มหน่วยงาน
This commit is contained in:
parent
145e64b655
commit
019ded1aa3
5 changed files with 35 additions and 0 deletions
|
|
@ -136,6 +136,12 @@ export class OrgChild2Controller extends Controller {
|
|||
if (!validOrgChild2Ranks.includes(requestBody.orgChild2Rank.toUpperCase())) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. orgChild2Rank");
|
||||
}
|
||||
const order:any = await this.child2Repository.findOne({
|
||||
where: {
|
||||
orgChild1Id: requestBody.orgChild1Id
|
||||
},
|
||||
order: { orgChild2Order: "DESC" }
|
||||
})
|
||||
try {
|
||||
const child2 = Object.assign(new OrgChild2(), requestBody) as OrgChild2;
|
||||
child2.orgChild2Name = requestBody.orgChild2Name;
|
||||
|
|
@ -146,6 +152,7 @@ export class OrgChild2Controller extends Controller {
|
|||
child2.orgRootId = String(child1?.orgRootId);
|
||||
child2.orgRevisionId = String(child1?.orgRevisionId);
|
||||
child2.orgChild1Id = String(child1?.id);
|
||||
child2.orgChild2Order = order.orgChild2Order == null ? 1 : order.orgChild2Order+1;
|
||||
await this.child2Repository.save(child2);
|
||||
return new HttpSuccess();
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue