fix: get list by categories all
This commit is contained in:
parent
6d9ce6f8ec
commit
799cd43983
|
@ -309,11 +309,13 @@ export class ProductService {
|
||||||
supplier = (await this.supplierService.findByActive()).id;
|
supplier = (await this.supplierService.findByActive()).id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(supplier, 'asldklaksd')
|
||||||
|
|
||||||
const baseQuery = this.productRepository
|
const baseQuery = this.productRepository
|
||||||
.createQueryBuilder('product')
|
.createQueryBuilder('product')
|
||||||
.leftJoin('product.sub_categories', 'sub_categories')
|
.leftJoin('product.sub_categories', 'sub_categories')
|
||||||
|
|
||||||
.leftJoin('product.statusHistory', 'status_history')
|
// .leftJoin('product.statusHistory', 'status_history')
|
||||||
|
|
||||||
.leftJoinAndMapOne(
|
.leftJoinAndMapOne(
|
||||||
'product.currentPrice',
|
'product.currentPrice',
|
||||||
|
@ -321,12 +323,27 @@ export class ProductService {
|
||||||
'current_price',
|
'current_price',
|
||||||
'current_price.partner_id is NULL and current_price.end_date is NULL',
|
'current_price.partner_id is NULL and current_price.end_date is NULL',
|
||||||
)
|
)
|
||||||
|
.innerJoinAndMapOne(
|
||||||
|
'product.currentStatus',
|
||||||
|
'product.statusHistory',
|
||||||
|
'history_status',
|
||||||
|
`history_status.status = 'ACTIVE' and history_status.deleted_at is NULL`,
|
||||||
|
{
|
||||||
|
status: 'ACTIVE',
|
||||||
|
},
|
||||||
|
)
|
||||||
.where(
|
.where(
|
||||||
`product.supplier_id = :supplier_id and status_history.status = 'ACTIVE' and status_history.partner_id is NULL`,
|
`product.supplier_id = :supplier_id`,
|
||||||
{
|
{
|
||||||
supplier_id: supplier,
|
supplier_id: supplier,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
.where(
|
||||||
|
`history_status.partner_id is NULL`,
|
||||||
|
{
|
||||||
|
partner_id: null,
|
||||||
|
},
|
||||||
|
)
|
||||||
.select(['product.id'])
|
.select(['product.id'])
|
||||||
.addSelect(['product.name', 'product.code', 'sub_categories.name'])
|
.addSelect(['product.name', 'product.code', 'sub_categories.name'])
|
||||||
.addSelect('(current_price.price + current_price.mark_up_price) as price')
|
.addSelect('(current_price.price + current_price.mark_up_price) as price')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user