release: 获取子集地区TREE

release-2024-04-25
huangyw 1 month ago
parent 32f48d6da8
commit da2be28821

@ -1,11 +1,15 @@
package com.luoo.user.controller; package com.luoo.user.controller;
import api.Result; import api.Result;
import com.luoo.user.pojo.Region;
import com.luoo.user.service.RegionService; import com.luoo.user.service.RegionService;
import com.luoo.user.vo.RegionVo; import com.luoo.user.vo.RegionVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.List; import java.util.List;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
@ -43,4 +47,10 @@ public class RegionController {
return Result.success(regionService.getRegionTreeList(level)); return Result.success(regionService.getRegionTreeList(level));
} }
@ApiOperation(value = "获取子集地区TREE")
@GetMapping("/tree/child/{parentId}")
public Result<List<Region>> getRegionTreeListByParentId(@ApiParam(value = "查询的父id如果是最上层parentId=0", required = true) @PathVariable Integer parentId) {
return Result.success(regionService.getRegionTreeListByParentId(parentId));
}
} }

@ -10,4 +10,6 @@ public interface RegionDao extends JpaRepository<Region, Integer>,
List<Region> getRegionsByLevel(Integer level); List<Region> getRegionsByLevel(Integer level);
List<Region> getRegionsByPid(Integer parentId);
} }

@ -166,5 +166,9 @@ public class RegionService {
return !getChildList(list, t).isEmpty(); return !getChildList(list, t).isEmpty();
} }
public List<Region> getRegionTreeListByParentId(Integer parentId) {
return regionDao.getRegionsByPid(parentId);
}
} }

Loading…
Cancel
Save