feat(backend): 库存接口带出售价 sale_price(库存屏成本价/单价两列地基)
照原型库存表「成本价(进价)+单价(售价)」两列: - 库存查询 SELECT 加 p.sale_price AS sale_price;成本价 unit_price 补 p.purchase_price 兜底 - inventoryRow 加 SalePrice;前端 Inventory model 加 salePrice - 多租户隔离不变(baseWhere 仍 inv.shop_id);库存测试通过 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSKEiHsvauyxYUW2itzUXX
This commit is contained in:
@@ -36,7 +36,8 @@ type inventoryRow struct {
|
||||
Spec string `json:"spec"`
|
||||
Unit string `json:"unit"`
|
||||
WarehouseName string `json:"warehouse_name"`
|
||||
UnitPrice *float64 `json:"unit_price"`
|
||||
UnitPrice *float64 `json:"unit_price"` // 成本价(入库进价)
|
||||
SalePrice *float64 `json:"sale_price"` // 单价(product 售价)
|
||||
ProductionDate *string `json:"production_date"`
|
||||
BatchNo string `json:"batch_no"`
|
||||
SupplierName string `json:"supplier_name"`
|
||||
@@ -131,7 +132,8 @@ func (h *InventoryHandler) List(c *gin.Context) {
|
||||
COALESCE(NULLIF(p.spec,''), NULLIF(sii.spec,''), inv.spec, '') AS spec,
|
||||
COALESCE(NULLIF(p.unit,''), inv.unit, '') AS unit,
|
||||
COALESCE(NULLIF(w.name,''), inv.warehouse_name, '') AS warehouse_name,
|
||||
COALESCE(sii.unit_price, inv.unit_price) AS unit_price,
|
||||
COALESCE(sii.unit_price, inv.unit_price, p.purchase_price) AS unit_price,
|
||||
p.sale_price AS sale_price,
|
||||
COALESCE(DATE(sii.production_date), DATE(inv.production_date)) AS production_date,
|
||||
COALESCE(NULLIF(sii.batch_no,''), inv.batch_no, '') AS batch_no,
|
||||
inv.supplier_name,
|
||||
|
||||
Reference in New Issue
Block a user