Merge branch 'develop' into adiDev
This commit is contained in:
commit
348504fa35
2 changed files with 11 additions and 8 deletions
|
|
@ -64,15 +64,12 @@ export class kpiEvaluationController extends Controller {
|
|||
|
||||
/**
|
||||
* API list เกณฑ์การประเมิน
|
||||
* @param page
|
||||
* @param pageSize
|
||||
*/
|
||||
@Get()
|
||||
async listKpiEvaluation(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("keyword") keyword?: string,
|
||||
@Query("status") status?: string,
|
||||
) {
|
||||
let whereClause: any = {};
|
||||
|
||||
|
|
@ -85,9 +82,6 @@ export class kpiEvaluationController extends Controller {
|
|||
|
||||
const [kpiEvaluation, total] = await this.kpiEvaluationRepository.findAndCount({
|
||||
...whereClause,
|
||||
...(status == null || status == undefined
|
||||
? {}
|
||||
: { evaluationStatus: status.trim().toUpperCase() }),
|
||||
...(keyword ? {} : { skip: (page - 1) * pageSize, take: pageSize }),
|
||||
order: {
|
||||
level: "DESC",
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ export class KpiUserEvaluationController extends Controller {
|
|||
async listKpiUserCommanderEvaluation(@Path() id: string, @Path() type: string) {
|
||||
const kpiUserEvaluationReason = await this.kpiUserEvaluationReasonRepository.find({
|
||||
where: { kpiUserEvaluationId: id, type: type.trim().toUpperCase() },
|
||||
order: { createdAt: "ASC" }
|
||||
order: { createdAt: "ASC" },
|
||||
});
|
||||
return new HttpSuccess(kpiUserEvaluationReason);
|
||||
}
|
||||
|
|
@ -333,16 +333,25 @@ export class KpiUserEvaluationController extends Controller {
|
|||
*/
|
||||
@Get()
|
||||
async listKpiUserEvaluation(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("kpiPeriodId") kpiPeriodId?: string,
|
||||
// @Query("keyword") keyword?: string,
|
||||
@Query("keyword") keyword?: string,
|
||||
@Query("status") status?: string,
|
||||
) {
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.andWhere(kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
kpiPeriodId: kpiPeriodId,
|
||||
})
|
||||
.andWhere({ createdUserId: request.user.sub })
|
||||
.andWhere(
|
||||
status == null || status == undefined ? "1=1" : "evaluationStatus LIKE :evaluationStatus",
|
||||
{
|
||||
evaluationStatus: status == undefined ? "" : status.trim().toUpperCase(),
|
||||
},
|
||||
)
|
||||
.orderBy("kpiUserEvaluation.createdAt", "ASC")
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue