เพิ่มฟิว year, durationKPI
This commit is contained in:
parent
d2cb987049
commit
fec583d131
1 changed files with 25 additions and 19 deletions
|
|
@ -240,25 +240,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
@Get("{id}")
|
||||
async GetKpiUserEvaluationById(@Path() id: string) {
|
||||
const kpiUserEvaluation = await this.kpiUserEvalutionRepository.findOne({
|
||||
relations:["kpiPeriod"],
|
||||
where: { id: id },
|
||||
select: [
|
||||
"id",
|
||||
"profileId",
|
||||
"prefix",
|
||||
"firstName",
|
||||
"lastName",
|
||||
"kpiPeriodId",
|
||||
"evaluationStatus",
|
||||
"evaluationResults",
|
||||
"createdAt",
|
||||
"evaluatorId",
|
||||
"commanderId",
|
||||
"commanderHighId",
|
||||
"plannedPoint",
|
||||
"rolePoint",
|
||||
"specialPoint",
|
||||
"capacityPoint",
|
||||
],
|
||||
});
|
||||
if (!kpiUserEvaluation) {
|
||||
throw new HttpError(
|
||||
|
|
@ -266,7 +249,27 @@ export class KpiUserEvaluationController extends Controller {
|
|||
"ไม่พบข้อมูลรายการประเมินผลการปฏิบัติราชการระดับบุคคลนี้",
|
||||
);
|
||||
}
|
||||
return new HttpSuccess(kpiUserEvaluation);
|
||||
const mapData = {
|
||||
id: kpiUserEvaluation.id,
|
||||
profileId: kpiUserEvaluation.profileId,
|
||||
prefix: kpiUserEvaluation.prefix,
|
||||
firstName: kpiUserEvaluation.firstName,
|
||||
lastName: kpiUserEvaluation.lastName,
|
||||
evaluationStatus: kpiUserEvaluation.evaluationStatus,
|
||||
evaluationResults: kpiUserEvaluation.evaluationResults,
|
||||
createdAt: kpiUserEvaluation.createdAt,
|
||||
evaluatorId: kpiUserEvaluation.evaluatorId,
|
||||
commanderId: kpiUserEvaluation.commanderId,
|
||||
commanderHighId: kpiUserEvaluation.commanderHighId,
|
||||
plannedPoint: kpiUserEvaluation.plannedPoint,
|
||||
rolePoint: kpiUserEvaluation.rolePoint,
|
||||
specialPoint: kpiUserEvaluation.specialPoint,
|
||||
capacityPoint: kpiUserEvaluation.capacityPoint,
|
||||
kpiPeriodId: kpiUserEvaluation.kpiPeriodId,
|
||||
year: kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.year,
|
||||
durationKPI: kpiUserEvaluation.kpiPeriod == null ? null : kpiUserEvaluation.kpiPeriod.durationKPI,
|
||||
}
|
||||
return new HttpSuccess(mapData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -286,6 +289,7 @@ 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", {
|
||||
kpiPeriodId: kpiPeriodId,
|
||||
})
|
||||
|
|
@ -318,6 +322,8 @@ export class KpiUserEvaluationController extends Controller {
|
|||
rolePoint: item.rolePoint,
|
||||
specialPoint: item.specialPoint,
|
||||
capacityPoint: item.capacityPoint,
|
||||
year: item.kpiPeriod ? item.kpiPeriod.year : null,
|
||||
durationKPI: item.kpiPeriod ? item.kpiPeriod.durationKPI : null,
|
||||
}));
|
||||
return new HttpSuccess({ data: mapData, total });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue