แก้สิทธิ์ list

This commit is contained in:
kittapath 2024-08-29 14:41:48 +07:00
parent 51eaf6b976
commit e6c5404b89
3 changed files with 60 additions and 26 deletions

View file

@ -609,7 +609,11 @@ export class OrganizationController extends Controller {
.createQueryBuilder("orgRoot")
.where("orgRoot.orgRevisionId = :id", { id })
.andWhere(
_data.root != undefined && _data.root != null ? `orgRoot.id IN (:...node)` : "1=1",
_data.root != undefined && _data.root != null
? _data.root[0] != null
? `orgRoot.id IN (:...node)`
: `orgRoot.id is null`
: "1=1",
{
node: _data.root,
},
@ -638,7 +642,9 @@ export class OrganizationController extends Controller {
.where("orgChild1.orgRootId IN (:...ids)", { ids: orgRootIds })
.andWhere(
_data.child1 != undefined && _data.child1 != null
? `orgChild1.id IN (:...node)`
? _data.child1[0] != null
? `orgChild1.id IN (:...node)`
: `orgChild1.id is null`
: "1=1",
{
node: _data.child1,
@ -670,7 +676,9 @@ export class OrganizationController extends Controller {
.where("orgChild2.orgChild1Id IN (:...ids)", { ids: orgChild1Ids })
.andWhere(
_data.child2 != undefined && _data.child2 != null
? `orgChild2.id IN (:...node)`
? _data.child2[0] != null
? `orgChild2.id IN (:...node)`
: `orgChild2.id is null`
: "1=1",
{
node: _data.child2,
@ -703,7 +711,9 @@ export class OrganizationController extends Controller {
.where("orgChild3.orgChild2Id IN (:...ids)", { ids: orgChild2Ids })
.andWhere(
_data.child3 != undefined && _data.child3 != null
? `orgChild3.id IN (:...node)`
? _data.child3[0] != null
? `orgChild3.id IN (:...node)`
: `orgChild3.id is null`
: "1=1",
{
node: _data.child3,
@ -736,7 +746,9 @@ export class OrganizationController extends Controller {
.where("orgChild4.orgChild3Id IN (:...ids)", { ids: orgChild3Ids })
.andWhere(
_data.child4 != undefined && _data.child4 != null
? `orgChild4.id IN (:...node)`
? _data.child4[0] != null
? `orgChild4.id IN (:...node)`
: `orgChild4.id is null`
: "1=1",
{
node: _data.child4,
@ -3848,7 +3860,11 @@ export class OrganizationController extends Controller {
.createQueryBuilder("orgRoot")
.where("orgRoot.orgRevisionId = :id", { id })
.andWhere(
_data.root != undefined && _data.root != null ? `orgRoot.id IN (:...node)` : "1=1",
_data.root != undefined && _data.root != null
? _data.root[0] != null
? `orgRoot.id IN (:...node)`
: `orgRoot.id is null`
: "1=1",
{
node: _data.root,
},
@ -3877,7 +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`
: "1=1",
{
node: _data.child1,
@ -3909,7 +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`
: "1=1",
{
node: _data.child2,
@ -3942,7 +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`
: "1=1",
{
node: _data.child3,
@ -3975,7 +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`
: "1=1",
{
node: _data.child4,