fix search ออกคำสั่ง

This commit is contained in:
AdisakKanthawilang 2024-10-08 10:09:56 +07:00
parent 3871ec5f9f
commit cb4fc6defb

View file

@ -88,18 +88,6 @@ export class CommandController extends Controller {
) {
const [commands, total] = await this.commandRepository
.createQueryBuilder("command")
.andWhere(
new Brackets((qb) => {
qb.where(keyword != null && keyword != "" ? "command.commandNo LIKE :keyword" : "1=1", {
keyword: `%${keyword}%`,
}).orWhere(
keyword != null && keyword != "" ? "command.createdFullName LIKE :keyword" : "1=1",
{
keyword: `%${keyword}%`,
},
);
}),
)
.andWhere(
status != null && status != undefined && status != ""
? "command.status IN (:...status)"
@ -133,6 +121,18 @@ export class CommandController extends Controller {
: `${commandTypeId}`,
},
)
.andWhere(
new Brackets((qb) => {
qb.where(keyword != null && keyword != "" ? "command.commandNo LIKE :keyword" : "1=1", {
keyword: `%${keyword}%`,
}).orWhere(
keyword != null && keyword != "" ? "command.issue LIKE :keyword" : "1=1",
{
keyword: `%${keyword}%`,
},
);
}),
)
.orderBy("command.createdAt", "DESC")
.skip((page - 1) * pageSize)
.take(pageSize)