no message
This commit is contained in:
parent
3634687455
commit
9750b62255
1 changed files with 27 additions and 13 deletions
|
|
@ -1692,6 +1692,7 @@ export class OrganizationController extends Controller {
|
|||
const formattedData = {
|
||||
departmentName: "กรุงเทพมหานคร",
|
||||
deptID: data.id,
|
||||
type: 0,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgRevisionId: data.id },
|
||||
|
|
@ -1729,6 +1730,7 @@ export class OrganizationController extends Controller {
|
|||
return {
|
||||
departmentName: orgRoot.orgRootName,
|
||||
deptID: orgRoot.id,
|
||||
type: 1,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgRevisionId: data.id, orgRootId: orgRoot.id },
|
||||
|
|
@ -1769,6 +1771,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild1) => ({
|
||||
departmentName: orgChild1.orgChild1Name,
|
||||
deptID: orgChild1.id,
|
||||
type: 2,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -1817,6 +1820,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild2) => ({
|
||||
departmentName: orgChild2.orgChild2Name,
|
||||
deptID: orgChild2.id,
|
||||
type: 3,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -1870,6 +1874,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild3) => ({
|
||||
departmentName: orgChild3.orgChild3Name,
|
||||
deptID: orgChild3.id,
|
||||
type: 4,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -1929,9 +1934,9 @@ export class OrganizationController extends Controller {
|
|||
orgChild3.orgChild4s
|
||||
.sort((a, b) => a.orgChild4Order - b.orgChild4Order)
|
||||
.map(async (orgChild4) => ({
|
||||
orgTreeId: orgChild4.id,
|
||||
departmentName: orgChild4.orgChild4Name,
|
||||
deptID: orgChild4.id,
|
||||
type: 5,
|
||||
// heads:
|
||||
totalPositionCount:
|
||||
await this.posMasterRepository.count({
|
||||
|
|
@ -2004,7 +2009,7 @@ export class OrganizationController extends Controller {
|
|||
}),
|
||||
),
|
||||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
return new HttpSuccess([formattedData]);
|
||||
}
|
||||
case 1: {
|
||||
const data = await this.orgRootRepository.findOne({
|
||||
|
|
@ -2024,6 +2029,7 @@ export class OrganizationController extends Controller {
|
|||
const formattedData = {
|
||||
departmentName: data.orgRootName,
|
||||
deptID: data.id,
|
||||
type: 1,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgRootId: data.id },
|
||||
|
|
@ -2061,6 +2067,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild1) => ({
|
||||
departmentName: orgChild1.orgChild1Name,
|
||||
deptID: orgChild1.id,
|
||||
type: 2,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgRootId: data.id, orgChild1Id: orgChild1.id },
|
||||
|
|
@ -2101,6 +2108,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild2) => ({
|
||||
departmentName: orgChild2.orgChild2Name,
|
||||
deptID: orgChild2.id,
|
||||
type: 3,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -2149,6 +2157,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild3) => ({
|
||||
departmentName: orgChild3.orgChild3Name,
|
||||
deptID: orgChild3.id,
|
||||
type: 4,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -2200,9 +2209,9 @@ export class OrganizationController extends Controller {
|
|||
orgChild3.orgChild4s
|
||||
.sort((a, b) => a.orgChild4Order - b.orgChild4Order)
|
||||
.map(async (orgChild4) => ({
|
||||
orgTreeId: orgChild4.id,
|
||||
departmentName: orgChild4.orgChild4Name,
|
||||
deptID: orgChild4.id,
|
||||
type: 5,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -2265,7 +2274,7 @@ export class OrganizationController extends Controller {
|
|||
})),
|
||||
),
|
||||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
return new HttpSuccess([formattedData]);
|
||||
}
|
||||
case 2: {
|
||||
const data = await this.child1Repository.findOne({
|
||||
|
|
@ -2284,6 +2293,7 @@ export class OrganizationController extends Controller {
|
|||
const formattedData = {
|
||||
departmentName: data.orgChild1Name,
|
||||
deptID: data.id,
|
||||
type: 2,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgRevisionId: data.id },
|
||||
|
|
@ -2321,6 +2331,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild2) => ({
|
||||
departmentName: orgChild2.orgChild2Name,
|
||||
deptID: orgChild2.id,
|
||||
type: 3,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgChild1Id: data.id, orgChild2Id: orgChild2.id },
|
||||
|
|
@ -2361,6 +2372,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild3) => ({
|
||||
departmentName: orgChild3.orgChild3Name,
|
||||
deptID: orgChild3.id,
|
||||
type: 4,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -2407,9 +2419,9 @@ export class OrganizationController extends Controller {
|
|||
orgChild3.orgChild4s
|
||||
.sort((a, b) => a.orgChild4Order - b.orgChild4Order)
|
||||
.map(async (orgChild4) => ({
|
||||
orgTreeId: orgChild4.id,
|
||||
departmentName: orgChild4.orgChild4Name,
|
||||
deptID: orgChild4.id,
|
||||
type: 5,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -2464,7 +2476,7 @@ export class OrganizationController extends Controller {
|
|||
})),
|
||||
),
|
||||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
return new HttpSuccess([formattedData]);
|
||||
}
|
||||
case 3: {
|
||||
const data = await this.child2Repository.findOne({
|
||||
|
|
@ -2478,6 +2490,7 @@ export class OrganizationController extends Controller {
|
|||
const formattedData = {
|
||||
departmentName: data.orgChild2Name,
|
||||
deptID: data.id,
|
||||
type: 3,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgChild2Id: data.id },
|
||||
|
|
@ -2515,6 +2528,7 @@ export class OrganizationController extends Controller {
|
|||
.map(async (orgChild3) => ({
|
||||
departmentName: orgChild3.orgChild3Name,
|
||||
deptID: orgChild3.id,
|
||||
type: 4,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgChild2Id: data.id, orgChild3Id: orgChild3.id },
|
||||
|
|
@ -2553,9 +2567,9 @@ export class OrganizationController extends Controller {
|
|||
orgChild3.orgChild4s
|
||||
.sort((a, b) => a.orgChild4Order - b.orgChild4Order)
|
||||
.map(async (orgChild4) => ({
|
||||
orgTreeId: orgChild4.id,
|
||||
departmentName: orgChild4.orgChild4Name,
|
||||
deptID: orgChild4.id,
|
||||
type: 5,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: {
|
||||
|
|
@ -2603,7 +2617,7 @@ export class OrganizationController extends Controller {
|
|||
})),
|
||||
),
|
||||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
return new HttpSuccess([formattedData]);
|
||||
}
|
||||
case 4: {
|
||||
const data = await this.child3Repository.findOne({
|
||||
|
|
@ -2615,9 +2629,9 @@ export class OrganizationController extends Controller {
|
|||
}
|
||||
|
||||
const formattedData = {
|
||||
orgTreeId: data.id,
|
||||
departmentName: data.orgChild3Name,
|
||||
deptID: data.id,
|
||||
type: 4,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgChild3Id: data.id },
|
||||
|
|
@ -2653,9 +2667,9 @@ export class OrganizationController extends Controller {
|
|||
data.orgChild4s
|
||||
.sort((a, b) => a.orgChild4Order - b.orgChild4Order)
|
||||
.map(async (orgChild4) => ({
|
||||
orgTreeId: orgChild4.id,
|
||||
departmentName: orgChild4.orgChild4Name,
|
||||
deptID: orgChild4.id,
|
||||
type: 5,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgChild3Id: data.id, orgChild4Id: orgChild4.id },
|
||||
|
|
@ -2693,7 +2707,7 @@ export class OrganizationController extends Controller {
|
|||
})),
|
||||
),
|
||||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
return new HttpSuccess([formattedData]);
|
||||
}
|
||||
case 5: {
|
||||
const data = await this.child4Repository.findOne({
|
||||
|
|
@ -2705,9 +2719,9 @@ export class OrganizationController extends Controller {
|
|||
}
|
||||
|
||||
const formattedData = {
|
||||
orgTreeId: data.id,
|
||||
departmentName: data.orgChild4Name,
|
||||
deptID: data.id,
|
||||
type: 5,
|
||||
// heads:
|
||||
totalPositionCount: await this.posMasterRepository.count({
|
||||
where: { orgChild4Id: data.id },
|
||||
|
|
@ -2739,7 +2753,7 @@ export class OrganizationController extends Controller {
|
|||
// },
|
||||
// }),
|
||||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
return new HttpSuccess([formattedData]);
|
||||
}
|
||||
default:
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found type: ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue