ค้นหารอบตามปี
This commit is contained in:
parent
04d746bb18
commit
ec4cf9015f
1 changed files with 34 additions and 0 deletions
|
|
@ -1418,6 +1418,40 @@ export class SalaryPeriodController extends Controller {
|
|||
return new HttpSuccess(salaryPeriod);
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายการรอบเงินเดือน by year
|
||||
*
|
||||
* @summary SLR_020 - รายการรอบเงินเดือน by year
|
||||
*
|
||||
*/
|
||||
@Get("active/{year}")
|
||||
async GetListsSalaryPeriodByYear(
|
||||
@Path() year: number,
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("keyword") keyword?: string,
|
||||
) {
|
||||
const [salaryPeriod, total] = await AppDataSource.getRepository(SalaryPeriod)
|
||||
.createQueryBuilder("salaryPeriod")
|
||||
.andWhere(year != 0 ? "salaryPeriod.year LIKE :year" : "1=1", { year: `${year}` })
|
||||
.select([
|
||||
"salaryPeriod.id",
|
||||
"salaryPeriod.period",
|
||||
"salaryPeriod.isActive",
|
||||
"salaryPeriod.isClose",
|
||||
"salaryPeriod.effectiveDate",
|
||||
"salaryPeriod.status",
|
||||
"salaryPeriod.year",
|
||||
"salaryPeriod.revisionId",
|
||||
])
|
||||
.orderBy("salaryPeriod.effectiveDate", "DESC")
|
||||
.skip((page - 1) * pageSize)
|
||||
.take(pageSize)
|
||||
.getManyAndCount();
|
||||
|
||||
return new HttpSuccess({ data: salaryPeriod, total });
|
||||
}
|
||||
|
||||
/**
|
||||
* API รายการรอบเงินเดือน
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue