From da2be28821d8f3cedadcb74a3a5c0b879ece37c7 Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Thu, 24 Oct 2024 08:06:46 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=20=E8=8E=B7=E5=8F=96=E5=AD=90?= =?UTF-8?q?=E9=9B=86=E5=9C=B0=E5=8C=BATREE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/luoo/user/controller/RegionController.java | 10 ++++++++++ .../src/main/java/com/luoo/user/dao/RegionDao.java | 2 ++ .../main/java/com/luoo/user/service/RegionService.java | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/luoo_user/src/main/java/com/luoo/user/controller/RegionController.java b/luoo_user/src/main/java/com/luoo/user/controller/RegionController.java index a681839..994171a 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/RegionController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/RegionController.java @@ -1,11 +1,15 @@ package com.luoo.user.controller; import api.Result; +import com.luoo.user.pojo.Region; import com.luoo.user.service.RegionService; import com.luoo.user.vo.RegionVo; import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import java.util.List; + +import io.swagger.annotations.ApiParam; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; @@ -43,4 +47,10 @@ public class RegionController { return Result.success(regionService.getRegionTreeList(level)); } + @ApiOperation(value = "获取子集地区TREE") + @GetMapping("/tree/child/{parentId}") + public Result> getRegionTreeListByParentId(@ApiParam(value = "查询的父id,如果是最上层,parentId=0", required = true) @PathVariable Integer parentId) { + return Result.success(regionService.getRegionTreeListByParentId(parentId)); + } + } diff --git a/luoo_user/src/main/java/com/luoo/user/dao/RegionDao.java b/luoo_user/src/main/java/com/luoo/user/dao/RegionDao.java index 307b7b4..bf691ae 100644 --- a/luoo_user/src/main/java/com/luoo/user/dao/RegionDao.java +++ b/luoo_user/src/main/java/com/luoo/user/dao/RegionDao.java @@ -10,4 +10,6 @@ public interface RegionDao extends JpaRepository, List getRegionsByLevel(Integer level); + List getRegionsByPid(Integer parentId); + } diff --git a/luoo_user/src/main/java/com/luoo/user/service/RegionService.java b/luoo_user/src/main/java/com/luoo/user/service/RegionService.java index dcf7313..9ce8b58 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/RegionService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/RegionService.java @@ -166,5 +166,9 @@ public class RegionService { return !getChildList(list, t).isEmpty(); } + public List getRegionTreeListByParentId(Integer parentId) { + return regionDao.getRegionsByPid(parentId); + } + }