fix ระบบข้อมูลการประเมิน>>ตัวชี้วัด (ตามตำแหน่ง) ระบบบแจ้งไม่พบตัวชี้วัด #1253

This commit is contained in:
Bright 2025-03-19 17:59:14 +07:00
parent 903ff74171
commit 401584c8af

View file

@ -231,7 +231,9 @@ export class kpiRoleController extends Controller {
const kpiPeriod = await this.kpiPeriodRepository
.createQueryBuilder("kpiPeriod")
.where("kpiPeriod.year = :year", { year: requestBody.year })
.andWhere("kpiPeriod.durationKPI = :durationKPI", { durationKPI: requestBody.period })
.andWhere(requestBody.period ? "kpiPeriod.durationKPI = :durationKPI" : "1=1", {
durationKPI: requestBody.period,
})
.getOne();
if (!kpiPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตัวชี้วัดตามตำแหน่งนี้");