- GetStores输出vendorStoreName

This commit is contained in:
gazebo
2019-04-18 11:23:55 +08:00
parent c36ecbdd54
commit 42461361fc

View File

@@ -94,12 +94,21 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
t1.printer_vendor_id,
city.name city_name,
district.name district_name,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"vendorStoreID":"', m1.vendor_store_id, '", "vendorID":', m1.vendor_id, ', "status":', m1.status, ', "pricePercentage":', m1.price_percentage, '}')), ']') store_map_str,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"vendorStoreID":"', m1.vendor_store_id, '", "vendorID":', m1.vendor_id,
', "status":', m1.status, ', "pricePercentage":', m1.price_percentage, ', "vendorStoreName":"',
CASE m1.vendor_id
WHEN 0 THEN IF(jd.name IS NULL, '', jd.name)
WHEN 3 THEN IF(eb.col_name IS NULL, '', eb.col_name)
ELSE ''
END,
'"}')), ']') store_map_str,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"vendorStoreID":"', m2.vendor_store_id, '", "vendorID":', m2.vendor_id, ', "status":', m2.status, "}")), "]") courier_map_str
FROM store t1
LEFT JOIN place city ON t1.city_code = city.code AND city.level = 2
LEFT JOIN place district ON t1.district_code = district.code AND district.level = 3
LEFT JOIN store_map m1 ON t1.id = m1.store_id AND m1.deleted_at = ?
LEFT JOIN ebde_shops eb ON eb.col_baidu_shop_id = m1.vendor_store_id
LEFT JOIN jde_store jd ON jd.jdid = m1.vendor_store_id
LEFT JOIN store_courier_map m2 ON t1.id = m2.store_id AND m2.deleted_at = ?
`
sqlParams := []interface{}{
@@ -134,7 +143,7 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
sqlVendorStoreCond += " AND ( 1 = 0"
}
}
sql += " LEFT JOIN " + tableName + " " + tableAlias + " ON " + tableAlias + ".vendor_id = ? AND " + tableAlias + ".store_id = t1.id AND " + tableAlias + ".deleted_at = ?"
sql += "\nLEFT JOIN " + tableName + " " + tableAlias + " ON " + tableAlias + ".vendor_id = ? AND " + tableAlias + ".store_id = t1.id AND " + tableAlias + ".deleted_at = ?"
sqlParams = append(sqlParams, vendor, utils.DefaultTimeValue)
if cond == 1 {
sqlVendorStoreCond += " " + mapCond + " " + tableAlias + ".id IS NOT NULL"