未营业门店,授权,改营业范围
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
)
|
||||
|
||||
@@ -33,6 +34,12 @@ type StatisticsReportForOrdersList struct {
|
||||
OperatorName2 string `json:"operatorName2"`
|
||||
}
|
||||
|
||||
type PriceReferSnapshotExt struct {
|
||||
model.PriceReferSnapshot
|
||||
CityName string `json:"cityName"`
|
||||
SkuName string `json:"skuName"`
|
||||
}
|
||||
|
||||
//查询统计订单信息
|
||||
func GetStatisticsReportForOrders(db *DaoDB, storeIDs []int, fromDate time.Time, toDate time.Time) (statisticsReportForOrdersList []*StatisticsReportForOrdersList, err error) {
|
||||
sql := `
|
||||
@@ -234,26 +241,27 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func GetPriceReferSnapshot(db *DaoDB, cityCodes, skuIDs []int, snapDate time.Time, offset, pageSize int) (priceReferSnapshot []*model.PriceReferSnapshot, totalCount int, err error) {
|
||||
func GetPriceReferSnapshot(db *DaoDB, cityCodes, skuIDs []int, snapDate time.Time, offset, pageSize int) (priceReferSnapshot []*PriceReferSnapshotExt, totalCount int, err error) {
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS *
|
||||
FROM price_refer_snapshot
|
||||
SELECT SQL_CALC_FOUND_ROWS a.*,b.name city_name
|
||||
FROM price_refer_snapshot a
|
||||
JOIN place b ON a.city_code = b.code
|
||||
WHERE 1=1
|
||||
AND deleted_at = ?
|
||||
AND a.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if len(skuIDs) > 0 {
|
||||
sql += " AND sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"
|
||||
sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"
|
||||
sqlParams = append(sqlParams, skuIDs)
|
||||
}
|
||||
if len(cityCodes) > 0 {
|
||||
sql += " AND city_code IN (" + GenQuestionMarks(len(cityCodes)) + ")"
|
||||
sql += " AND a.city_code IN (" + GenQuestionMarks(len(cityCodes)) + ")"
|
||||
sqlParams = append(sqlParams, cityCodes)
|
||||
}
|
||||
if !utils.IsTimeZero(snapDate) {
|
||||
sql += " AND snapshot_at = ?"
|
||||
sql += " AND a.snapshot_at = ?"
|
||||
sqlParams = append(sqlParams, snapDate)
|
||||
}
|
||||
sql += " LIMIT ? OFFSET ?"
|
||||
@@ -263,5 +271,14 @@ func GetPriceReferSnapshot(db *DaoDB, cityCodes, skuIDs []int, snapDate time.Tim
|
||||
if err = GetRows(db, &priceReferSnapshot, sql, sqlParams...); err == nil {
|
||||
totalCount = GetLastTotalRowCount(db)
|
||||
}
|
||||
for _, v := range priceReferSnapshot {
|
||||
skuList, err2 := GetSkus(db, []int{v.SkuID}, nil, nil, nil)
|
||||
err = err2
|
||||
if len(skuList) > 0 {
|
||||
skuAndName := skuList[0]
|
||||
jxSkuDetailName := jxutils.ComposeSkuName(skuAndName.Prefix, skuAndName.Name, skuAndName.Comment, skuAndName.Unit, skuAndName.SpecQuality, skuAndName.SpecUnit, 0)
|
||||
v.SkuName = jxSkuDetailName
|
||||
}
|
||||
}
|
||||
return priceReferSnapshot, totalCount, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user