checkpoint

This commit is contained in:
AdisakKanthawilang 2024-02-05 11:35:35 +07:00
parent 0acdee9bbc
commit bd6ac8ae3c
2 changed files with 192 additions and 18 deletions

View file

@ -691,29 +691,31 @@ export class PositionController extends Controller {
keywordAsInt = "";
}
masterId = [...new Set(masterId)];
const posMaster = await this.posMasterRepository.find({
where: [
{
...checkChildConditions,
...typeCondition,
},
{
...checkChildConditions,
...typeCondition,
id: In(masterId),
},
{
...checkChildConditions,
...typeCondition,
posMasterNo: Like(`%${keywordAsInt}%`),
},
],
const keywordConditions = [
{
...checkChildConditions,
...typeCondition,
},
{
...checkChildConditions,
...typeCondition,
id: In(masterId),
},
{
...checkChildConditions,
...typeCondition,
posMasterNo: Like(`%${keywordAsInt}%`),
},
];
const [posMaster, total] = await this.posMasterRepository.findAndCount({
where: keywordConditions,
order: { posMasterOrder: "ASC" },
relations: ["orgRoot", "orgChild1", "orgChild2", "orgChild3", "orgChild4"],
skip: (body.page - 1) * body.pageSize,
take: body.pageSize,
});
const total = posMaster.length;
const formattedData = await Promise.all(
posMaster.map(async (posMaster) => {