filter ประเภทลูกจ้าง

This commit is contained in:
Bright 2024-05-13 11:33:22 +07:00
parent 73cd6ba4eb
commit aa7dd54230

View file

@ -199,6 +199,7 @@ export class ProfileEmployeeController extends Controller {
@Query() yearLeave?: number, @Query() yearLeave?: number,
@Query() isProbation?: boolean, @Query() isProbation?: boolean,
@Query() isRetire?: boolean, @Query() isRetire?: boolean,
@Query() type?: string,
) { ) {
let queryLike = let queryLike =
"CONCAT(profileEmployee.prefix, profileEmployee.firstName, ' ', profileEmployee.lastName) LIKE :keyword"; "CONCAT(profileEmployee.prefix, profileEmployee.firstName, ' ', profileEmployee.lastName) LIKE :keyword";
@ -254,6 +255,14 @@ export class ProfileEmployeeController extends Controller {
: `profile.dateRetire IS NOT NULL` : `profile.dateRetire IS NOT NULL`
: "1=1", : "1=1",
) )
.andWhere(
type !== undefined && type !== null && type !== ""
? "profileEmployee.employeeClass LIKE :type"
: "1=1",
{
type: `%${type}%`,
}
)
.skip((page - 1) * pageSize) .skip((page - 1) * pageSize)
.take(pageSize) .take(pageSize)
.getManyAndCount(); .getManyAndCount();