|
@ -0,0 +1,44 @@
|
|
|
|
package com.yihu.wlyy.web.common.area;
|
|
|
|
|
|
|
|
import com.yihu.wlyy.entity.address.Town;
|
|
|
|
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
|
|
|
|
import com.yihu.wlyy.service.common.area.AreaService;
|
|
|
|
import com.yihu.wlyy.web.BaseController;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by lyr-pc on 2016/11/22.
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping(value = "/area")
|
|
|
|
@Api(description = "城市、城镇管理")
|
|
|
|
public class AreaController extends BaseController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
AreaService areaService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询城市下的城镇
|
|
|
|
*
|
|
|
|
* @param city 城市
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@RequestMapping(value = "/{city}/towns", method = RequestMethod.GET)
|
|
|
|
public String getCityTowns(@PathVariable String city) {
|
|
|
|
try {
|
|
|
|
List<Town> towns = areaService.getCityTowns(city);
|
|
|
|
return write(200, "查询成功", "data", towns == null ? new ArrayList<Town>() : towns);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return error(-1, "查询失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|