feat(backend): 库存按商品过滤 + 香型(分类)字典 CRUD
商品域富数据/重组所需后端: - GET /inventory 加 product_id 过滤 → 解锁商品详情「当前库存/货值/各仓库分布」 (配合已支持 product_id 的 /inventory/logs,详情可拼出大半富数据) - 新增 /product-options/categories 香型字典 CRUD(ProductCategory 模型已存在, 补管理接口)→ 商品列表 5-tab 重组的最后一块字典 均守多租户 shop_id;新增 3 个测试(FilterByProduct/CategoryCRUD/CategoryIsolation)。 go build/vet/test 全过。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
@@ -99,6 +99,11 @@ func (h *InventoryHandler) List(c *gin.Context) {
|
||||
args = append(args, strings.TrimSpace(s))
|
||||
}
|
||||
}
|
||||
// 按商品过滤(商品详情:当前库存 / 货值 / 各仓库分布)
|
||||
if productIDStr := c.Query("product_id"); productIDStr != "" {
|
||||
baseWhere += " AND inv.product_id = ?"
|
||||
args = append(args, productIDStr)
|
||||
}
|
||||
|
||||
// Count query
|
||||
countSQL := `
|
||||
|
||||
Reference in New Issue
Block a user