add search all
This commit is contained in:
parent
92b1803db0
commit
c6ed6e72b9
1 changed files with 17 additions and 15 deletions
|
|
@ -387,9 +387,6 @@ export class PositionController extends Controller {
|
|||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: { posDictName: "ASC" },
|
||||
});
|
||||
// if (!findPosDict) {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล " + keyword);
|
||||
// }
|
||||
break;
|
||||
|
||||
case "positionField":
|
||||
|
|
@ -398,9 +395,6 @@ export class PositionController extends Controller {
|
|||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: { posDictField: "ASC" },
|
||||
});
|
||||
// if (!findPosDict) {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล " + keyword);
|
||||
// }
|
||||
break;
|
||||
|
||||
case "positionType":
|
||||
|
|
@ -448,9 +442,6 @@ export class PositionController extends Controller {
|
|||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: { posDictName: "ASC" },
|
||||
});
|
||||
// if (!findPosDict) {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล " + keyword);
|
||||
// }
|
||||
break;
|
||||
|
||||
case "positionArea":
|
||||
|
|
@ -459,19 +450,30 @@ export class PositionController extends Controller {
|
|||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: { posDictName: "ASC" },
|
||||
});
|
||||
// if (!findPosDict) {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล " + keyword);
|
||||
// }
|
||||
break;
|
||||
|
||||
case "all":
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
where: [
|
||||
{ posDictName: Like(`%${keyword}%`) },
|
||||
{ posDictField: Like(`%${keyword}%`) },
|
||||
{ posTypeId: In(await this.posTypeRepository.find({ where: { posTypeName: Like(`%${keyword}%`) }, select: ["id"] }).then(types => types.map(type => type.id))) },
|
||||
{ posLevelId: In(await this.posLevelRepository.find({ where: { posLevelName: Like(`%${keyword}%`) }, select: ["id"] }).then(levels => levels.map(level => level.id))) },
|
||||
{ posExecutiveId: In(await this.posExecutiveRepository.find({ where: { posExecutiveName: Like(`%${keyword}%`) }, select: ["id"] }).then(executives => executives.map(exec => exec.id))) },
|
||||
{ posDictExecutiveField: Like(`%${keyword}%`) },
|
||||
{ posDictArea: Like(`%${keyword}%`) }
|
||||
],
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: { posDictName: "ASC" },
|
||||
});
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
findPosDict = await this.posDictRepository.find({
|
||||
relations: ["posType", "posLevel", "posExecutive"],
|
||||
order: { posDictName: "ASC" },
|
||||
});
|
||||
// if (!findPosDict) {
|
||||
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue