feat: 迁移企业标准库 国内外标准库 懒加载 树结构
This commit is contained in:
+12
-1
@@ -31,11 +31,22 @@ public class SarVppsTreeController extends BaseController<SarVppsTree> {
|
||||
@Autowired
|
||||
private ISarVppsTreeService iSarVppsTreeService;
|
||||
|
||||
@ApiOperation("查询所有资源")
|
||||
@ApiOperation("查询父所有资源")
|
||||
@GetMapping("/list")
|
||||
public ResponseMessage<List<SarVppsTree>> getAll(SarVppsTree sarVppsTree){
|
||||
List<SarVppsTree> tsResources = iSarVppsTreeService.getAll(sarVppsTree);
|
||||
return Result.success(tsResources);
|
||||
}
|
||||
|
||||
@ApiOperation("根据父ID查询子所有资源")
|
||||
@GetMapping("/childByList")
|
||||
public ResponseMessage<List<SarVppsTree>> childByList(String ids){
|
||||
SarVppsTree tree = new SarVppsTree();
|
||||
tree.setId(ids);
|
||||
List<SarVppsTree> tsResources = iSarVppsTreeService.recursionGetChildren(tree);
|
||||
return Result.success(tsResources);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -16,4 +16,6 @@ import java.util.List;
|
||||
public interface ISarVppsTreeService extends IService<SarVppsTree> {
|
||||
|
||||
List<SarVppsTree> getAll(SarVppsTree sarVppsTree);
|
||||
|
||||
List<SarVppsTree> recursionGetChildren(SarVppsTree parent);
|
||||
}
|
||||
|
||||
+6
-5
@@ -29,9 +29,9 @@ public class SarVppsTreeServiceImpl extends ServiceImpl<SarVppsTreeDao, SarVppsT
|
||||
QueryWrapper<SarVppsTree> tsResourceQueryWrapper=new QueryWrapper<>();
|
||||
tsResourceQueryWrapper.isNull("PID");
|
||||
List<SarVppsTree> list = this.baseMapper.selectList(tsResourceQueryWrapper);
|
||||
for(SarVppsTree tree:list){
|
||||
tree.setChildren(recursionGetChildren((tree)));
|
||||
}
|
||||
// for(SarVppsTree tree:list){
|
||||
// tree.setChildren(recursionGetChildren((tree)));
|
||||
// }
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -40,10 +40,11 @@ public class SarVppsTreeServiceImpl extends ServiceImpl<SarVppsTreeDao, SarVppsT
|
||||
* @param parent:父节点
|
||||
* @return List<SarMenu>
|
||||
*/
|
||||
private List<SarVppsTree> recursionGetChildren(SarVppsTree parent){
|
||||
@Override
|
||||
public List<SarVppsTree> recursionGetChildren(SarVppsTree parent){
|
||||
QueryWrapper<SarVppsTree> sarMenuQueryWrapper=new QueryWrapper<>();
|
||||
sarMenuQueryWrapper.orderByAsc("SORT");
|
||||
sarMenuQueryWrapper.eq("PID",parent.getId());
|
||||
sarMenuQueryWrapper.in("PID",parent.getId());
|
||||
List<SarVppsTree> children=this.baseMapper.selectList(sarMenuQueryWrapper);
|
||||
for(SarVppsTree sarMenu:children){
|
||||
sarMenu.setChildren(recursionGetChildren((sarMenu)));
|
||||
|
||||
Reference in New Issue
Block a user