no message
This commit is contained in:
parent
19703a4f0b
commit
f0af5a5c83
4 changed files with 81 additions and 89 deletions
|
|
@ -59,7 +59,7 @@ export class kpiRoleController extends Controller {
|
|||
}
|
||||
}
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/find/all", {
|
||||
.PostData(request, "/org/find/all", {
|
||||
node: requestBody.node,
|
||||
nodeId: requestBody.nodeId,
|
||||
})
|
||||
|
|
@ -218,7 +218,7 @@ export class kpiRoleController extends Controller {
|
|||
}
|
||||
Object.assign(kpiRole, requestBody);
|
||||
await new CallAPI()
|
||||
.PostData(request, "org/find/all", {
|
||||
.PostData(request, "/org/find/all", {
|
||||
node: requestBody.node,
|
||||
nodeId: requestBody.nodeId,
|
||||
})
|
||||
|
|
@ -324,7 +324,6 @@ export class kpiRoleController extends Controller {
|
|||
orgRevisionId: kpiRole.orgRevisionId,
|
||||
position: kpiRole.position,
|
||||
documentInfoEvidence: kpiRole.documentInfoEvidence,
|
||||
|
||||
};
|
||||
return new HttpSuccess(formattedData);
|
||||
}
|
||||
|
|
@ -414,36 +413,29 @@ export class kpiRoleController extends Controller {
|
|||
// period: `%${requestBody.period}%`,
|
||||
// },
|
||||
// )
|
||||
.andWhere(
|
||||
requestBody.year
|
||||
? "kpiRole.year LIKE :year"
|
||||
: "1=1",
|
||||
{
|
||||
year: `%${requestBody.year}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(
|
||||
requestBody.period
|
||||
? "kpiRole.period LIKE :period"
|
||||
: "1=1",
|
||||
{
|
||||
period: `%${requestBody.period}%`,
|
||||
},
|
||||
)
|
||||
.andWhere(requestBody.year ? "kpiRole.year LIKE :year" : "1=1", {
|
||||
year: `%${requestBody.year}%`,
|
||||
})
|
||||
.andWhere(requestBody.period ? "kpiRole.period LIKE :period" : "1=1", {
|
||||
period: `%${requestBody.period}%`,
|
||||
})
|
||||
.andWhere(requestBody.position != undefined ? "kpiRole.position LIKE :position" : "1=1", {
|
||||
position: `%${requestBody.position}%`,
|
||||
})
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere("kpiRole.including LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`
|
||||
}).orWhere("kpiRole.includingName LIKE :keyword",{
|
||||
keyword: `%${requestBody.keyword}%`
|
||||
}).orWhere("kpiRole.year LIKE :keyword",{
|
||||
keyword: `%${requestBody.keyword}%`
|
||||
}).orWhere("kpiRole.period LIKE :keyword",{
|
||||
keyword: `%${requestBody.keyword}%`
|
||||
});
|
||||
qb.orWhere("kpiRole.including LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiRole.includingName LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiRole.year LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
})
|
||||
.orWhere("kpiRole.period LIKE :keyword", {
|
||||
keyword: `%${requestBody.keyword}%`,
|
||||
});
|
||||
}),
|
||||
)
|
||||
.select([
|
||||
|
|
@ -552,21 +544,21 @@ export class kpiRoleController extends Controller {
|
|||
return new HttpSuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* API ประวัดิตัวชี้วัดตามตำแหน่ง
|
||||
* @param id Guid, *Id ประวัดิตัวชี้วัดตามตำแหน่ง
|
||||
*/
|
||||
@Get("history/{id}")
|
||||
async GetHistory(@Path() id: string) {
|
||||
const kpiRoleHistory = await this.kpiRoleHistoryRepository.find({
|
||||
where: { kpiRoleId: id },
|
||||
order:{
|
||||
createdAt: "ASC"
|
||||
}
|
||||
});
|
||||
if (!kpiRoleHistory) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประวัดิตัวชี้วัดตามตำแหน่งนี้");
|
||||
}
|
||||
return new HttpSuccess(kpiRoleHistory);
|
||||
}
|
||||
@Get("history/{id}")
|
||||
async GetHistory(@Path() id: string) {
|
||||
const kpiRoleHistory = await this.kpiRoleHistoryRepository.find({
|
||||
where: { kpiRoleId: id },
|
||||
order: {
|
||||
createdAt: "ASC",
|
||||
},
|
||||
});
|
||||
if (!kpiRoleHistory) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประวัดิตัวชี้วัดตามตำแหน่งนี้");
|
||||
}
|
||||
return new HttpSuccess(kpiRoleHistory);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue