ค้นหาทะเบียนประวัติ
This commit is contained in:
parent
b216b20c77
commit
e2b65aaabf
1 changed files with 30 additions and 23 deletions
|
|
@ -245,35 +245,42 @@ export class ProfileController extends Controller {
|
||||||
"posLevelId",
|
"posLevelId",
|
||||||
"posTypeId",
|
"posTypeId",
|
||||||
],
|
],
|
||||||
|
where: {
|
||||||
|
citizenId: Like(`%${keyword}%`),
|
||||||
|
position: Like(`%${keyword}%`),
|
||||||
|
prefix: Like(`%${keyword}%`),
|
||||||
|
firstName: Like(`%${keyword}%`),
|
||||||
|
lastName: Like(`%${keyword}%`),
|
||||||
|
// posLevel: { posLevelName: keyword },
|
||||||
|
// posType: { posTypeName: Like(`%${keyword}%`) },
|
||||||
|
// salaryEmployeeMins: { group: keyword },
|
||||||
|
// salaryEmployee: { group: keyword },
|
||||||
|
},
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
skip: (page - 1) * pageSize,
|
skip: (page - 1) * pageSize,
|
||||||
take: pageSize,
|
take: pageSize,
|
||||||
});
|
});
|
||||||
if (keyword != undefined && keyword !== "") {
|
// if (keyword != undefined && keyword !== "") {
|
||||||
const formattedKeyword = keyword.toLowerCase().replace(/\s+/g, "");
|
// const formattedKeyword = keyword.toLowerCase().replace(/\s+/g, "");
|
||||||
const filteredProfile = profile.filter(
|
// const filteredProfile = profile.filter(
|
||||||
(x) =>
|
// (x) =>
|
||||||
(x.prefix + x.firstName + x.lastName).replace(/\s+/g, "").includes(formattedKeyword) ||
|
// (x.prefix + x.firstName + x.lastName).replace(/\s+/g, "").includes(formattedKeyword) ||
|
||||||
x.citizenId?.toString().includes(keyword) ||
|
// x.citizenId?.toString().includes(keyword) ||
|
||||||
x.position?.toString().includes(keyword),
|
// x.position?.toString().includes(keyword),
|
||||||
);
|
// );
|
||||||
|
|
||||||
const formattedData = filteredProfile.map((item) => ({
|
// const formattedData = filteredProfile.map((item) => ({
|
||||||
id: item.id,
|
// id: item.id,
|
||||||
prefix: item.prefix,
|
// prefix: item.prefix,
|
||||||
firstName: item.firstName,
|
// firstName: item.firstName,
|
||||||
lastName: item.lastName,
|
// lastName: item.lastName,
|
||||||
citizenId: item.citizenId,
|
// citizenId: item.citizenId,
|
||||||
position: item.position,
|
// position: item.position,
|
||||||
posLevelId: item.posLevelId,
|
// posLevelId: item.posLevelId,
|
||||||
posTypeId: item.posTypeId,
|
// posTypeId: item.posTypeId,
|
||||||
}));
|
// }));
|
||||||
|
|
||||||
return new HttpSuccess({ data: formattedData, total: formattedData.length });
|
// return new HttpSuccess({ data: formattedData, total: formattedData.length });
|
||||||
}
|
|
||||||
|
|
||||||
// if (!profile) {
|
|
||||||
// return new HttpSuccess([]);
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const formattedData = profile.map((item) => ({
|
const formattedData = profile.map((item) => ({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue