mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
fix filter purchase supplier repport
This commit is contained in:
@@ -432,6 +432,7 @@ func (c *RepportController) GetProductionResult(ctx *fiber.Ctx) error {
|
|||||||
func parseCommaSeparatedInt64s(raw string) ([]int64, error) {
|
func parseCommaSeparatedInt64s(raw string) ([]int64, error) {
|
||||||
return parseCommaSeparatedInt64sWithField(raw, "supplier_ids")
|
return parseCommaSeparatedInt64sWithField(raw, "supplier_ids")
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseCommaSeparatedInt64sWithField(raw, field string) ([]int64, error) {
|
func parseCommaSeparatedInt64sWithField(raw, field string) ([]int64, error) {
|
||||||
raw = strings.TrimSpace(raw)
|
raw = strings.TrimSpace(raw)
|
||||||
if raw == "" {
|
if raw == "" {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ func (r *purchaseSupplierRepositoryImpl) baseSupplierQuery(ctx context.Context,
|
|||||||
if len(filters.ProductCategoryIDs) > 0 {
|
if len(filters.ProductCategoryIDs) > 0 {
|
||||||
db = db.
|
db = db.
|
||||||
Joins("JOIN products ON products.id = purchase_items.product_id").
|
Joins("JOIN products ON products.id = purchase_items.product_id").
|
||||||
Where("products.product_category_id IN ?", filters.ProductCategoryIDs)
|
Where("products.product_category_id IN ?", filters.ProductCategoryIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(filters.AreaIDs) > 0 || filters.AllowedAreaIDs != nil {
|
if len(filters.AreaIDs) > 0 || filters.AllowedAreaIDs != nil {
|
||||||
@@ -194,7 +194,7 @@ func (r *purchaseSupplierRepositoryImpl) GetItemsBySuppliers(ctx context.Context
|
|||||||
if len(filters.ProductCategoryIDs) > 0 {
|
if len(filters.ProductCategoryIDs) > 0 {
|
||||||
db = db.
|
db = db.
|
||||||
Joins("JOIN products ON products.id = purchase_items.product_id").
|
Joins("JOIN products ON products.id = purchase_items.product_id").
|
||||||
Where("products.product_category_id IN ?", filters.ProductCategoryIDs)
|
Where("products.product_category_id IN ?", filters.ProductCategoryIDs)
|
||||||
}
|
}
|
||||||
if len(filters.AreaIDs) > 0 || filters.AllowedAreaIDs != nil {
|
if len(filters.AreaIDs) > 0 || filters.AllowedAreaIDs != nil {
|
||||||
db = db.Joins("JOIN warehouses ON warehouses.id = purchase_items.warehouse_id")
|
db = db.Joins("JOIN warehouses ON warehouses.id = purchase_items.warehouse_id")
|
||||||
|
|||||||
Reference in New Issue
Block a user