| | |
| | | package com.moral.controller; |
| | | |
| | | import com.moral.common.bean.Constants; |
| | | import com.moral.common.bean.ResultBean; |
| | | import com.moral.entity.Area; |
| | | import com.moral.entity.City; |
| | | import com.moral.entity.Province; |
| | | import com.moral.entity.Town; |
| | | import com.moral.entity.Village; |
| | | import com.moral.service.AreaService; |
| | | import org.springframework.web.bind.annotation.CrossOrigin; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | public class AreaController { |
| | | @Resource |
| | | AreaService areaService; |
| | | |
| | | @GetMapping("getfullnames") |
| | | public ResultBean<String> getFullNames(Long code){ |
| | | return new ResultBean<>(areaService.queryFullNameByCode(code)); |
| | | } |
| | | @GetMapping("get-provinces") |
| | | public ResultBean<List<Province>> getProvinces(){ |
| | | ResultBean<List<Province>> resultBean = new ResultBean<>(); |
| | |
| | | resultBean.setCode(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | |
| | | @GetMapping("get-towns") |
| | | public ResultBean<List<Town>> getTowns(int areaCode){ |
| | | ResultBean<List<Town>> resultBean = new ResultBean<>(); |
| | | List<Town> list = areaService.getTowns(areaCode); |
| | | resultBean.setData(list); |
| | | resultBean.setCode(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | |
| | | @GetMapping("get-villages") |
| | | public ResultBean<List<Village>> getVillages(Long townCode){ |
| | | ResultBean<List<Village>> resultBean = new ResultBean<>(); |
| | | List<Village> list = areaService.getVillages(townCode); |
| | | resultBean.setData(list); |
| | | resultBean.setCode(ResultBean.SUCCESS); |
| | | return resultBean; |
| | | } |
| | | } |