kpi plan
This commit is contained in:
parent
c4a975b503
commit
a9dd103ff8
16 changed files with 1484 additions and 15 deletions
|
|
@ -30,7 +30,7 @@ import { Like } from "typeorm/browser";
|
|||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class kpiController extends Controller {
|
||||
export class kpiPeriodController extends Controller {
|
||||
private kpiPeriodRepository = AppDataSource.getRepository(KpiPeriod);
|
||||
/**
|
||||
* สร้างรอบการประเมินผลการปฏิบัติหน้าที่ราชการ
|
||||
|
|
@ -152,7 +152,7 @@ export class kpiController extends Controller {
|
|||
async GetKpiPeriodById(@Path() id: string) {
|
||||
const kpiPeriod = await this.kpiPeriodRepository.findOne({
|
||||
where: { id: id },
|
||||
select: ["durationKPI", "startDate", "endDate", "isActive"],
|
||||
select: ["year", "durationKPI", "startDate", "endDate", "isActive"],
|
||||
});
|
||||
if (!kpiPeriod) {
|
||||
throw new HttpError(
|
||||
|
|
@ -173,15 +173,19 @@ export class kpiController extends Controller {
|
|||
async listKpiPeriod(
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("year") year?: string,
|
||||
@Query("year") year?: number,
|
||||
@Query("keyword") keyword?: string,
|
||||
) {
|
||||
const [kpiPeriod, total] = await this.kpiPeriodRepository.findAndCount({
|
||||
// where: {
|
||||
// durationKPI: Like(`%${keyword}%`),
|
||||
// },
|
||||
...(keyword ? {} : { skip: (page - 1) * pageSize, take: pageSize }),
|
||||
});
|
||||
const [kpiPeriod, total] = await AppDataSource.getRepository(KpiPeriod)
|
||||
.createQueryBuilder("kpiPeriod")
|
||||
.andWhere(
|
||||
year !== 0 && year != null && year != undefined ? "kpiPeriod.year = :year" : "1=1",
|
||||
{ year: year },
|
||||
)
|
||||
.orderBy("kpiPeriod.createdAt", "DESC")
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
return new HttpSuccess({ data: kpiPeriod, total });
|
||||
}
|
||||
|
|
@ -191,7 +195,7 @@ export class kpiController extends Controller {
|
|||
* @param id
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async deleteKpiPerriod(@Path() id: string) {
|
||||
async deleteKpiPeriod(@Path() id: string) {
|
||||
const kpiPeriod = await this.kpiPeriodRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue