12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package com.iamberry.rst.controllers.address;
- import com.iamberry.rst.core.address.City;
- import com.iamberry.rst.core.address.District;
- import com.iamberry.rst.core.address.Province;
- import com.iamberry.rst.faces.address.AddressService;
- import com.iamberry.wechat.tools.ResponseJson;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
- import java.util.List;
- @Controller
- @RequestMapping("/address")
- public class AddressController {
- @Autowired
- private AddressService addressService;
- /**
- * 获取省
- * @param province
- * @return
- */
- @ResponseBody
- @RequestMapping(value = "/list_province")
- ResponseJson listProvince(Province province){
- ResponseJson rj =new ResponseJson(200, "查询成功", 200);
- List<Province> provinceList = addressService.listProvince(province);
- rj.addResponseKeyValue("provinceList", provinceList);
- if (provinceList == null || provinceList.size() < 1) {
- return new ResponseJson(500, "查询失败", 500);
- } else {
- return rj;
- }
- }
- /**
- * 获取市
- * @param city
- * @return
- */
- @ResponseBody
- @RequestMapping(value = "/list_city")
- ResponseJson listCity(City city){
- ResponseJson rj =new ResponseJson(200, "查询成功", 200);
- List<City> cityList = addressService.listCity(city);
- rj.addResponseKeyValue("cityList", cityList);
- if (cityList == null || cityList.size() < 1) {
- return new ResponseJson(500, "查询失败", 500);
- } else {
- return rj;
- }
- }
- /**
- * 获取省
- * @param district
- * @return
- */
- @ResponseBody
- @RequestMapping(value = "/list_district")
- ResponseJson listDistrict(District district){
- ResponseJson rj =new ResponseJson(200, "查询成功", 200);
- List<District> districtList = addressService.listDistrict(district);
- rj.addResponseKeyValue("cityList", districtList);
- if (districtList == null || districtList.size() < 1) {
- return new ResponseJson(500, "查询失败", 500);
- } else {
- return rj;
- }
- }
- }
|