checkpoint
This commit is contained in:
parent
bea28e0cc1
commit
e8e68a9a66
1 changed files with 21 additions and 2 deletions
|
|
@ -22,7 +22,7 @@ import HttpStatusCode from "../interfaces/http-status";
|
|||
import { KpiRole, createKpiRole, updateKpiRole } from "../entities/kpiRole";
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
import { KpiPeriod } from "../entities/kpiPeriod";
|
||||
import { Brackets, IsNull } from "typeorm";
|
||||
import { Brackets, IsNull, Like } from "typeorm";
|
||||
import { KpiRoleHistory } from "../entities/kpiRoleHistory";
|
||||
|
||||
@Route("api/v1/kpi/role")
|
||||
|
|
@ -88,6 +88,9 @@ export class kpiRoleController extends Controller {
|
|||
.where("kpiRole.rootId = :rootId AND kpiRole.child1Id IS NULL", {
|
||||
rootId: requestBody.nodeId,
|
||||
})
|
||||
.andWhere("kpiRole.position LIKE :position", {
|
||||
position: `%${requestBody.position}%`,
|
||||
})
|
||||
.andWhere("kpiRole.kpiPeriodId = :kpiPeriodId", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
|
|
@ -99,6 +102,9 @@ export class kpiRoleController extends Controller {
|
|||
.where("kpiRole.child1Id = :child1Id AND kpiRole.child2Id IS NULL", {
|
||||
child1Id: requestBody.nodeId,
|
||||
})
|
||||
.andWhere("kpiRole.position LIKE :position", {
|
||||
position: `%${requestBody.position}%`,
|
||||
})
|
||||
.andWhere("kpiRole.kpiPeriodId = :kpiPeriodId", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
|
|
@ -110,6 +116,9 @@ export class kpiRoleController extends Controller {
|
|||
.where("kpiRole.child2Id = :child2Id AND kpiRole.child3Id IS NULL", {
|
||||
child2Id: requestBody.nodeId,
|
||||
})
|
||||
.andWhere("kpiRole.position LIKE :position", {
|
||||
position: `%${requestBody.position}%`,
|
||||
})
|
||||
.andWhere("kpiRole.kpiPeriodId = :kpiPeriodId", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
|
|
@ -121,6 +130,9 @@ export class kpiRoleController extends Controller {
|
|||
.where("kpiRole.child3Id = :child3Id AND kpiRole.child4Id IS NULL", {
|
||||
child3Id: requestBody.nodeId,
|
||||
})
|
||||
.andWhere("kpiRole.position LIKE :position", {
|
||||
position: `%${requestBody.position}%`,
|
||||
})
|
||||
.andWhere("kpiRole.kpiPeriodId = :kpiPeriodId", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
|
|
@ -132,6 +144,9 @@ export class kpiRoleController extends Controller {
|
|||
.where("kpiRole.child4Id = :child4Id", {
|
||||
child4Id: requestBody.nodeId,
|
||||
})
|
||||
.andWhere("kpiRole.position LIKE :position", {
|
||||
position: `%${requestBody.position}%`,
|
||||
})
|
||||
.andWhere("kpiRole.kpiPeriodId = :kpiPeriodId", {
|
||||
kpiPeriodId: requestBody.kpiPeriodId,
|
||||
})
|
||||
|
|
@ -306,7 +321,6 @@ export class kpiRoleController extends Controller {
|
|||
@Query("node") node?: number | null,
|
||||
@Query("keyword") keyword?: string,
|
||||
@Query("position") position?: string,
|
||||
@Query("isAll") isAll: boolean = false,
|
||||
) {
|
||||
const [kpiRole, total] = await AppDataSource.getRepository(KpiRole)
|
||||
.createQueryBuilder("kpiRole")
|
||||
|
|
@ -394,6 +408,7 @@ export class kpiRoleController extends Controller {
|
|||
where: {
|
||||
rootId: kpiRole.rootId,
|
||||
child1Id: IsNull(),
|
||||
position: Like(`%${kpiRole.position}%`),
|
||||
},
|
||||
order: {
|
||||
including: "ASC",
|
||||
|
|
@ -404,6 +419,7 @@ export class kpiRoleController extends Controller {
|
|||
where: {
|
||||
child1Id: kpiRole.child1Id,
|
||||
child2Id: IsNull(),
|
||||
position: Like(`%${kpiRole.position}%`),
|
||||
},
|
||||
order: {
|
||||
including: "ASC",
|
||||
|
|
@ -414,6 +430,7 @@ export class kpiRoleController extends Controller {
|
|||
where: {
|
||||
child2Id: kpiRole.child2Id,
|
||||
child3Id: IsNull(),
|
||||
position: Like(`%${kpiRole.position}%`),
|
||||
},
|
||||
order: {
|
||||
including: "ASC",
|
||||
|
|
@ -424,6 +441,7 @@ export class kpiRoleController extends Controller {
|
|||
where: {
|
||||
child3Id: kpiRole.child3Id,
|
||||
child4Id: IsNull(),
|
||||
position: Like(`%${kpiRole.position}%`),
|
||||
},
|
||||
order: {
|
||||
including: "ASC",
|
||||
|
|
@ -433,6 +451,7 @@ export class kpiRoleController extends Controller {
|
|||
remainingKpiRoles = await this.kpiRoleRepository.find({
|
||||
where: {
|
||||
child4Id: kpiRole.child4Id,
|
||||
position: Like(`%${kpiRole.position}%`),
|
||||
},
|
||||
order: {
|
||||
including: "ASC",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue