- create dada store when after jx store created.

This commit is contained in:
gazebo
2019-03-18 16:26:11 +08:00
parent cf2dc1be14
commit 6266315684
2 changed files with 9 additions and 8 deletions

View File

@@ -24,7 +24,7 @@ type StoreDetail struct {
type StoreDetail2 struct {
model.Store
VendorStoreID string `orm:"column(vendor_store_id)`
VendorStoreID string `orm:"column(vendor_store_id)` // 这个在GetMissingDadaStores返回中指的是到家的vendorStoreID
DistrictName string
CityName string
}
@@ -106,13 +106,13 @@ func GetPossibleStoresByPlaceName(db *DaoDB, cityName, provinceName string) (sto
}
// 这个返回的地点信息是城市
func GetMissingDadaStores(db *DaoDB, storeID int) (storeList []*StoreDetail2, err error) {
func GetMissingDadaStores(db *DaoDB, storeID int, isMustHaveJdStore bool) (storeList []*StoreDetail2, err error) {
sql := `
SELECT t1.*,
t2.vendor_store_id,
t2.vendor_store_id vendor_store_id,
city.name city_name, district.name district_name
FROM store t1
JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND t2.deleted_at = ?
LEFT JOIN store_map t2 ON t1.id = t2.store_id AND t2.vendor_id = ? AND t2.deleted_at = ?
JOIN place city ON city.code = t1.city_code
JOIN place district ON district.code = t1.district_code
LEFT JOIN store_courier_map t3 ON t3.store_id = t1.id AND t3.vendor_id = ? AND t3.deleted_at = ?
@@ -125,6 +125,9 @@ func GetMissingDadaStores(db *DaoDB, storeID int) (storeList []*StoreDetail2, er
utils.DefaultTimeValue,
utils.DefaultTimeValue,
}
if isMustHaveJdStore {
sql += " AND t2.id IS NOT NULL"
}
if storeID != 0 {
sql += " AND t1.id = ?"
sqlParams = append(sqlParams, storeID)