แก้ ค้นหา ทะเบียน

This commit is contained in:
kittapath 2024-08-29 17:57:34 +07:00
parent e6c5404b89
commit 6d36c9b05f
3 changed files with 42 additions and 32 deletions

View file

@ -3893,9 +3893,9 @@ export class OrganizationController extends Controller {
.where("orgChild1.orgRootId IN (:...ids)", { ids: orgRootIds })
.andWhere(
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `orgChild1.id IN (:...node)`
: `orgChild1.id is null`
? _data.child1[0] != null
? `orgChild1.id IN (:...node)`
: `orgChild1.id is null`
: "1=1",
{
node: _data.child1,
@ -3927,9 +3927,9 @@ export class OrganizationController extends Controller {
.where("orgChild2.orgChild1Id IN (:...ids)", { ids: orgChild1Ids })
.andWhere(
_data.child2 != undefined && _data.child2 != null
? _data.child2[0] != null
? `orgChild2.id IN (:...node)`
: `orgChild2.id is null`
? _data.child2[0] != null
? `orgChild2.id IN (:...node)`
: `orgChild2.id is null`
: "1=1",
{
node: _data.child2,
@ -3962,9 +3962,9 @@ export class OrganizationController extends Controller {
.where("orgChild3.orgChild2Id IN (:...ids)", { ids: orgChild2Ids })
.andWhere(
_data.child3 != undefined && _data.child3 != null
? _data.child3[0] != null
? `orgChild3.id IN (:...node)`
: `orgChild3.id is null`
? _data.child3[0] != null
? `orgChild3.id IN (:...node)`
: `orgChild3.id is null`
: "1=1",
{
node: _data.child3,
@ -3997,9 +3997,9 @@ export class OrganizationController extends Controller {
.where("orgChild4.orgChild3Id IN (:...ids)", { ids: orgChild3Ids })
.andWhere(
_data.child4 != undefined && _data.child4 != null
? _data.child4[0] != null
? `orgChild4.id IN (:...node)`
: `orgChild4.id is null`
? _data.child4[0] != null
? `orgChild4.id IN (:...node)`
: `orgChild4.id is null`
: "1=1",
{
node: _data.child4,

View file

@ -2637,42 +2637,52 @@ export class ProfileController extends Controller {
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
.andWhere(
_data.root != undefined && _data.root != null
? (_data.root[0] !=null ? `current_holders.orgRootId = :root` : `current_holders.orgRootId is null`)
? _data.root[0] != null
? `current_holders.orgRootId IN (:...root)`
: `current_holders.orgRootId is null`
: "1=1",
{
root: _data.root[0],
root: _data.root,
},
)
.andWhere(
_data.child1 != undefined && _data.child1 != null
? (_data.child1[0] !=null ? `current_holders.orgChild1Id = :child1` : `current_holders.orgChild1Id is null`)
? _data.child1[0] != null
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1[0],
child1: _data.child1,
},
)
.andWhere(
_data.child2 != undefined && _data.child2 != null
? (_data.child2[0] !=null ? `current_holders.orgChild2Id = :child2` : `current_holders.orgChild2Id is null`)
? _data.child2[0] != null
? `current_holders.orgChild2Id IN (:...child2)`
: `current_holders.orgChild2Id is null`
: "1=1",
{
child2: _data.child2[0],
child2: _data.child2,
},
)
.andWhere(
_data.child3 != undefined && _data.child3 != null
? (_data.child3[0] !=null ? `current_holders.orgChild3Id = :child3` : `current_holders.orgChild3Id is null`)
? _data.child3[0] != null
? `current_holders.orgChild3Id IN (:...child3)`
: `current_holders.orgChild3Id is null`
: "1=1",
{
child3: _data.child3[0],
child3: _data.child3,
},
)
.andWhere(
_data.child4 != undefined && _data.child4 != null
? (_data.child4[0] !=null ? `current_holders.orgChild4Id = :child4` : `current_holders.orgChild4Id is null`)
? _data.child4[0] != null
? `current_holders.orgChild4Id IN (:...child4)`
: `current_holders.orgChild4Id is null`
: "1=1",
{
child4: _data.child4[0],
child4: _data.child4,
},
)
.andWhere(

View file

@ -1134,51 +1134,51 @@ export class ProfileEmployeeController extends Controller {
.andWhere(
_data.root != undefined && _data.root != null
? _data.root[0] != null
? `current_holders.orgRootId = :root`
? `current_holders.orgRootId IN (:...root)`
: `current_holders.orgRootId is null`
: "1=1",
{
root: _data.root[0],
root: _data.root,
},
)
.andWhere(
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `current_holders.orgChild1Id = :child1`
? `current_holders.orgChild1Id IN (:...child1)`
: `current_holders.orgChild1Id is null`
: "1=1",
{
child1: _data.child1[0],
child1: _data.child1,
},
)
.andWhere(
_data.child2 != undefined && _data.child2 != null
? _data.child2[0] != null
? `current_holders.orgChild2Id = :child2`
? `current_holders.orgChild2Id IN (:...child2)`
: `current_holders.orgChild2Id is null`
: "1=1",
{
child2: _data.child2[0],
child2: _data.child2,
},
)
.andWhere(
_data.child3 != undefined && _data.child3 != null
? _data.child3[0] != null
? `current_holders.orgChild3Id = :child3`
? `current_holders.orgChild3Id IN (:...child3)`
: `current_holders.orgChild3Id is null`
: "1=1",
{
child3: _data.child3[0],
child3: _data.child3,
},
)
.andWhere(
_data.child4 != undefined && _data.child4 != null
? _data.child4[0] != null
? `current_holders.orgChild4Id = :child4`
? `current_holders.orgChild4Id IN (:...child4)`
: `current_holders.orgChild4Id is null`
: "1=1",
{
child4: _data.child4[0],
child4: _data.child4,
},
)
.andWhere(