This commit is contained in:
parent
6a43edef46
commit
aa2831307b
2 changed files with 109 additions and 16 deletions
|
|
@ -2355,6 +2355,7 @@ export class PositionController extends Controller {
|
|||
.addOrderBy("orgChild3.orgChild3Order", "ASC")
|
||||
.addOrderBy("orgChild4.orgChild4Order", "ASC")
|
||||
.addOrderBy("posMaster.posMasterOrder", "ASC")
|
||||
.addOrderBy("posMaster.createdAt", "ASC")
|
||||
.skip((body.page - 1) * body.pageSize)
|
||||
.take(body.pageSize)
|
||||
.getManyAndCount();
|
||||
|
|
|
|||
|
|
@ -691,7 +691,13 @@ export class ReportController extends Controller {
|
|||
// ดึงข้อมูล orgRoot ตาม nodeId และลูกทั้งหมด (cascade 0..4)
|
||||
const orgRootData = await this.orgRootRepository.find({
|
||||
where: { id: _nodeId },
|
||||
order: { orgRootOrder: "ASC" },
|
||||
order: {
|
||||
orgRootOrder: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -708,7 +714,13 @@ export class ReportController extends Controller {
|
|||
const orgRootIds = orgRootData.map((r) => r.id) || null;
|
||||
const orgChild1Data = await this.child1Repository.find({
|
||||
where: { orgRootId: In(orgRootIds) },
|
||||
order: { orgChild1Order: "ASC" },
|
||||
order: {
|
||||
orgChild1Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -720,7 +732,13 @@ export class ReportController extends Controller {
|
|||
const orgChild1Ids = orgChild1Data.map((c) => c.id) || null;
|
||||
const orgChild2Data = await this.child2Repository.find({
|
||||
where: { orgChild1: In(orgChild1Ids) },
|
||||
order: { orgChild2Order: "ASC" },
|
||||
order: {
|
||||
orgChild2Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -732,7 +750,13 @@ export class ReportController extends Controller {
|
|||
const orgChild2Ids = orgChild2Data.map((c) => c.id) || null;
|
||||
const orgChild3Data = await this.child3Repository.find({
|
||||
where: { orgChild2: In(orgChild2Ids) },
|
||||
order: { orgChild3Order: "ASC" },
|
||||
order: {
|
||||
orgChild3Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -744,7 +768,13 @@ export class ReportController extends Controller {
|
|||
const orgChild3Ids = orgChild3Data.map((c) => c.id) || null;
|
||||
const orgChild4Data = await this.child4Repository.find({
|
||||
where: { orgChild3: In(orgChild3Ids) },
|
||||
order: { orgChild4Order: "ASC" },
|
||||
order: {
|
||||
orgChild4Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -1348,7 +1378,13 @@ export class ReportController extends Controller {
|
|||
// ดึง orgChild1 และลูก (orgChild2, orgChild3, orgChild4)
|
||||
const orgChild1Data = await this.child1Repository.find({
|
||||
where: { id: _nodeId },
|
||||
order: { orgChild1Order: "ASC" },
|
||||
order: {
|
||||
orgChild1Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -1365,7 +1401,13 @@ export class ReportController extends Controller {
|
|||
const orgChild1Ids = orgChild1Data.map((c) => c.id) || null;
|
||||
const orgChild2Data = await this.child2Repository.find({
|
||||
where: { orgChild1: In(orgChild1Ids) },
|
||||
order: { orgChild2Order: "ASC" },
|
||||
order: {
|
||||
orgChild2Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -1377,7 +1419,13 @@ export class ReportController extends Controller {
|
|||
const orgChild2Ids = orgChild2Data.map((c) => c.id) || null;
|
||||
const orgChild3Data = await this.child3Repository.find({
|
||||
where: { orgChild2: In(orgChild2Ids) },
|
||||
order: { orgChild3Order: "ASC" },
|
||||
order: {
|
||||
orgChild3Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -1389,7 +1437,13 @@ export class ReportController extends Controller {
|
|||
const orgChild3Ids = orgChild3Data.map((c) => c.id) || null;
|
||||
const orgChild4Data = await this.child4Repository.find({
|
||||
where: { orgChild3: In(orgChild3Ids) },
|
||||
order: { orgChild4Order: "ASC" },
|
||||
order: {
|
||||
orgChild4Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -1869,8 +1923,16 @@ export class ReportController extends Controller {
|
|||
case 2: {
|
||||
// ดึง orgChild2 และลูก (orgChild3, orgChild4)
|
||||
const orgChild2Data = await this.child2Repository.find({
|
||||
where: { id: _nodeId },
|
||||
order: { orgChild2Order: "ASC" },
|
||||
where: {
|
||||
id: _nodeId,
|
||||
},
|
||||
order: {
|
||||
orgChild2Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -1887,7 +1949,13 @@ export class ReportController extends Controller {
|
|||
const orgChild2Ids = orgChild2Data.map((c) => c.id) || null;
|
||||
const orgChild3Data = await this.child3Repository.find({
|
||||
where: { orgChild2: In(orgChild2Ids) },
|
||||
order: { orgChild3Order: "ASC" },
|
||||
order: {
|
||||
orgChild3Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -1899,7 +1967,13 @@ export class ReportController extends Controller {
|
|||
const orgChild3Ids = orgChild3Data.map((c) => c.id) || null;
|
||||
const orgChild4Data = await this.child4Repository.find({
|
||||
where: { orgChild3: In(orgChild3Ids) },
|
||||
order: { orgChild4Order: "ASC" },
|
||||
order: {
|
||||
orgChild4Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -2263,7 +2337,13 @@ export class ReportController extends Controller {
|
|||
// ดึง orgChild3 และลูก (orgChild4)
|
||||
const orgChild3Data = await this.child3Repository.find({
|
||||
where: { id: _nodeId },
|
||||
order: { orgChild3Order: "ASC" },
|
||||
order: {
|
||||
orgChild3Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -2280,7 +2360,13 @@ export class ReportController extends Controller {
|
|||
const orgChild3Ids = orgChild3Data.map((c) => c.id) || null;
|
||||
const orgChild4Data = await this.child4Repository.find({
|
||||
where: { orgChild3: In(orgChild3Ids) },
|
||||
order: { orgChild4Order: "ASC" },
|
||||
order: {
|
||||
orgChild4Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
@ -2527,7 +2613,13 @@ export class ReportController extends Controller {
|
|||
// ดึงข้อมูล orgChild4 ตาม nodeId
|
||||
const orgChild4Data = await this.child4Repository.find({
|
||||
where: { id: _nodeId },
|
||||
order: { orgChild4Order: "ASC" },
|
||||
order: {
|
||||
orgChild4Order: "ASC",
|
||||
posMasters:{
|
||||
posMasterOrder: "ASC",
|
||||
createdAt: "ASC"
|
||||
}
|
||||
},
|
||||
relations: [
|
||||
"posMasters",
|
||||
"posMasters.positions",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue