แก้คิวรี่ค้นหาคนในระบบเงินเดือน

This commit is contained in:
Kittapath 2024-02-29 13:40:49 +07:00
parent a8b77ec2fb
commit 6791dde26f

View file

@ -441,7 +441,13 @@ export class SalaryPeriodController extends Controller {
async GetListsSalaryProfile(
@Path() id: string,
@Body()
body: { page: number; pageSize: number; keyword?: string; type?: any; isRetire?: boolean },
body: {
page: number;
pageSize: number;
keyword?: string;
type?: any;
isRetire?: boolean | null;
},
) {
const salaryOrg = await this.salaryOrgRepository.findOne({
where: {
@ -455,12 +461,10 @@ export class SalaryPeriodController extends Controller {
.createQueryBuilder("profile")
.andWhere(
new Brackets((qb) => {
qb.andWhere(body.type != null && body.type != "" ? "profile.type LIKE :type" : "1=1", {
type: `%${body.type.toUpperCase()}%`,
qb.andWhere(body.type != null && body.type != "" ? `profile.type LIKE :type` : "1=1", {
type: body.type == null ? "" : `%${body.type.toUpperCase()}%`,
})
.andWhere(body.isRetire != null ? "profile.isRetire = :isRetire" : "1=1", {
isRetire: `${body.isRetire}`,
})
.andWhere(body.isRetire != null ? `profile.isRetired = ${body.isRetire}` : "1=1")
.andWhere({
salaryOrgId: salaryOrg.id,
})