check query

This commit is contained in:
AdisakKanthawilang 2024-02-20 15:21:26 +07:00
parent ac36b37612
commit f4305c895e

View file

@ -36,7 +36,7 @@ import { Position } from "../entities/Position";
import { Profile } from "../entities/Profile"; import { Profile } from "../entities/Profile";
@Route("api/v1/org/pos") @Route("api/v1/org/pos")
@Tags("Position") @Tags("Position")
// @Security("bearerAuth") @Security("bearerAuth")
@Response( @Response(
HttpStatusCode.INTERNAL_SERVER_ERROR, HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
@ -992,7 +992,13 @@ export class PositionController extends Controller {
.leftJoinAndSelect("posMaster.current_holder", "current_holder") .leftJoinAndSelect("posMaster.current_holder", "current_holder")
.leftJoinAndSelect("posMaster.next_holder", "next_holder") .leftJoinAndSelect("posMaster.next_holder", "next_holder")
.where(conditions) .where(conditions)
.orWhere(searchShortName) .orWhere(
new Brackets((qb) => {
qb.where(searchShortName)
.andWhere(checkChildConditions)
.andWhere(typeCondition)
}),
)
.orWhere( .orWhere(
new Brackets((qb) => { new Brackets((qb) => {
qb.where( qb.where(
@ -1004,7 +1010,7 @@ export class PositionController extends Controller {
}, },
) )
.andWhere(checkChildConditions) .andWhere(checkChildConditions)
.andWhere(typeCondition); .andWhere(typeCondition)
}), }),
) )
.orderBy("posMaster.posMasterOrder", "ASC") .orderBy("posMaster.posMasterOrder", "ASC")