chore: release server-v1.0.77
Deploy Server / release-deploy-server (push) Successful in 1m32s

出库列表按商品编码精确反查 + stock_out_items(shop_id,product_code) 索引

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
This commit is contained in:
wangjia
2026-06-22 22:24:43 +08:00
parent 078fab30f0
commit 6570dfc240
5 changed files with 55 additions and 1 deletions
+7
View File
@@ -50,6 +50,13 @@ func (h *StockOutHandler) List(c *gin.Context) {
like, shopID, like,
)
}
// 按商品编码反查单据:精确匹配,走 idx_so_items_shop_code(shop_id, product_code) 索引
if code := strings.TrimSpace(c.Query("product_code")); code != "" {
query = query.Where(
"id IN (SELECT order_id FROM stock_out_items WHERE shop_id = ? AND product_code = ? AND deleted_at IS NULL)",
shopID, code,
)
}
var total int64
query.Count(&total)