Browse Source

增加区域树

master
WendyYang 1 year ago
parent
commit
3aa2deab87
2 changed files with 39 additions and 1 deletions
  1. +38
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java

+ 38
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/controller/RegionController.java View File

@@ -0,0 +1,38 @@
package com.ningdatech.pmapi.sys.controller;

import com.ningdatech.pmapi.sys.manage.RegionManage;
import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
* <p>
* 前端控制器
* </p>
*
* @author LiuXinXin
* @since 2022-10-08
*/
@Validated
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/region")
@Api(tags = "系统管理-地域管理")
public class RegionController {

private final RegionManage regionManage;

@GetMapping("/tree")
@ApiOperation("获取区域编码的树状结构")
public List<RegionTreeVO> getRegionTree() {
return regionManage.getRegionTree();
}

}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/RegionManage.java View File

@@ -24,7 +24,7 @@ public class RegionManage {

private final IRegionService regionService;

private final static Long ROOT_PARENT_ID = 1L;
private final static Long ROOT_PARENT_ID = 0L;

public List<RegionTreeVO> getRegionTree() {
List<RegionDTO> regions = regionService.queryAll();


Loading…
Cancel
Save