ค้นหาคนเกษียญ

This commit is contained in:
Kittapath 2024-02-29 12:08:11 +07:00
parent b8e4e8270b
commit a8b77ec2fb

View file

@ -440,7 +440,8 @@ export class SalaryPeriodController extends Controller {
@Put("org/{id}")
async GetListsSalaryProfile(
@Path() id: string,
@Body() body: { page: number; pageSize: number; keyword?: string; type: string },
@Body()
body: { page: number; pageSize: number; keyword?: string; type?: any; isRetire?: boolean },
) {
const salaryOrg = await this.salaryOrgRepository.findOne({
where: {
@ -452,11 +453,14 @@ export class SalaryPeriodController extends Controller {
}
const [salaryProfile, total] = await AppDataSource.getRepository(SalaryProfile)
.createQueryBuilder("profile")
.orWhere(
.andWhere(
new Brackets((qb) => {
qb.andWhere(body.type != null && body.type != "" ? "profile.type LIKE :type" : "1=1", {
type: `%${body.type.toUpperCase()}%`,
})
.andWhere(body.isRetire != null ? "profile.isRetire = :isRetire" : "1=1", {
isRetire: `${body.isRetire}`,
})
.andWhere({
salaryOrgId: salaryOrg.id,
})