no message
This commit is contained in:
parent
f6de3a0c1c
commit
4721e9aeed
1 changed files with 54 additions and 31 deletions
|
|
@ -94,19 +94,22 @@ export class KpiUserEvaluationController extends Controller {
|
|||
// }
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.andWhere(requestBody.kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
.andWhere(
|
||||
requestBody.kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1",
|
||||
{
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
requestBody.status != null && requestBody.status != undefined
|
||||
? requestBody.status.trim().toUpperCase() == "NEW"
|
||||
? `evaluationStatus LIKE CASE WHEN evaluatorId = "${profileId}" THEN "NEW_EVALUATOR" WHEN commanderId = "${profileId}" THEN "NEW_COMMANDER" WHEN commanderHighId = "${profileId}" THEN "NEW_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END`
|
||||
? `kpiUserEvaluation.evaluationStatus LIKE CASE WHEN kpiUserEvaluation.evaluatorId = "${profileId}" THEN "NEW_EVALUATOR" WHEN kpiUserEvaluation.commanderId = "${profileId}" THEN "NEW_COMMANDER" WHEN kpiUserEvaluation.commanderHighId = "${profileId}" THEN "NEW_COMMANDER_HIGH" ELSE "${requestBody.status.trim().toUpperCase()}" END`
|
||||
: requestBody.status.trim().toUpperCase() == "EVALUATING_EVALUATOR" ||
|
||||
requestBody.status.trim().toUpperCase() == "EVALUATING"
|
||||
? "evaluationStatus LIKE :status"
|
||||
? "kpiUserEvaluation.evaluationStatus LIKE :status"
|
||||
: requestBody.status.trim().toUpperCase() == "SUMMARY"
|
||||
? "evaluationStatus LIKE :status"
|
||||
: "evaluationStatus LIKE :status"
|
||||
? "kpiUserEvaluation.evaluationStatus LIKE :status"
|
||||
: "kpiUserEvaluation.evaluationStatus LIKE :status"
|
||||
: "1=1",
|
||||
{
|
||||
status:
|
||||
|
|
@ -123,7 +126,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
)
|
||||
.andWhere(
|
||||
requestBody.results != null && requestBody.results != undefined
|
||||
? "evaluationResults LIKE :results"
|
||||
? "kpiUserEvaluation.evaluationResults LIKE :results"
|
||||
: "1=1",
|
||||
{
|
||||
results:
|
||||
|
|
@ -135,8 +138,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
.andWhere(
|
||||
requestBody.reqedit != null && requestBody.reqedit != undefined
|
||||
? requestBody.reqedit.trim().toUpperCase() == "NEW"
|
||||
? `evaluationReqEdit LIKE CASE WHEN evaluatorId = "${profileId}" THEN "EVALUATOR" WHEN commanderId = "${profileId}" THEN "COMMANDER" WHEN commanderHighId = "${profileId}" THEN "COMMANDER_HIGH" ELSE "${requestBody.reqedit.trim().toUpperCase()}" END`
|
||||
: "evaluationReqEdit LIKE :reqedit"
|
||||
? `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"
|
||||
: "1=1",
|
||||
{
|
||||
reqedit:
|
||||
|
|
@ -160,15 +163,18 @@ export class KpiUserEvaluationController extends Controller {
|
|||
)
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere("CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
// .orWhere("kpiUserEvaluation.firstName LIKE :keyword", {
|
||||
// keyword: `%${requestBody.keyword}%`,
|
||||
// })
|
||||
// .orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
|
||||
// keyword: `%${requestBody.keyword}%`,
|
||||
// });
|
||||
qb.orWhere(
|
||||
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword",
|
||||
{
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
},
|
||||
);
|
||||
// .orWhere("kpiUserEvaluation.firstName LIKE :keyword", {
|
||||
// keyword: `%${requestBody.keyword}%`,
|
||||
// })
|
||||
// .orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
|
||||
// keyword: `%${requestBody.keyword}%`,
|
||||
// });
|
||||
}),
|
||||
)
|
||||
.orderBy("kpiUserEvaluation.createdAt", "DESC")
|
||||
|
|
@ -270,12 +276,15 @@ export class KpiUserEvaluationController extends Controller {
|
|||
child4: _data.child4,
|
||||
},
|
||||
)
|
||||
.andWhere(requestBody.kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
.andWhere(
|
||||
requestBody.kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1",
|
||||
{
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
requestBody.status != null && requestBody.status != undefined
|
||||
? "evaluationstatus LIKE :status"
|
||||
? "kpiUserEvaluation.evaluationstatus LIKE :status"
|
||||
: "1=1",
|
||||
{
|
||||
status:
|
||||
|
|
@ -286,7 +295,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
)
|
||||
.andWhere(
|
||||
requestBody.results != null && requestBody.results != undefined
|
||||
? "evaluationResults LIKE :results"
|
||||
? "kpiUserEvaluation.evaluationResults LIKE :results"
|
||||
: "1=1",
|
||||
{
|
||||
results:
|
||||
|
|
@ -385,12 +394,15 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword";
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.andWhere(requestBody.kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
.andWhere(
|
||||
requestBody.kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1",
|
||||
{
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
requestBody.status != null && requestBody.status != undefined
|
||||
? "evaluationstatus LIKE :status"
|
||||
? "kpiUserEvaluation.evaluationstatus LIKE :status"
|
||||
: "1=1",
|
||||
{
|
||||
status:
|
||||
|
|
@ -401,7 +413,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
)
|
||||
.andWhere(
|
||||
requestBody.results != null && requestBody.results != undefined
|
||||
? "evaluationResults LIKE :results"
|
||||
? "kpiUserEvaluation.evaluationResults LIKE :results"
|
||||
: "1=1",
|
||||
{
|
||||
results:
|
||||
|
|
@ -1024,6 +1036,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
@Query("kpiPeriodId") kpiPeriodId?: string,
|
||||
@Query("keyword") keyword?: string,
|
||||
@Query("status") status?: string,
|
||||
@Query("results") results?: string,
|
||||
) {
|
||||
let profileId: any = null;
|
||||
await new CallAPI()
|
||||
|
|
@ -1037,17 +1050,27 @@ export class KpiUserEvaluationController extends Controller {
|
|||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod")
|
||||
.andWhere(kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
.andWhere(kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
kpiPeriodId: kpiPeriodId,
|
||||
})
|
||||
// .andWhere({ createdUserId: request.user.sub })
|
||||
.andWhere({ profileId: profileId })
|
||||
.andWhere(
|
||||
status == null || status == undefined ? "1=1" : "evaluationStatus LIKE :evaluationStatus",
|
||||
status == null || status == undefined
|
||||
? "1=1"
|
||||
: "kpiUserEvaluation.evaluationStatus LIKE :evaluationStatus",
|
||||
{
|
||||
evaluationStatus: status == undefined ? "" : status.trim().toUpperCase(),
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
results == null || results == undefined
|
||||
? "1=1"
|
||||
: "kpiUserEvaluation.evaluationResults LIKE :evaluationResults",
|
||||
{
|
||||
evaluationResults: results == undefined ? "" : results.trim().toUpperCase(),
|
||||
},
|
||||
)
|
||||
.orderBy("kpiUserEvaluation.createdAt", "DESC")
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue