no message

This commit is contained in:
Kittapath 2024-02-06 16:23:33 +07:00
parent 0d27451e16
commit 523991674c
2 changed files with 63 additions and 45 deletions

View file

@ -879,28 +879,35 @@ export class OrganizationController extends Controller {
orgRevisionId: orgRoot.orgRevisionId,
orgRootName: orgRoot.orgRootName,
totalPosition: await this.posMasterRepository.count({
where: { orgChild3Id: orgChild3.id },
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild3Id: orgChild3.id,
},
}),
totalPositionCurrentUse: await this.posMasterRepository.count({
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild3Id: orgChild3.id,
current_holderId: Not(IsNull()) || Not(""),
},
}),
totalPositionCurrentVacant: await this.posMasterRepository.count({
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild3Id: orgChild3.id,
current_holderId: IsNull() || "",
},
}),
totalPositionNextUse: await this.posMasterRepository.count({
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild3Id: orgChild3.id,
next_holderId: Not(IsNull()) || Not(""),
},
}),
totalPositionNextVacant: await this.posMasterRepository.count({
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild3Id: orgChild3.id,
next_holderId: IsNull() || "",
},
@ -926,10 +933,14 @@ export class OrganizationController extends Controller {
orgRevisionId: orgRoot.orgRevisionId,
orgRootName: orgRoot.orgRootName,
totalPosition: await this.posMasterRepository.count({
where: { orgChild4Id: orgChild4.id },
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild4Id: orgChild4.id,
},
}),
totalPositionCurrentUse: await this.posMasterRepository.count({
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild4Id: orgChild4.id,
current_holderId: Not(IsNull()) || Not(""),
},
@ -937,18 +948,21 @@ export class OrganizationController extends Controller {
totalPositionCurrentVacant:
await this.posMasterRepository.count({
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild4Id: orgChild4.id,
current_holderId: IsNull() || "",
},
}),
totalPositionNextUse: await this.posMasterRepository.count({
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild4Id: orgChild4.id,
next_holderId: Not(IsNull()) || Not(""),
},
}),
totalPositionNextVacant: await this.posMasterRepository.count({
where: {
orgRevisionId: orgRoot.orgRevisionId,
orgChild4Id: orgChild4.id,
next_holderId: IsNull() || "",
},

View file

@ -653,44 +653,48 @@ export class PositionController extends Controller {
}
let findPosition: any;
let masterId = new Array();
const findTypes: PosType[] = await this.posTypeRepository.find({
where: { posTypeName: Like(`%${body.keyword}%`) },
select: ["id"],
});
findPosition = await this.positionRepository.find({
where: { posTypeId: In(findTypes.map((x) => x.id)) },
select: ["posMasterId"],
});
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
const findLevel: PosLevel[] = await this.posLevelRepository.find({
where: { posLevelName: Like(`%${body.keyword}%`) },
select: ["id"],
});
findPosition = await this.positionRepository.find({
where: { posLevelId: In(findLevel.map((x) => x.id)) },
select: ["posMasterId"],
});
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
const findExecutive: PosExecutive[] = await this.posExecutiveRepository.find({
where: { posExecutiveName: Like(`%${body.keyword}%`) },
select: ["id"],
});
findPosition = await this.positionRepository.find({
where: { posExecutiveId: In(findExecutive.map((x) => x.id)) },
select: ["posMasterId"],
});
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
findPosition = await this.positionRepository.find({
where: { positionName: Like(`%${body.keyword}%`) },
select: ["posMasterId"],
});
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
let keywordAsInt: any;
keywordAsInt = body.keyword == null ? null : parseInt(body.keyword, 10);
if (isNaN(keywordAsInt)) {
keywordAsInt = "P@ssw0rd!z";
if (body.keyword != null && body.keyword != "") {
const findTypes: PosType[] = await this.posTypeRepository.find({
where: { posTypeName: Like(`%${body.keyword}%`) },
select: ["id"],
});
findPosition = await this.positionRepository.find({
where: { posTypeId: In(findTypes.map((x) => x.id)) },
select: ["posMasterId"],
});
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
const findLevel: PosLevel[] = await this.posLevelRepository.find({
where: { posLevelName: Like(`%${body.keyword}%`) },
select: ["id"],
});
findPosition = await this.positionRepository.find({
where: { posLevelId: In(findLevel.map((x) => x.id)) },
select: ["posMasterId"],
});
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
const findExecutive: PosExecutive[] = await this.posExecutiveRepository.find({
where: { posExecutiveName: Like(`%${body.keyword}%`) },
select: ["id"],
});
findPosition = await this.positionRepository.find({
where: { posExecutiveId: In(findExecutive.map((x) => x.id)) },
select: ["posMasterId"],
});
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
findPosition = await this.positionRepository.find({
where: { positionName: Like(`%${body.keyword}%`) },
select: ["posMasterId"],
});
masterId = masterId.concat(findPosition.map((position: any) => position.posMasterId));
let keywordAsInt: any;
keywordAsInt = body.keyword == null ? null : parseInt(body.keyword, 10);
if (isNaN(keywordAsInt)) {
keywordAsInt = "P@ssw0rd!z";
}
masterId = [...new Set(masterId)];
}
masterId = [...new Set(masterId)];
console.log(masterId);
console.log("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
const keywordConditions = [
// {
@ -700,13 +704,13 @@ export class PositionController extends Controller {
{
...checkChildConditions,
...typeCondition,
id: In(masterId),
},
{
...checkChildConditions,
...typeCondition,
posMasterNo: Like(`%${keywordAsInt}%`),
id: masterId.length > 0 ? In(masterId) : false,
},
// {
// ...checkChildConditions,
// ...typeCondition,
// posMasterNo: Like(`%${keywordAsInt}%`),
// },
];
const [posMaster, total] = await this.posMasterRepository.findAndCount({