门店红线-写入和统计数据

This commit is contained in:
Rosy-zhudan
2019-09-30 10:45:29 +08:00
parent b9e0145cd5
commit ec6565992f
4 changed files with 120 additions and 18 deletions

View File

@@ -36,7 +36,8 @@ type StoreAlert struct {
type StoreAlertEx struct {
StoreAlert
StoreName string `json:"storeName"`
StoreName string `orm:"column(store_name)" json:"storeName"`
CityName string `orm:"column(city_name)" json:"cityName"`
}
type StoreAlertProperty struct {
@@ -49,6 +50,8 @@ type StoreAlertAdvanced struct {
CreatedTime time.Time `json:"createdTime"`
AlertDate time.Time `json:"alertDate"`
StoreID int `json:"storeID"`
StoreName string `json:"storeName"`
CityName string `json:"cityName"`
PickTimeDaDa StoreAlertProperty
BadComment StoreAlertProperty
@@ -64,8 +67,8 @@ type StoreAlertAdvanced struct {
}
type StoreAlertData struct {
StoreAlertList []*StoreAlertEx `json:"storeAlertList"`
TotalCount int `json:"totalCount"`
StoreAlertList []*StoreAlertAdvanced `json:"storeAlertList"`
TotalCount int `json:"totalCount"`
}
type StoreOrderTime struct {

View File

@@ -12,17 +12,16 @@ func InsertStoreAlert(storeAlert *model.StoreAlert) error {
return CreateEntity(nil, storeAlert)
}
func GetStoreAlertList(db *DaoDB, storeIDList []int, cityCode int, keyWord string, beginTime, endTime time.Time) (storeAlertList []*model.StoreAlertEx, err error) {
func GetStoreAlertList(db *DaoDB, storeIDList []int, cityCode int, keyWord string, dateTime time.Time) (storeAlertList []*model.StoreAlertEx, err error) {
sql := `
SELECT t1.*
SELECT t1.*, t2.name store_name, t3.name city_name
FROM store_alert t1
JOIN store t2 ON t1.store_id = t2.id
JOIN place t3 ON t2.city_code = t3.code
WHERE DATE(t1.alert_date) >= DATE(?) AND DATE(t1.alert_date) <= DATE(?)
WHERE DATE(t1.alert_date) = DATE(?)
`
sqlParams := []interface{}{
beginTime,
endTime,
dateTime,
}
if len(storeIDList) > 0 {
sql += `