@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://www.icode9.com/i/ll/?i=20190711151855506.png
访问的路径为http://localhost:8080/district/list?parent=86
访问的路径为http://localhost:8080/district/list/86