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

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}") @Put("org/{id}")
async GetListsSalaryProfile( async GetListsSalaryProfile(
@Path() id: string, @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({ const salaryOrg = await this.salaryOrgRepository.findOne({
where: { where: {
@ -452,10 +453,13 @@ export class SalaryPeriodController extends Controller {
} }
const [salaryProfile, total] = await AppDataSource.getRepository(SalaryProfile) const [salaryProfile, total] = await AppDataSource.getRepository(SalaryProfile)
.createQueryBuilder("profile") .createQueryBuilder("profile")
.orWhere( .andWhere(
new Brackets((qb) => { new Brackets((qb) => {
qb.andWhere(body.type != null && body.type != "" ? "profile.type LIKE :type" : "1=1", { qb.andWhere(body.type != null && body.type != "" ? "profile.type LIKE :type" : "1=1", {
type: `%${body.type.toUpperCase()}%`, type: `%${body.type.toUpperCase()}%`,
})
.andWhere(body.isRetire != null ? "profile.isRetire = :isRetire" : "1=1", {
isRetire: `${body.isRetire}`,
}) })
.andWhere({ .andWhere({
salaryOrgId: salaryOrg.id, salaryOrgId: salaryOrg.id,