From 0cfdc0725352ce08a029ce8a51c8bd44dea91676 Mon Sep 17 00:00:00 2001 From: Bright Date: Fri, 29 Nov 2024 09:52:59 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=8A=E0=B9=87=E0=B8=84=20?= =?UTF-8?q?=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B9=80=E0=B8=A1=E0=B8=B4=E0=B8=99?= =?UTF-8?q?=E0=B8=9C=E0=B8=A5=20#814?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/KpiPeriodController.ts | 9 +++++---- src/controllers/KpiUserEvaluationController.ts | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/controllers/KpiPeriodController.ts b/src/controllers/KpiPeriodController.ts index 0cef731..fefe614 100644 --- a/src/controllers/KpiPeriodController.ts +++ b/src/controllers/KpiPeriodController.ts @@ -243,8 +243,9 @@ export class kpiPeriodController extends Controller { year !== 0 && year != null && year != undefined ? "kpiPeriod.year = :year" : "1=1", { year: year }, ) - .orderBy("kpiPeriod.startDate", "ASC") - .addOrderBy("kpiPeriod.year", "ASC") + .orderBy("kpiPeriod.year", "DESC") + .addOrderBy("kpiPeriod.durationKPI", "DESC") + .addOrderBy("kpiPeriod.startDate", "DESC") .skip((page - 1) * pageSize) .take(pageSize) .getManyAndCount(); @@ -296,8 +297,8 @@ export class kpiPeriodController extends Controller { year !== 0 && year != null && year != undefined ? "kpiPeriod.year = :year" : "1=1", { year: year }, ) - .orderBy("kpiPeriod.startDate", "ASC") - .addOrderBy("kpiPeriod.year", "ASC") + .orderBy("kpiPeriod.year", "DESC") + .addOrderBy("kpiPeriod.createdAt", "DESC") .skip((page - 1) * pageSize) .take(pageSize) .getManyAndCount(); diff --git a/src/controllers/KpiUserEvaluationController.ts b/src/controllers/KpiUserEvaluationController.ts index 29f8e87..9c26cad 100644 --- a/src/controllers/KpiUserEvaluationController.ts +++ b/src/controllers/KpiUserEvaluationController.ts @@ -394,6 +394,7 @@ export class KpiUserEvaluationController extends Controller { "CONCAT(kpiUserEvaluation.prefix, kpiUserEvaluation.firstName, ' ', kpiUserEvaluation.lastName) LIKE :keyword"; const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation) .createQueryBuilder("kpiUserEvaluation") + .leftJoinAndSelect("kpiUserEvaluation.kpiPeriod", "kpiPeriod") .andWhere( requestBody.kpiPeriodId ? "kpiUserEvaluation.kpiPeriodId LIKE :kpiPeriodId" : "1=1", { @@ -450,7 +451,8 @@ export class KpiUserEvaluationController extends Controller { }); }), ) - .orderBy("kpiUserEvaluation.createdAt", "ASC") + .orderBy("kpiPeriod.year", "DESC") + .addOrderBy("kpiUserEvaluation.createdAt", "DESC") .skip((requestBody.page - 1) * requestBody.pageSize) .take(requestBody.pageSize) .getManyAndCount();