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)
|
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||||
.createQueryBuilder("kpiUserEvaluation")
|
.createQueryBuilder("kpiUserEvaluation")
|
||||||
.andWhere(requestBody.kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
.andWhere(
|
||||||
kpiPeriodId: requestBody.kpiPeriodId,
|
requestBody.kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1",
|
||||||
})
|
{
|
||||||
|
kpiPeriodId: requestBody.kpiPeriodId,
|
||||||
|
},
|
||||||
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.status != null && requestBody.status != undefined
|
requestBody.status != null && requestBody.status != undefined
|
||||||
? requestBody.status.trim().toUpperCase() == "NEW"
|
? 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_EVALUATOR" ||
|
||||||
requestBody.status.trim().toUpperCase() == "EVALUATING"
|
requestBody.status.trim().toUpperCase() == "EVALUATING"
|
||||||
? "evaluationStatus LIKE :status"
|
? "kpiUserEvaluation.evaluationStatus LIKE :status"
|
||||||
: requestBody.status.trim().toUpperCase() == "SUMMARY"
|
: requestBody.status.trim().toUpperCase() == "SUMMARY"
|
||||||
? "evaluationStatus LIKE :status"
|
? "kpiUserEvaluation.evaluationStatus LIKE :status"
|
||||||
: "evaluationStatus LIKE :status"
|
: "kpiUserEvaluation.evaluationStatus LIKE :status"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
status:
|
status:
|
||||||
|
|
@ -123,7 +126,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.results != null && requestBody.results != undefined
|
requestBody.results != null && requestBody.results != undefined
|
||||||
? "evaluationResults LIKE :results"
|
? "kpiUserEvaluation.evaluationResults LIKE :results"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
results:
|
results:
|
||||||
|
|
@ -135,8 +138,8 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.reqedit != null && requestBody.reqedit != undefined
|
requestBody.reqedit != null && requestBody.reqedit != undefined
|
||||||
? requestBody.reqedit.trim().toUpperCase() == "NEW"
|
? 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`
|
? `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`
|
||||||
: "evaluationReqEdit LIKE :reqedit"
|
: "kpiUserEvaluation.evaluationReqEdit LIKE :reqedit"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
reqedit:
|
reqedit:
|
||||||
|
|
@ -160,15 +163,18 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.orWhere("CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword", {
|
qb.orWhere(
|
||||||
keyword: `%${requestBody.keyword}%`,
|
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword",
|
||||||
})
|
{
|
||||||
// .orWhere("kpiUserEvaluation.firstName LIKE :keyword", {
|
keyword: `%${requestBody.keyword}%`,
|
||||||
// keyword: `%${requestBody.keyword}%`,
|
},
|
||||||
// })
|
);
|
||||||
// .orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
|
// .orWhere("kpiUserEvaluation.firstName LIKE :keyword", {
|
||||||
// keyword: `%${requestBody.keyword}%`,
|
// keyword: `%${requestBody.keyword}%`,
|
||||||
// });
|
// })
|
||||||
|
// .orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
|
||||||
|
// keyword: `%${requestBody.keyword}%`,
|
||||||
|
// });
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.orderBy("kpiUserEvaluation.createdAt", "DESC")
|
.orderBy("kpiUserEvaluation.createdAt", "DESC")
|
||||||
|
|
@ -270,12 +276,15 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
child4: _data.child4,
|
child4: _data.child4,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.andWhere(requestBody.kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
.andWhere(
|
||||||
kpiPeriodId: requestBody.kpiPeriodId,
|
requestBody.kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1",
|
||||||
})
|
{
|
||||||
|
kpiPeriodId: requestBody.kpiPeriodId,
|
||||||
|
},
|
||||||
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.status != null && requestBody.status != undefined
|
requestBody.status != null && requestBody.status != undefined
|
||||||
? "evaluationstatus LIKE :status"
|
? "kpiUserEvaluation.evaluationstatus LIKE :status"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
status:
|
status:
|
||||||
|
|
@ -286,7 +295,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.results != null && requestBody.results != undefined
|
requestBody.results != null && requestBody.results != undefined
|
||||||
? "evaluationResults LIKE :results"
|
? "kpiUserEvaluation.evaluationResults LIKE :results"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
results:
|
results:
|
||||||
|
|
@ -385,12 +394,15 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword";
|
"CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword";
|
||||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||||
.createQueryBuilder("kpiUserEvaluation")
|
.createQueryBuilder("kpiUserEvaluation")
|
||||||
.andWhere(requestBody.kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
.andWhere(
|
||||||
kpiPeriodId: requestBody.kpiPeriodId,
|
requestBody.kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1",
|
||||||
})
|
{
|
||||||
|
kpiPeriodId: requestBody.kpiPeriodId,
|
||||||
|
},
|
||||||
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.status != null && requestBody.status != undefined
|
requestBody.status != null && requestBody.status != undefined
|
||||||
? "evaluationstatus LIKE :status"
|
? "kpiUserEvaluation.evaluationstatus LIKE :status"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
status:
|
status:
|
||||||
|
|
@ -401,7 +413,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
)
|
)
|
||||||
.andWhere(
|
.andWhere(
|
||||||
requestBody.results != null && requestBody.results != undefined
|
requestBody.results != null && requestBody.results != undefined
|
||||||
? "evaluationResults LIKE :results"
|
? "kpiUserEvaluation.evaluationResults LIKE :results"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
results:
|
results:
|
||||||
|
|
@ -1024,6 +1036,7 @@ export class KpiUserEvaluationController extends Controller {
|
||||||
@Query("kpiPeriodId") kpiPeriodId?: string,
|
@Query("kpiPeriodId") kpiPeriodId?: string,
|
||||||
@Query("keyword") keyword?: string,
|
@Query("keyword") keyword?: string,
|
||||||
@Query("status") status?: string,
|
@Query("status") status?: string,
|
||||||
|
@Query("results") results?: string,
|
||||||
) {
|
) {
|
||||||
let profileId: any = null;
|
let profileId: any = null;
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
|
|
@ -1037,17 +1050,27 @@ 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 LIKE :kpiPeriodId" : "1=1", {
|
.andWhere(kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||||
kpiPeriodId: kpiPeriodId,
|
kpiPeriodId: kpiPeriodId,
|
||||||
})
|
})
|
||||||
// .andWhere({ createdUserId: request.user.sub })
|
// .andWhere({ createdUserId: request.user.sub })
|
||||||
.andWhere({ profileId: profileId })
|
.andWhere({ profileId: profileId })
|
||||||
.andWhere(
|
.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(),
|
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")
|
.orderBy("kpiUserEvaluation.createdAt", "DESC")
|
||||||
.skip((page - 1) * pageSize)
|
.skip((page - 1) * pageSize)
|
||||||
.take(pageSize)
|
.take(pageSize)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue