Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop
# Conflicts: # src/controllers/PositionController.ts
This commit is contained in:
commit
acb3434154
1 changed files with 23 additions and 13 deletions
|
|
@ -1411,6 +1411,8 @@ export class PositionController extends Controller {
|
|||
}
|
||||
let findPosition: any;
|
||||
let masterId = new Array();
|
||||
let _authRoleId = new Array();
|
||||
let _exitsRole = false;
|
||||
if (body.keyword != null && body.keyword != "") {
|
||||
const findTypes: PosType[] = await this.posTypeRepository.find({
|
||||
where: { posTypeName: Like(`%${body.keyword}%`) },
|
||||
|
|
@ -1449,6 +1451,17 @@ export class PositionController extends Controller {
|
|||
keywordAsInt = "P@ssw0rd!z";
|
||||
}
|
||||
masterId = [...new Set(masterId)];
|
||||
|
||||
//serch name สิทธิ์
|
||||
_authRoleId = await this.authRoleRepo.find({
|
||||
where: {
|
||||
roleName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
});
|
||||
if (_authRoleId.length > 0) {
|
||||
_exitsRole = true;
|
||||
_authRoleId = [...new Set(_authRoleId.map((x) => x.id))];
|
||||
}
|
||||
}
|
||||
|
||||
const revisionCondition = {
|
||||
|
|
@ -1477,11 +1490,20 @@ export class PositionController extends Controller {
|
|||
.leftJoinAndSelect("posMaster.next_holder", "next_holder")
|
||||
.leftJoinAndSelect("posMaster.orgRevision", "orgRevision")
|
||||
.leftJoinAndSelect("posMaster.posMasterAssigns", "posMasterAssigns")
|
||||
// .leftJoinAndSelect("posMaster.authRole", "authRole")
|
||||
.leftJoinAndSelect("posMasterAssigns.assign", "assign")
|
||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||
.where(conditions)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
if (body.keyword != null && body.keyword != "" && _exitsRole) {
|
||||
qb.andWhere("posMaster.authRoleId IN (:...authRoleId)", { authRoleId: _authRoleId })
|
||||
.andWhere(checkChildConditions)
|
||||
.andWhere(typeCondition)
|
||||
.andWhere(revisionCondition);
|
||||
}
|
||||
}),
|
||||
)
|
||||
.orWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.andWhere(
|
||||
|
|
@ -1591,18 +1613,6 @@ export class PositionController extends Controller {
|
|||
.take(body.pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
//serch name สิทธิ์
|
||||
// if(posMaster.length == 0 && body.keyword != null && body.keyword != "") {
|
||||
// let _authRole:any;
|
||||
// let _masterIdRole:any
|
||||
// _authRole = await this.authRoleRepo.find({
|
||||
// where: {
|
||||
// roleName: Like(`%${body.keyword}%`),
|
||||
// },
|
||||
// relations: ["posMasters"]
|
||||
// });
|
||||
// _masterIdRole = [...new Set(_authRole.map((x: any) => x.posMasters.map((y: any) => y.id)).flat())];
|
||||
// }
|
||||
//แก้ค้นหา
|
||||
let _position: any[] = [];
|
||||
let x: any = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue