|
@@ -0,0 +1,45 @@
|
|
|
+package com.ym.mec.student.controller;
|
|
|
+
|
|
|
+import com.ym.mec.biz.dal.dto.TreeDto;
|
|
|
+import com.ym.mec.biz.service.SysAreaService;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+@RequestMapping("${app-config.url.student:}/area")
|
|
|
+@Api(tags = "区域服务")
|
|
|
+@RestController
|
|
|
+public class SysAreaController extends BaseController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private SysAreaService sysAreaService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据父节点查询区域树状列表(递归)")
|
|
|
+ @GetMapping("/queryTree")
|
|
|
+ public Object queryPage(TreeDto treeDto){
|
|
|
+ if(treeDto.getParentId() == 0){
|
|
|
+ return failed("非法参数");
|
|
|
+ }
|
|
|
+ return succeed(sysAreaService.queryTreePage(treeDto));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据父节点查询下一级子节点列表(不递归)")
|
|
|
+ @GetMapping("/queryChild")
|
|
|
+ public Object queryChild(TreeDto treeDto){
|
|
|
+ return succeed(sysAreaService.queryChild(treeDto));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据子级区域获取父级节点")
|
|
|
+ @GetMapping("/getParentArea/{id}")
|
|
|
+ @ApiParam(value = "区域编号", required = true)
|
|
|
+ public Object getParentArea( @PathVariable("id") Integer id){
|
|
|
+ return succeed(sysAreaService.getParentArea(id));
|
|
|
+ }
|
|
|
+}
|