Commit a2c2367f by 陶光胜

省市区查询

parent 9a1b661e
......@@ -5,6 +5,7 @@ import com.gic.store.dto.CityDTO;
import com.gic.store.dto.CountyDTO;
import com.gic.store.dto.ProvinceDTO;
import javax.xml.ws.Service;
import java.util.List;
......@@ -27,7 +28,15 @@ public interface ProvincesApiService {
*/
ServiceResponse<List<CityDTO>> selectAllCity();
/** @Description: 查询所有地区
/** @Description: 通过省id查询城市
* @author taogs
* @Date 14:29 2019/12/4
* @Param
* @return
*/
ServiceResponse<List<CityDTO>> selectCityByProvinceId(String provinceId);
/** @Description: 查询所有地区
* @author taogs
* @Date 14:07 2019/8/5
* @Param
......
......@@ -16,6 +16,7 @@ import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
......@@ -50,6 +51,20 @@ public class ProvincesApiServiceImpl implements ProvincesApiService {
}
@Override
public ServiceResponse<List<CityDTO>> selectCityByProvinceId(String provinceId) {
ServiceResponse<List<CityDTO>> response = this.selectAllCity();
List<CityDTO> list = new ArrayList<>();
if(response.isSuccess() && CollectionUtils.isNotEmpty(response.getResult())){
for(CityDTO cityDTO : response.getResult()){
if(cityDTO.getProvinceId().equals(provinceId)){
list.add(cityDTO);
}
}
}
return ServiceResponse.success(list);
}
@Override
public ServiceResponse<List<CountyDTO>> selectAllCounty() {
String key = "enterprise:county";
List<CountyDTO> list = (List<CountyDTO>)RedisUtil.getCache(key);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment