ค้นหาเกณลูกจ้าง

This commit is contained in:
Kittapath 2024-03-26 23:07:39 +07:00
parent 43ae1b5b07
commit d3160162df
2 changed files with 4 additions and 28 deletions

View file

@ -230,31 +230,6 @@ export class SalaryEmployeeController extends Controller {
},
...(keyword ? {} : { skip: (page - 1) * pageSize, take: pageSize }),
});
// if (keyword != undefined && keyword !== "") {
// const filteredSalary = salary.filter(
// (x) =>
// x.name?.toString().includes(keyword) ||
// x.group?.toString().includes(keyword) ||
// x.isActive?.toString().includes(keyword) ||
// x.date?.toString().includes(keyword) ||
// x.startDate?.toString().includes(keyword) ||
// x.endDate?.toString().includes(keyword) ||
// x.details?.toString().includes(keyword),
// );
// const formattedData = filteredSalary.map((item) => ({
// id: item.id,
// name: item.name,
// group: item.group,
// isActive: item.isActive,
// date: item.date,
// startDate: item.startDate,
// endDate: item.endDate,
// details: item.details,
// }));
// const slicedData = formattedData.slice((page - 1) * pageSize, page * pageSize);
// return new HttpSuccess({ data: slicedData, total: formattedData.length });
// }
const formattedData = salary.map((item) => ({
id: item.id,

View file

@ -226,15 +226,16 @@ export class SalaryFormulaEmployeeController extends Controller {
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
@Query("posTypeId") posTypeId?: string,
) {
let whereClause: any = {};
if (keyword != undefined && keyword !== "") {
whereClause = {
where: [
{ details: Like(`%${keyword}%`) },
{ details: Like(`%${keyword}%`) },
{ position: Like(`%${keyword}%`) },
{ posType: { posTypeName: Like(`%${keyword}%`)} },
{ posLevel: { posLevelName: Like(`%${keyword}%`)} },
{ posLevel: { posLevelName: Like(`%${keyword}%`) } },
{ posTypeId: Like(`%${posTypeId}%`) },
],
};
}