This commit is contained in:
suyl
2021-06-07 18:19:52 +08:00
parent 89a036f0ac
commit 9e21b8ed11
2 changed files with 9 additions and 8 deletions

View File

@@ -1103,11 +1103,12 @@ type GetStoresSkusSaleInfoNewResult struct {
SaleCount int `json:"saleCount"` //销量
}
func GetStoresSkusSaleInfoNew(ctx *jxcontext.Context, vendorIDs, storeIDs, skuIDs, skuNameIDs []int, fromTime, toTime string, saleCountBegin, saleCountEnd, sortType int, keyword string, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
func GetStoresSkusSaleInfoNew(ctx *jxcontext.Context, vendorIDs, storeIDs, skuIDs, skuNameIDs []int, fromTime, toTime string, dataMap map[string]interface{}, sortType int, keyword string, offset, pageSize int) (pageInfo *model.PagedInfo, err error) {
var (
db = dao.GetDB()
list []*GetStoresSkusSaleInfoNewResult
)
db.Db = orm.NewOrmUsingDB("c4beta")
if len(storeIDs) == 0 && len(skuIDs) == 0 && keyword == "" {
return nil, fmt.Errorf("请至少输入一个条件查询!")
}
@@ -1147,18 +1148,18 @@ func GetStoresSkusSaleInfoNew(ctx *jxcontext.Context, vendorIDs, storeIDs, skuID
sqlParams = append(sqlParams, "%"+keyword+"%", "%"+keyword+"%", keyword, keyword)
}
sql += " GROUP BY 1, 2, 3, 4, 5"
if saleCountBegin != 0 || saleCountEnd != 0 {
if dataMap["saleCountBegin"] != nil || dataMap["saleCountEnd"] != nil {
sql += " HAVING"
if saleCountBegin != 0 {
if dataMap["saleCountBegin"] != nil {
sql += " sale_count >= ?"
sqlParams = append(sqlParams, saleCountBegin)
sqlParams = append(sqlParams, utils.MustInterface2Int64(dataMap["saleCountBegin"]))
}
if saleCountBegin != 0 && saleCountEnd != 0 {
if dataMap["saleCountBegin"] != nil && dataMap["saleCountEnd"] != nil {
sql += " AND"
}
if saleCountEnd != 0 {
if dataMap["saleCountEnd"] != nil {
sql += " sale_count <= ?"
sqlParams = append(sqlParams, saleCountEnd)
sqlParams = append(sqlParams, utils.MustInterface2Int64(dataMap["saleCountEnd"]))
}
}

View File

@@ -357,7 +357,7 @@ func (c *StoreSkuController) GetStoresSkusSaleInfo() {
if err = jxutils.Strings2Objs(params.StoreIDs, &storeIDs, params.SkuIDs, &skuIDs, params.SkuNameIDs, &skuNameIDs, params.VendorIDs, &vendorIDs); err != nil {
return retVal, "", err
}
retVal, err = cms.GetStoresSkusSaleInfoNew(params.Ctx, vendorIDs, storeIDs, skuIDs, skuNameIDs, params.FromTime, params.ToTime, params.SaleCountBegin, params.SaleCountEnd, params.SortType, params.Keyword, params.Offset, params.PageSize)
retVal, err = cms.GetStoresSkusSaleInfoNew(params.Ctx, vendorIDs, storeIDs, skuIDs, skuNameIDs, params.FromTime, params.ToTime, params.MapData, params.SortType, params.Keyword, params.Offset, params.PageSize)
return retVal, "", err
})
}