zhou.xiaoning пре 5 година
родитељ
комит
ac40dc8d62
1 измењених фајлова са 5 додато и 1 уклоњено
  1. 5 1
      models/hsby.go

+ 5 - 1
models/hsby.go

@@ -956,7 +956,11 @@ func GetHsbyProvincesAndCities(provinceID int) ([]Division, error) {
 
 	divisions := make([]Division, 0)
 	session := engine.Where("DIVISIONLEVEL = 'province' or DIVISIONLEVEL = 'city'").
-		And("AUTOID in ((select DESCPROVINCEID AUTOID from HSBY_GOODSEX) union all (select DESCCITYID AUTOID from HSBY_GOODSEX))")
+		And(`AUTOID in (
+				(select DESCPROVINCEID AUTOID from HSBY_GOODSEX inner join GOODS on GOODS.GOODSID = HSBY_GOODSEX.GOODSID and GOODS.GOODSSTATUS = 3)
+				union all
+				(select DESCCITYID AUTOID from HSBY_GOODSEX inner join GOODS on GOODS.GOODSID = HSBY_GOODSEX.GOODSID and GOODS.GOODSSTATUS = 3)
+						)`)
 	if provinceID > 0 {
 		session = session.And("AUTOID = ?", provinceID)
 	}