parent
1f0c6cb192
commit
942c88a961
2 changed files with 129 additions and 90 deletions
|
|
@ -4968,10 +4968,8 @@ export class PositionController extends Controller {
|
|||
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||
.where(conditions)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
_data.root != undefined && _data.root != null
|
||||
.andWhere(
|
||||
_data.root != undefined && _data.root != null
|
||||
? _data.root[0] != null
|
||||
? `posMaster.orgRootId IN (:...root)`
|
||||
: `posMaster.orgRootId is null`
|
||||
|
|
@ -4979,14 +4977,9 @@ export class PositionController extends Controller {
|
|||
{
|
||||
root: _data.root,
|
||||
},
|
||||
)
|
||||
.andWhere(conditions)
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
_data.child1 != undefined && _data.child1 != null
|
||||
.andWhere(
|
||||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `posMaster.orgChild1Id IN (:...child1)`
|
||||
: `posMaster.orgChild1Id is null`
|
||||
|
|
@ -4994,14 +4987,9 @@ export class PositionController extends Controller {
|
|||
{
|
||||
child1: _data.child1,
|
||||
},
|
||||
)
|
||||
.andWhere(conditions)
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
_data.child2 != undefined && _data.child2 != null
|
||||
.andWhere(
|
||||
_data.child2 != undefined && _data.child2 != null
|
||||
? _data.child2[0] != null
|
||||
? `posMaster.orgChild2Id IN (:...child2)`
|
||||
: `posMaster.orgChild2Id is null`
|
||||
|
|
@ -5009,29 +4997,19 @@ export class PositionController extends Controller {
|
|||
{
|
||||
child2: _data.child2,
|
||||
},
|
||||
)
|
||||
.andWhere(conditions)
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
_data.child3 != undefined && _data.child3 != null
|
||||
? _data.child3[0] != null
|
||||
? `posMaster.orgChild3Id IN (:...child3)`
|
||||
: `posMaster.orgChild3Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child3: _data.child3,
|
||||
},
|
||||
)
|
||||
.andWhere(conditions)
|
||||
}),
|
||||
.andWhere(
|
||||
_data.child3 != undefined && _data.child3 != null
|
||||
? _data.child3[0] != null
|
||||
? `posMaster.orgChild3Id IN (:...child3)`
|
||||
: `posMaster.orgChild3Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child3: _data.child3,
|
||||
},
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
_data.child4 != undefined && _data.child4 != null
|
||||
.andWhere(
|
||||
_data.child4 != undefined && _data.child4 != null
|
||||
? _data.child4[0] != null
|
||||
? `posMaster.orgChild4Id IN (:...child4)`
|
||||
: `posMaster.orgChild4Id is null`
|
||||
|
|
@ -5039,48 +5017,6 @@ export class PositionController extends Controller {
|
|||
{
|
||||
child4: _data.child4,
|
||||
},
|
||||
)
|
||||
.andWhere(conditions)
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `current_holder.posType LIKE :keyword`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(conditions)
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `current_holder.posLevel LIKE :keyword`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(conditions)
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
body.keyword != null && body.keyword != ""
|
||||
? `current_holder.position LIKE :keyword`
|
||||
: "1=1",
|
||||
{
|
||||
keyword: `%${body.keyword}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(conditions)
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
|
|
@ -5091,7 +5027,10 @@ export class PositionController extends Controller {
|
|||
: `CASE WHEN posMaster.orgChild1 is null THEN ${searchShortName0} WHEN posMaster.orgChild2 is null THEN ${searchShortName1} WHEN posMaster.orgChild3 is null THEN ${searchShortName2} WHEN posMaster.orgChild4 is null THEN ${searchShortName3} ELSE ${searchShortName4} END LIKE '%${body.keyword}%'`
|
||||
: "1=1",
|
||||
)
|
||||
.andWhere(conditions)
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition)
|
||||
.andWhere({ current_holderId: IsNull() });
|
||||
}),
|
||||
)
|
||||
.orderBy("posMaster.posMasterOrder", "ASC")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue