format
This commit is contained in:
parent
18b457c466
commit
7257f6daba
1 changed files with 67 additions and 28 deletions
|
|
@ -106,9 +106,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
kpiPeriodId: requestBody.kpiPeriodId,
|
kpiPeriodId: requestBody.kpiPeriodId,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(requestBody.year ? "kpiPeriod.year LIKE :year" : "1=1", { year: requestBody.year })
|
||||||
requestBody.year ? "kpiPeriod.year LIKE :year" : "1=1", {year: requestBody.year},
|
|
||||||
)
|
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.status != null && requestBody.status != undefined
|
requestBody.status != null && requestBody.status != undefined
|
||||||
? requestBody.status.trim().toUpperCase() == "NEW"
|
? requestBody.status.trim().toUpperCase() == "NEW"
|
||||||
|
|
@ -149,7 +147,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
? requestBody.reqedit.trim().toUpperCase() == "NEW"
|
? requestBody.reqedit.trim().toUpperCase() == "NEW"
|
||||||
? `kpiUserEvaluation.evaluationReqEdit LIKE CASE WHEN kpiUserEvaluation.evaluatorId = "${profileId}" THEN "EVALUATOR" WHEN kpiUserEvaluation.commanderId = "${profileId}" THEN "COMMANDER" WHEN kpiUserEvaluation.commanderHighId = "${profileId}" THEN "COMMANDER_HIGH" ELSE "${requestBody.reqedit.trim().toUpperCase()}" END`
|
? `kpiUserEvaluation.evaluationReqEdit LIKE CASE WHEN kpiUserEvaluation.evaluatorId = "${profileId}" THEN "EVALUATOR" WHEN kpiUserEvaluation.commanderId = "${profileId}" THEN "COMMANDER" WHEN kpiUserEvaluation.commanderHighId = "${profileId}" THEN "COMMANDER_HIGH" ELSE "${requestBody.reqedit.trim().toUpperCase()}" END`
|
||||||
: "kpiUserEvaluation.evaluationReqEdit LIKE :reqedit"
|
: "kpiUserEvaluation.evaluationReqEdit LIKE :reqedit"
|
||||||
: "1=1",
|
: "(kpiUserEvaluation.evaluationReqEdit IS NULL OR kpiUserEvaluation.evaluationReqEdit = 'DONE')",
|
||||||
{
|
{
|
||||||
reqedit:
|
reqedit:
|
||||||
requestBody.reqedit == null || requestBody.reqedit == undefined
|
requestBody.reqedit == null || requestBody.reqedit == undefined
|
||||||
|
|
@ -207,6 +205,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
reasonReject: item.reasonReject,
|
reasonReject: item.reasonReject,
|
||||||
actorReject: item.actorReject,
|
actorReject: item.actorReject,
|
||||||
actorNameReject: item.actorNameReject,
|
actorNameReject: item.actorNameReject,
|
||||||
|
evaluationReqEdit: item.evaluationReqEdit,
|
||||||
isReject: item.reasonReject ? true : false,
|
isReject: item.reasonReject ? true : false,
|
||||||
}));
|
}));
|
||||||
return new HttpSuccess({ data: mapData, total });
|
return new HttpSuccess({ data: mapData, total });
|
||||||
|
|
@ -346,21 +345,30 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
.orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", {
|
.orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", {
|
||||||
keyword: `%${requestBody.keyword}%`,
|
keyword: `%${requestBody.keyword}%`,
|
||||||
})
|
})
|
||||||
.orWhere( "kpiUserEvaluation.org LIKE :keyword", {
|
.orWhere("kpiUserEvaluation.org LIKE :keyword", {
|
||||||
keyword: `%${requestBody.keyword}%`,
|
keyword: `%${requestBody.keyword}%`,
|
||||||
})
|
})
|
||||||
.orWhere( "CONCAT(kpiUserEvaluation.child1,' ', kpiUserEvaluation.org) LIKE :keyword", {
|
.orWhere("CONCAT(kpiUserEvaluation.child1,' ', kpiUserEvaluation.org) LIKE :keyword", {
|
||||||
keyword: `%${requestBody.keyword}%`,
|
|
||||||
})
|
|
||||||
.orWhere( "CONCAT(kpiUserEvaluation.child2,' ', kpiUserEvaluation.child1,' ', kpiUserEvaluation.org) LIKE :keyword", {
|
|
||||||
keyword: `%${requestBody.keyword}%`,
|
|
||||||
})
|
|
||||||
.orWhere( "CONCAT(kpiUserEvaluation.child3,' ', kpiUserEvaluation.child2,' ', kpiUserEvaluation.child1,' ', kpiUserEvaluation.org) LIKE :keyword", {
|
|
||||||
keyword: `%${requestBody.keyword}%`,
|
|
||||||
})
|
|
||||||
.orWhere( "CONCAT(kpiUserEvaluation.child4,' ', kpiUserEvaluation.child3,' ', kpiUserEvaluation.child2,' ', kpiUserEvaluation.child1,' ', kpiUserEvaluation.org) LIKE :keyword", {
|
|
||||||
keyword: `%${requestBody.keyword}%`,
|
keyword: `%${requestBody.keyword}%`,
|
||||||
})
|
})
|
||||||
|
.orWhere(
|
||||||
|
"CONCAT(kpiUserEvaluation.child2,' ', kpiUserEvaluation.child1,' ', kpiUserEvaluation.org) LIKE :keyword",
|
||||||
|
{
|
||||||
|
keyword: `%${requestBody.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orWhere(
|
||||||
|
"CONCAT(kpiUserEvaluation.child3,' ', kpiUserEvaluation.child2,' ', kpiUserEvaluation.child1,' ', kpiUserEvaluation.org) LIKE :keyword",
|
||||||
|
{
|
||||||
|
keyword: `%${requestBody.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.orWhere(
|
||||||
|
"CONCAT(kpiUserEvaluation.child4,' ', kpiUserEvaluation.child3,' ', kpiUserEvaluation.child2,' ', kpiUserEvaluation.child1,' ', kpiUserEvaluation.org) LIKE :keyword",
|
||||||
|
{
|
||||||
|
keyword: `%${requestBody.keyword}%`,
|
||||||
|
},
|
||||||
|
)
|
||||||
.orWhere(conditionFullName, {
|
.orWhere(conditionFullName, {
|
||||||
keyword: `%${requestBody.keyword}%`,
|
keyword: `%${requestBody.keyword}%`,
|
||||||
});
|
});
|
||||||
|
|
@ -437,12 +445,14 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
.createQueryBuilder("kpiUserEvaluation")
|
.createQueryBuilder("kpiUserEvaluation")
|
||||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.kpiPeriodId && requestBody.kpiPeriodId != "ALL" ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1",
|
requestBody.kpiPeriodId && requestBody.kpiPeriodId != "ALL"
|
||||||
|
? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId"
|
||||||
|
: "1=1",
|
||||||
{
|
{
|
||||||
kpiPeriodId: requestBody.kpiPeriodId,
|
kpiPeriodId: requestBody.kpiPeriodId,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(requestBody.year ? "kpiPeriod.year = :year": "1=1", { year: requestBody.year })
|
.andWhere(requestBody.year ? "kpiPeriod.year = :year" : "1=1", { year: requestBody.year })
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.status != null && requestBody.status != undefined
|
requestBody.status != null && requestBody.status != undefined
|
||||||
? "kpiUserEvaluation.evaluationstatus LIKE :status"
|
? "kpiUserEvaluation.evaluationstatus LIKE :status"
|
||||||
|
|
@ -783,19 +793,43 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
let levelForGourp: any = null;
|
let levelForGourp: any = null;
|
||||||
if (kpiUserEvaluation.posTypeName == "วิชาการ" && kpiUserEvaluation.posLevelName == "ทรงคุณวุฒิ" && kpiUserEvaluation.posExecutiveName == null)
|
if (
|
||||||
|
kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
|
kpiUserEvaluation.posLevelName == "ทรงคุณวุฒิ" &&
|
||||||
|
kpiUserEvaluation.posExecutiveName == null
|
||||||
|
)
|
||||||
levelForGourp = "5";
|
levelForGourp = "5";
|
||||||
if (kpiUserEvaluation.posTypeName == "วิชาการ" && kpiUserEvaluation.posLevelName == "เชี่ยวชาญ" && kpiUserEvaluation.posExecutiveName == null)
|
if (
|
||||||
|
kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
|
kpiUserEvaluation.posLevelName == "เชี่ยวชาญ" &&
|
||||||
|
kpiUserEvaluation.posExecutiveName == null
|
||||||
|
)
|
||||||
levelForGourp = "4";
|
levelForGourp = "4";
|
||||||
if (kpiUserEvaluation.posTypeName == "วิชาการ" && kpiUserEvaluation.posLevelName == "ชำนาญการพิเศษ" && kpiUserEvaluation.posExecutiveName == null)
|
if (
|
||||||
|
kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
|
kpiUserEvaluation.posLevelName == "ชำนาญการพิเศษ" &&
|
||||||
|
kpiUserEvaluation.posExecutiveName == null
|
||||||
|
)
|
||||||
levelForGourp = "4";
|
levelForGourp = "4";
|
||||||
if (kpiUserEvaluation.posTypeName == "วิชาการ" && kpiUserEvaluation.posLevelName == "ชำนาญการ" && kpiUserEvaluation.posExecutiveName == null)
|
if (
|
||||||
|
kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
|
kpiUserEvaluation.posLevelName == "ชำนาญการ" &&
|
||||||
|
kpiUserEvaluation.posExecutiveName == null
|
||||||
|
)
|
||||||
levelForGourp = "3";
|
levelForGourp = "3";
|
||||||
if (kpiUserEvaluation.posTypeName == "วิชาการ" && kpiUserEvaluation.posLevelName == "ปฏิบัติการ" && kpiUserEvaluation.posExecutiveName == null)
|
if (
|
||||||
|
kpiUserEvaluation.posTypeName == "วิชาการ" &&
|
||||||
|
kpiUserEvaluation.posLevelName == "ปฏิบัติการ" &&
|
||||||
|
kpiUserEvaluation.posExecutiveName == null
|
||||||
|
)
|
||||||
levelForGourp = "2";
|
levelForGourp = "2";
|
||||||
if (kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "ทักษะพิเศษ")
|
if (kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "ทักษะพิเศษ")
|
||||||
levelForGourp = "4";
|
levelForGourp = "4";
|
||||||
if (kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "อาวุโส" && kpiUserEvaluation.posExecutiveName == null)
|
if (
|
||||||
|
kpiUserEvaluation.posTypeName == "ทั่วไป" &&
|
||||||
|
kpiUserEvaluation.posLevelName == "อาวุโส" &&
|
||||||
|
kpiUserEvaluation.posExecutiveName == null
|
||||||
|
)
|
||||||
levelForGourp = "3";
|
levelForGourp = "3";
|
||||||
if (kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "ชำนาญงาน")
|
if (kpiUserEvaluation.posTypeName == "ทั่วไป" && kpiUserEvaluation.posLevelName == "ชำนาญงาน")
|
||||||
levelForGourp = "2";
|
levelForGourp = "2";
|
||||||
|
|
@ -1405,10 +1439,15 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||||
.createQueryBuilder("kpiUserEvaluation")
|
.createQueryBuilder("kpiUserEvaluation")
|
||||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||||
.andWhere(kpiPeriodId && kpiPeriodId != "ALL" ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
.andWhere(
|
||||||
kpiPeriodId: kpiPeriodId,
|
kpiPeriodId && kpiPeriodId != "ALL"
|
||||||
})
|
? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId"
|
||||||
.andWhere(year ? "kpiPeriod.year = :year": "1=1", { year: year })
|
: "1=1",
|
||||||
|
{
|
||||||
|
kpiPeriodId: kpiPeriodId,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.andWhere(year ? "kpiPeriod.year = :year" : "1=1", { year: year })
|
||||||
.andWhere({ profileId: profileId })
|
.andWhere({ profileId: profileId })
|
||||||
.andWhere(
|
.andWhere(
|
||||||
status == null || status == undefined
|
status == null || status == undefined
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue