หา user เกี่ยวข้องกับแบบประเมิน
This commit is contained in:
parent
1f44c7b418
commit
7fbc14e818
1 changed files with 23 additions and 0 deletions
|
|
@ -53,16 +53,39 @@ export class KpiUserEvaluationController extends Controller {
|
|||
*/
|
||||
@Get("admin")
|
||||
async listKpiAdminEvaluation(
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Query("page") page: number = 1,
|
||||
@Query("pageSize") pageSize: number = 10,
|
||||
@Query("kpiPeriodId") kpiPeriodId?: string,
|
||||
@Query("keyword") keyword?: string,
|
||||
) {
|
||||
let profileId: any = null;
|
||||
await new CallAPI()
|
||||
.GetData(request, "org/profile/keycloak/position")
|
||||
.then((x) => {
|
||||
profileId = x.profileId;
|
||||
})
|
||||
.catch((x) => {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลในทะเบียนประวัติ");
|
||||
});
|
||||
const [kpiUserEvaluation, total] = await AppDataSource.getRepository(KpiUserEvaluation)
|
||||
.createQueryBuilder("kpiUserEvaluation")
|
||||
.andWhere(kpiPeriodId ? "kpiPeriodId LIKE :kpiPeriodId" : "1=1", {
|
||||
kpiPeriodId: kpiPeriodId,
|
||||
})
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere("kpiUserEvaluation.evaluatorId LIKE :profileId", {
|
||||
profileId: `%${profileId}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.commanderId LIKE :profileId", {
|
||||
profileId: `%${profileId}%`,
|
||||
})
|
||||
.orWhere("kpiUserEvaluation.commanderHighId LIKE :profileId", {
|
||||
profileId: `%${profileId}%`,
|
||||
});
|
||||
}),
|
||||
)
|
||||
.andWhere(
|
||||
new Brackets((qb) => {
|
||||
qb.orWhere("kpiUserEvaluation.prefix LIKE :keyword", { keyword: `%${keyword}%` })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue