@RestController
@RequestMapping("/district")
public class DistrictController extends BaseController{
@Autowired
private IDistrictService districtService;
@RequestMapping("/list{parent}")
public ResponseResult<List<District>> getListByParent(@PathVariable("parent") String parent){
List<District> list=districtService.getListByParent(parent);
return new ResponseResult<>(SUCCESS, list);
}
}
![当路径及注解为如图所示时](
https://img-blog.csdnimg.cn/20190711151855506.png
访问的路径为http://localhost:8080/district/list?parent=86
访问的路径为http://localhost:8080/district/list/86
版权声明:本文为weixin_45016089原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。