Commit 7de139c1 by 杨树贤

修改取数据逻辑

parent ff3b57b5
......@@ -14,9 +14,13 @@ import (
)
func StatisticsSuppliersSkuNum() (err error) {
var num int
total, _ := Dao.GetDb("supplier").Table("lie_supplier_channel").Where("is_type = ?", 0).Count()
for i := 0; i < int(total); i = i + 100 {
supplier := new(model.Supplier)
//先去根据供应商内部编码找出对应的supplierId
rows, err := Dao.GetDb("supplier").Table("lie_supplier_channel").Where("is_type = ?", 0).OrderBy("supplier_id desc").Rows(supplier)
rows, err := Dao.GetDb("supplier").Table("lie_supplier_channel").Limit(100, i).
Where("is_type = ?", 0).OrderBy("supplier_id desc").Rows(supplier)
if err != nil {
return err
}
......@@ -24,9 +28,7 @@ func StatisticsSuppliersSkuNum() (err error) {
supplierSkuNum := new(model.Supplier)
supplier.AverageSkuNum = 0
_, err = Dao.GetDb("supplier").Table("lie_supplier_channel").Where("supplier_id >= ?", 1).MustCols("average_sku_num").Update(supplierSkuNum)
defer rows.Close()
var num int
for rows.Next() {
err = rows.Scan(supplier)
//去es查询sku数量
......@@ -87,6 +89,8 @@ func StatisticsSuppliersSkuNum() (err error) {
}
}
}
fmt.Println("执行完成,有上传sku的供应商数量为 : ", num)
return
}
......
......@@ -7,10 +7,10 @@ import (
func StatisticsSupplierSkuStatus() (err error) {
fmt.Println("开始统计")
err = dao.StatisticsSkuCreateTime()
if err != nil {
return err
}
//err = dao.StatisticsSkuCreateTime()
//if err != nil {
// return err
//}
//先找出所有需要判断的供应商
err = dao.StatisticsSuppliersSkuNum()
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment