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:
wangjia
2026-06-25 15:07:49 +08:00
parent c4dcaaf4cd
commit a51a44056d
5 changed files with 169 additions and 0 deletions
+6
View File
@@ -263,6 +263,12 @@ func Setup(r *gin.Engine, db *gorm.DB) {
opts.PUT("/specs/:id", productOptH.UpdateSpec)
opts.DELETE("/specs/:id", productOptH.DeleteSpec)
// 香型 / 分类字典(ProductCategory
opts.GET("/categories", productOptH.ListCategories)
opts.POST("/categories", productOptH.CreateCategory)
opts.PUT("/categories/:id", productOptH.UpdateCategory)
opts.DELETE("/categories/:id", productOptH.DeleteCategory)
// 商品属性字典(产地/保质期/储存方式/描述文档)
opts.GET("/origins", productAttrH.ListOrigins)
opts.POST("/origins", productAttrH.CreateOrigin)