kpi แบบแผน
This commit is contained in:
parent
a840274150
commit
87c7452fa5
3 changed files with 194 additions and 47 deletions
|
|
@ -343,18 +343,30 @@ export class DevelopmentScholarshipController extends Controller {
|
|||
* @param {string} profileId profileId ข้าราชการฯที่ได้รับทุนการศึกษา
|
||||
*/
|
||||
@Get("user/{profileId}")
|
||||
async GetDevelopemtScholarshipUserById(@Path() profileId: string) {
|
||||
const getDevelopment = await this.developmentScholarshipRepository.find({
|
||||
where: { profileId: profileId },
|
||||
});
|
||||
const formattedData = getDevelopment.map((item) => ({
|
||||
id: item.id,
|
||||
scholarshipYear: item.scholarshipYear,
|
||||
scholarshipType: item.scholarshipType,
|
||||
fundType: item.fundType,
|
||||
}));
|
||||
async GetDevelopemtScholarshipUserById(
|
||||
@Path() profileId: string,
|
||||
@Query("type") type?: string | null,
|
||||
@Query("year") year?: number | null,
|
||||
) {
|
||||
const getDevelopment = await AppDataSource.getRepository(DevelopmentScholarship)
|
||||
.createQueryBuilder("developmentScholarship")
|
||||
.andWhere("developmentScholarship.profileId = :profileId", { profileId: profileId })
|
||||
.andWhere(
|
||||
year !== 0 && year != null && year != undefined
|
||||
? "developmentScholarship.scholarshipYear = :scholarshipYear"
|
||||
: "1=1",
|
||||
{ scholarshipYear: year },
|
||||
)
|
||||
.andWhere(
|
||||
type != null && type != undefined
|
||||
? "developmentScholarship.scholarshipType = :scholarshipType"
|
||||
: "1=1",
|
||||
{ scholarshipType: type },
|
||||
)
|
||||
.select(["id", "scholarshipYear", "scholarshipYear", "scholarshipType", "fundType"])
|
||||
.getRawMany();
|
||||
|
||||
return new HttpSuccess(formattedData);
|
||||
return new HttpSuccess(getDevelopment);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue