report 3 (test)
This commit is contained in:
parent
f8c2433927
commit
6e374d7992
1 changed files with 28 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Controller, Get, Post, Route, Security, Tags, Body, Path } from "tsoa";
|
||||
import { Controller, Get, Post, Route, Security, Tags, Body, Path, Query } from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
|
|
@ -563,14 +563,38 @@ export class ReportController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("report3")
|
||||
async report3() {
|
||||
|
||||
async report3(
|
||||
@Query("year") year: number,
|
||||
@Query("rootId") rootId?: string,
|
||||
) {
|
||||
const [development, total] = await AppDataSource.getRepository(DevelopmentScholarship)
|
||||
.createQueryBuilder("developmentScholarship")
|
||||
.leftJoinAndSelect("developmentScholarship.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("developmentScholarship.posType", "posType")
|
||||
.andWhere(
|
||||
year !== 0 && year != null && year != undefined
|
||||
? "developmentScholarship.scholarshipYear = :scholarshipYear"
|
||||
: "1=1",
|
||||
{ scholarshipYear: year },
|
||||
)
|
||||
.andWhere(
|
||||
rootId != "" && rootId != null && rootId != undefined
|
||||
? "developmentScholarship.rootId = :rootId"
|
||||
: "1=1",
|
||||
{ rootId: rootId },
|
||||
)
|
||||
.orderBy("developmentScholarship.scholarshipYear", "DESC")
|
||||
.addOrderBy("developmentScholarship.createdAt", "DESC")
|
||||
.getManyAndCount();
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "reportFund3",
|
||||
reportName: "reportFund3",
|
||||
data: {
|
||||
data: "",
|
||||
year: year ? Extension.ToThaiNumber(year.toString()) : "-",
|
||||
root: null,
|
||||
developments: development,
|
||||
total: total
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue