From 137441e2396cf231f9d41e5c399038dbfe01433f Mon Sep 17 00:00:00 2001
From: yinbentan <yinbentan@live.com>
Date: 星期二, 16 七月 2024 20:24:55 +0800
Subject: [PATCH] 添加字段,库存报表统计返回结果添加productType(产品类别)、productSpecs(产品规格),产品类别由原来的productType改为productCategory
---
models/month_stats.go | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/models/month_stats.go b/models/month_stats.go
index 7d73f36..f86026f 100644
--- a/models/month_stats.go
+++ b/models/month_stats.go
@@ -9,7 +9,7 @@
)
type (
- // MonthStats 绉诲姩鍘嗗彶
+ // MonthStats 鏈堝害缁熻
MonthStats struct {
WmsModel
Id int `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
@@ -177,7 +177,8 @@
}
if slf.Keyword != "" {
- db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
+ kw := fmt.Sprintf("%%%v%%", slf.Keyword)
+ db = db.Where("product_id like ? or product_name like ?", kw, kw)
}
if slf.Date != "" {
@@ -346,3 +347,12 @@
}
return m
}
+
+func (slf *MonthStatsSearch) Count() (int64, error) {
+ var (
+ total int64
+ db = slf.build()
+ )
+ err := db.Count(&total).Error
+ return total, err
+}
--
Gitblit v1.8.0