no message
This commit is contained in:
parent
0b632803fe
commit
4a07ca669c
3 changed files with 116 additions and 64 deletions
|
|
@ -179,6 +179,79 @@ export class KpiUserEvaluationController extends Controller {
|
|||
return new HttpSuccess({ data: mapData, total });
|
||||
}
|
||||
|
||||
/**
|
||||
* API
|
||||
*
|
||||
* @summary รายการประเมินผลการปฏิบัติราชการระดับบุคคลทั้งหมด
|
||||
*
|
||||
*/
|
||||
@Post("list")
|
||||
async listKpiListEvaluation(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Body()
|
||||
requestBody: {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
kpiPeriodId?: string;
|
||||
keyword?: string;
|
||||
status?: string | null;
|
||||
results?: string | null;
|
||||
reqedit?: string | null;
|
||||
evaluating?: boolean | null;
|
||||
},
|
||||
) {
|
||||
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.andWhere(requestBody.kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
.andWhere(
|
||||
requestBody.results != null && requestBody.results != undefined
|
||||
? "evaluationResults LIKE :results"
|
||||
: "1=1",
|
||||
{
|
||||
results:
|
||||
requestBody.results == null || requestBody.results == undefined
|
||||
? null
|
||||
: requestBody.results.trim().toUpperCase(),
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere("kpiUserEvaluation.prefix LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.firstName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
});
|
||||
}),
|
||||
)
|
||||
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
||||
.skip((requestBody.page - 1) * requestBody.pageSize)
|
||||
.take(requestBody.pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
const mapData = kpiUserEvaluation.map((item) => ({
|
||||
id: item.id,
|
||||
profileId: item.profileId,
|
||||
prefix: item.prefix,
|
||||
firstname: item.firstName,
|
||||
lastname: item.lastName,
|
||||
kpiPeriodId: item.kpiPeriodId,
|
||||
evaluationStatus: item.evaluationStatus,
|
||||
evaluationResults: item.evaluationResults,
|
||||
createdAt: item.createdAt,
|
||||
evaluatorId: item.evaluatorId,
|
||||
commanderId: item.commanderId,
|
||||
commanderHighId: item.commanderHighId,
|
||||
}));
|
||||
return new HttpSuccess({ data: mapData, total });
|
||||
}
|
||||
|
||||
/**
|
||||
* API สร้างรายการประเมินผลการปฏิบัติราชการระดับบุคคล (USER)
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue