search กำหนดสิทธิ์

This commit is contained in:
kittapath 2025-03-15 04:43:24 +07:00
parent c102857dc2
commit aed9691019
2 changed files with 90 additions and 176 deletions

View file

@ -1543,9 +1543,6 @@ export class PositionController extends Controller {
searchShortName = `CONCAT(orgRoot.orgRootShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} else {
}
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.type === 1) {
typeCondition = {
orgChild1Id: body.id,
@ -1557,9 +1554,6 @@ export class PositionController extends Controller {
searchShortName = `CONCAT(orgChild1.orgChild1ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} else {
}
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.type === 2) {
typeCondition = {
orgChild2Id: body.id,
@ -1571,9 +1565,6 @@ export class PositionController extends Controller {
searchShortName = `CONCAT(orgChild2.orgChild2ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} else {
}
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.type === 3) {
typeCondition = {
orgChild3Id: body.id,
@ -1585,21 +1576,18 @@ export class PositionController extends Controller {
searchShortName = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
} else {
}
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.type === 4) {
typeCondition = {
orgChild4Id: body.id,
};
searchShortName = `CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix) like '%${body.keyword}%'`;
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
}
} else {
body.isAll = true;
}
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
let findPosition: any;
let masterId = new Array();
let _authRoleId = new Array();
@ -3642,79 +3630,52 @@ export class PositionController extends Controller {
orgRootId: body.nodeId,
orgChild1Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 1) {
typeCondition = {
orgChild1Id: body.nodeId,
orgChild2Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 2) {
typeCondition = {
orgChild2Id: body.nodeId,
orgChild3Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 3) {
typeCondition = {
orgChild3Id: body.nodeId,
orgChild4Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 4) {
typeCondition = {
orgChild4Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
}
} else {
if (body.node === 0) {
typeCondition = {
orgRootId: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 1) {
typeCondition = {
orgChild1Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 2) {
typeCondition = {
orgChild2Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 3) {
typeCondition = {
orgChild3Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 4) {
typeCondition = {
orgChild4Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
}
}
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
const [posMaster, total] = await AppDataSource.getRepository(PosMaster)
.createQueryBuilder("posMaster")
@ -3930,79 +3891,52 @@ export class PositionController extends Controller {
orgRootId: body.nodeId,
orgChild1Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 1) {
typeCondition = {
orgChild1Id: body.nodeId,
orgChild2Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 2) {
typeCondition = {
orgChild2Id: body.nodeId,
orgChild3Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 3) {
typeCondition = {
orgChild3Id: body.nodeId,
orgChild4Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 4) {
typeCondition = {
orgChild4Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
}
} else {
if (body.node === 0) {
typeCondition = {
orgRootId: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 1) {
typeCondition = {
orgChild1Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 2) {
typeCondition = {
orgChild2Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 3) {
typeCondition = {
orgChild3Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 4) {
typeCondition = {
orgChild4Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
}
}
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
const [posMaster, total] = await AppDataSource.getRepository(PosMaster)
.createQueryBuilder("posMaster")
@ -4186,79 +4120,52 @@ export class PositionController extends Controller {
orgRootId: body.nodeId,
orgChild1Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 1) {
typeCondition = {
orgChild1Id: body.nodeId,
orgChild2Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 2) {
typeCondition = {
orgChild2Id: body.nodeId,
orgChild3Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 3) {
typeCondition = {
orgChild3Id: body.nodeId,
orgChild4Id: IsNull(),
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 4) {
typeCondition = {
orgChild4Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
}
} else {
if (body.node === 0) {
typeCondition = {
orgRootId: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 1) {
typeCondition = {
orgChild1Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 2) {
typeCondition = {
orgChild2Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 3) {
typeCondition = {
orgChild3Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
} else if (body.node === 4) {
typeCondition = {
orgChild4Id: body.nodeId,
};
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
}
}
if (body.isBlank == true) {
typeCondition.current_holderId = IsNull();
}
const [posMaster, total] = await AppDataSource.getRepository(EmployeePosMaster)
.createQueryBuilder("posMaster")
@ -4383,9 +4290,10 @@ export class PositionController extends Controller {
posTypeId: position.posTypeId,
posTypeName: position.posType == null ? null : position.posType.posTypeName,
posLevelId: position.posLevelId,
posLevelName: position.posType == null && position.posLevel == null
? null
: `${position.posType.posTypeShortName} ${position.posLevel.posLevelName}`,
posLevelName:
position.posType == null && position.posLevel == null
? null
: `${position.posType.posTypeShortName} ${position.posLevel.posLevelName}`,
// posExecutiveId: position.posExecutiveId,
// posExecutiveName:
// position.posExecutive == null ? null : position.posExecutive.posExecutiveName,