diff --git a/src/controllers/KpiPlanController.ts b/src/controllers/KpiPlanController.ts index 862f977..331b963 100644 --- a/src/controllers/KpiPlanController.ts +++ b/src/controllers/KpiPlanController.ts @@ -265,13 +265,14 @@ export class kpiPlanController extends Controller { async listKpiPlan( @Query("page") page: number = 1, @Query("pageSize") pageSize: number = 10, - @Query("round") round?: string, + @Query("kpiPeriodId") kpiPeriodId?: string, @Query("nodeId") nodeId?: string | null, @Query("node") node?: number | null, @Query("keyword") keyword?: string, ) { const [kpiPlan, total] = await AppDataSource.getRepository(KpiPlan) .createQueryBuilder("kpiPlan") + .leftJoinAndSelect("kpiPlan.kpiPeriod", "kpiPeriod") .andWhere( node != undefined && node != null ? node == 4 @@ -289,17 +290,17 @@ export class kpiPlanController extends Controller { }, ) .andWhere( - round != undefined && round != null && round != "" - ? "kpiPlan.kpiPeriodId LIKE :round" + kpiPeriodId != undefined && kpiPeriodId != null && kpiPeriodId != "" + ? "kpiPlan.kpiPeriodId LIKE :kpiPeriodId" : "1=1", { - round: `${round}`, + kpiPeriodId: `${kpiPeriodId}`, }, ) .select([ "kpiPlan.id", - "kpiPlan.year", - "kpiPlan.round", + "kpiPeriod.year", + "kpiPeriod.durationKPI", "kpiPlan.including", "kpiPlan.includingName", ]) diff --git a/src/controllers/KpiRoleController.ts b/src/controllers/KpiRoleController.ts index 2e7ac9e..3e57b39 100644 --- a/src/controllers/KpiRoleController.ts +++ b/src/controllers/KpiRoleController.ts @@ -209,7 +209,7 @@ export class kpiRoleController extends Controller { async listKpiRole( @Query("page") page: number = 1, @Query("pageSize") pageSize: number = 10, - @Query("round") round?: string, + @Query("kpiPeriodId") kpiPeriodId?: string, @Query("nodeId") nodeId?: string | null, @Query("node") node?: number | null, @Query("keyword") keyword?: string, @@ -217,6 +217,7 @@ export class kpiRoleController extends Controller { ) { const [kpiRole, total] = await AppDataSource.getRepository(KpiRole) .createQueryBuilder("kpiRole") + .leftJoinAndSelect("kpiRole.kpiPeriod", "kpiPeriod") .andWhere( node != undefined && node != null ? node == 4 @@ -234,11 +235,11 @@ export class kpiRoleController extends Controller { }, ) .andWhere( - round != undefined && round != null && round != "" - ? "kpiRole.kpiPeriod LIKE :round" + kpiPeriodId != undefined && kpiPeriodId != null && kpiPeriodId != "" + ? "kpiRole.kpiPeriod LIKE :kpiPeriodId" : "1=1", { - round: `${round}`, + kpiPeriodId: `${kpiPeriodId}`, }, ) .andWhere(position != undefined ? "kpiRole.position LIKE :position" : "1=1", { @@ -246,8 +247,8 @@ export class kpiRoleController extends Controller { }) .select([ "kpiRole.id", - "kpiRole.year", - "kpiRole.round", + "kpiPeriod.year", + "kpiPeriod.durationKPI", "kpiRole.including", "kpiRole.includingName", ])