เพิ่มฟิว API

This commit is contained in:
AdisakKanthawilang 2024-07-15 11:41:20 +07:00
parent 772a0b3a93
commit e777551657

View file

@ -250,6 +250,18 @@ export class KpiUserEvaluationController extends Controller {
}) })
.orWhere("kpiUserEvaluation.lastName LIKE :keyword", { .orWhere("kpiUserEvaluation.lastName LIKE :keyword", {
keyword: `%${requestBody.keyword}%`, keyword: `%${requestBody.keyword}%`,
})
.orWhere("kpiUserEvaluation.org LIKE :keyword", {
keyword: `%${requestBody.keyword}%`,
})
.orWhere("kpiUserEvaluation.position LIKE :keyword", {
keyword: `%${requestBody.keyword}%`,
})
.orWhere("kpiUserEvaluation.posTypeName LIKE :keyword", {
keyword: `%${requestBody.keyword}%`,
})
.orWhere("kpiUserEvaluation.posLevelName LIKE :keyword", {
keyword: `%${requestBody.keyword}%`,
}); });
}), }),
) )
@ -258,7 +270,14 @@ export class KpiUserEvaluationController extends Controller {
.take(requestBody.pageSize) .take(requestBody.pageSize)
.getManyAndCount(); .getManyAndCount();
const mapData = kpiUserEvaluation.map((item) => ({ const mapData = kpiUserEvaluation.map((item) => {
const fullNameParts = [item.child4, item.child3, item.child2, item.child1, item.org];
const organization = fullNameParts
.filter((part) => part !== undefined && part !== null)
.join("/");
return {
id: item.id, id: item.id,
profileId: item.profileId, profileId: item.profileId,
prefix: item.prefix, prefix: item.prefix,
@ -271,7 +290,16 @@ export class KpiUserEvaluationController extends Controller {
evaluatorId: item.evaluatorId, evaluatorId: item.evaluatorId,
commanderId: item.commanderId, commanderId: item.commanderId,
commanderHighId: item.commanderHighId, commanderHighId: item.commanderHighId,
})); root: item.org,
rootId: item.orgId,
position: item.position,
// posTypeId: item.posTypeId,
posTypeName: item.posTypeName,
// posLevelId: item.posLevelId,
posLevelName: item.posLevelName,
organization: organization,
};
});
return new HttpSuccess({ data: mapData, total }); return new HttpSuccess({ data: mapData, total });
} }