浏览代码

fix:表格功能修改

侯茂昌 1 年之前
父节点
当前提交
5b81b17284

+ 101 - 125
zkqy-admin/src/main/java/com/zkqy/web/controller/dragForm/CommonBtnController.java

@@ -1,43 +1,30 @@
 package com.zkqy.web.controller.dragForm;
 
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONArray;
-import com.alibaba.fastjson2.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.zkqy.business.entity.CommonEntity;
 import com.zkqy.business.entity.DragForm;
 import com.zkqy.business.entity.DragTableBtn;
-import com.zkqy.business.entity.DragTableGroup;
-import com.zkqy.business.entity.vo.DragTableGroupVo;
-import com.zkqy.business.entity.vo.DragTableVo;
-import com.zkqy.business.mapper.DragTableBtnMapper;
-import com.zkqy.business.mapper.DragTableBtnRelevanceMapper;
-import com.zkqy.business.mapper.DragTableGroupMapper;
 import com.zkqy.business.mapper.DragTableMapper;
 import com.zkqy.business.service.ICommonService;
 import com.zkqy.business.service.IDragFormService;
 import com.zkqy.business.service.IDragTableBtnService;
-import com.zkqy.common.constant.ButtonTypeConstants;
+import com.zkqy.business.service.IDragTableGroupService;
 import com.zkqy.common.core.controller.BaseController;
 import com.zkqy.common.core.domain.AjaxResult;
-import com.zkqy.common.utils.bean.BeanUtils;
 import com.zkqy.common.utils.form.FromUtils;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
 import javax.annotation.Resource;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @author hanzihang
- * @date 2023/11/16 05:49
+ * @date 2023/11/16 5:49 PM
  */
 @RestController
 @RequestMapping("/dragform/commonbtn")
 public class CommonBtnController extends BaseController {
-
     @Resource   // 共通crud
     private ICommonService commonService;
 
@@ -54,58 +41,44 @@ public class CommonBtnController extends BaseController {
     private DragTableMapper dragTableMapper;
 
     @Resource
-    private DragTableGroupMapper dragTableGroupMapper;
-
-    @Resource
-    private DragTableBtnRelevanceMapper dragTableBtnRelevanceMapper;
-
-    @Resource
-    private DragTableBtnMapper dragTableBtnMapper;
+    private IDragTableGroupService dragTableGroupService;
 
     /**
-     * 处理按钮通用接口(新增、修改、删除)
-     * @param commonEntity
-     * @return
-     * @throws JsonProcessingException
+     * 处理按钮通用接口(新增、修改、删除...)
+     * 判断什么类型走什么接口: visible  false代表弹窗未开启时走回显表单模板及数据信息接口;true代表弹窗开启时走保存数据接口
+     * 是否提交表单操作 true是 false回显表单数据  commonEntity.getBasicMap().get("visible").toString()
      */
     @PostMapping("/commonBtnHandle")
     public AjaxResult commonBtnHandle(@RequestBody CommonEntity commonEntity) throws JsonProcessingException {
-
-        //按钮类型
-        Long btnType = Long.valueOf(commonEntity.getBasicMap().get("btnType").toString());
-        String type = "";
-        if (btnType == ButtonTypeConstants.INSERT) {
-            type = "INSERT";
-        } else if (btnType == ButtonTypeConstants.UPDATE) {
-            type = "UPDATE";
-        } else if (btnType == ButtonTypeConstants.DELETE) {
-            type = "DELETE";
-        }
-        /*
-         * 判断什么类型走什么接口:
-         * btnType  10:新增、8:修改、9:删除、5:脚本
-         * visible  false代表弹窗未开启时走回显表单模板及数据信息接口;true代表弹窗开启时走保存数据接口
-         * */
-        //是否提交表单操作 true是 false回显表单数据 commonEntity.getBasicMap().get("visible").toString()
-        switch (type) {
+        // 获取到按钮类型
+        String btnType = commonEntity.getBasicMap().get("btnType").toString();
+        /**
+         * 发起流程类型(需要特定参数),
+         * 启动脚本类型(执行特定脚本无需传递参数)
+         */
+        switch (btnType) {
             case "INSERT":
                 return insertBtn(commonEntity);
             case "UPDATE":
                 return updateBtn(commonEntity);
             case "DELETE":
                 return deleteBtn(commonEntity);
+            case "EXECUTE":  // 执行脚本
+                return executeBtn(commonEntity);
+            case "INITIATED":  // 发起流程
+                return initiatedBtn(commonEntity);
             default:
                 return warn("暂不支持该操作!");
         }
     }
 
-
     /**
      * 新增类型按钮
+     *
      * @param commonEntity
      * @return
-     * @throws JsonProcessingException
      */
+
     public AjaxResult insertBtn(CommonEntity commonEntity) throws JsonProcessingException {
         if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
             return AjaxResult.btnMessage(commonService.batchInsert(commonEntity));
@@ -120,9 +93,9 @@ public class CommonBtnController extends BaseController {
 
     /**
      * 修改类型按钮
+     *
      * @param commonEntity
      * @return
-     * @throws JsonProcessingException
      */
     public AjaxResult updateBtn(CommonEntity commonEntity) throws JsonProcessingException {
         //是否开启弹窗
@@ -144,14 +117,19 @@ public class CommonBtnController extends BaseController {
             }
             return toAjax(commonService.edit(commonEntity));
         } else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
-            //单纯是表格还是弹窗里有表格
-            return getAjaxResult(commonEntity);
+            Map<String, Object> map = new HashMap<>();
+            // 单纯是表格还是弹窗里有表格
+            String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
+            DragForm dragForm = dragFormService.selectDragFormBySqlKey(sqlKey);
+            map.put("template", dragForm);
+            // 返回结果
+            map.put("result", commonService.getInfoById(commonEntity));
+            return success(map);
         } else {
             return warn("暂不支持该操作!");
         }
     }
 
-
     /**
      * 删除类型按钮
      * @param commonEntity
@@ -161,93 +139,91 @@ public class CommonBtnController extends BaseController {
         return toAjax(commonService.batchDelete(commonEntity));
     }
 
+    /**
+     * 按钮执行脚本
+     *
+     * @param commonEntity
+     * @return
+     */
+    public AjaxResult executeBtn(CommonEntity commonEntity) throws JsonProcessingException {
+        if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
+            if (commonEntity.getBasicMap().containsKey("btnKey")) {  // 按钮提交时会触发别的操作
+                // 根据按钮别名查询按钮详细信息
+                DragTableBtn dragTableBtn = iDragTableBtnService.selectDragTableBtnByBtnKey(commonEntity.getBasicMap().get("btnKey").toString());
+                if (!dragTableBtn.getBtnScriptKey().isEmpty()) {
+                    // 调用执行脚本接口
+                    fromUtils.triggerScript(commonEntity);
+                }
+            }
+            commonService.edit(commonEntity);
+            return AjaxResult.success("执行脚本成功!");
+        } else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
+            Map<String, Object> map = new HashMap<>();
+            String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
+            DragForm dragForm = dragFormService.selectDragFormBySqlKey(sqlKey);
+            map.put("template", dragForm);
+            map.put("result", commonService.getInfoById(commonEntity));
+            return success(map);
+        } else {
+            return AjaxResult.error("执行脚本失败!");
+        }
+    }
 
     /**
-     * 判断是正常的表单渲染还是表单表格渲染
+     * 发起流程按钮
+     *
      * @param commonEntity
      * @return
-     * @throws JsonProcessingException
      */
-    private AjaxResult getAjaxResult(CommonEntity commonEntity) throws JsonProcessingException {
-        Map<String, Object> map = new HashMap<>();
-        //先拿到btnKey
-        String btnKey = commonEntity.getBasicMap().get("btnKey").toString();
-        //查询按钮列表
-        DragTableBtn dragTableBtn = iDragTableBtnService.selectDragTableBtnByBtnKey(btnKey);
-        //判断是走原生的表单解析还是、走配置的表单解析
-        if (dragTableBtn.getBtnTableFormGroupKey()!=null&&dragTableBtn.getBtnTableFormGroupKey()!="") {
-            //查询组信息
-            DragTableGroup dragTableGroup = dragTableGroupMapper.selectDragTableGroupOneByGroupKey(dragTableBtn.getBtnTableFormGroupKey());
-            DragTableGroupVo dragTableGroupVo=new DragTableGroupVo();
-            //赋值给vo才好放表格
-            BeanUtils.copyProperties(dragTableGroup, dragTableGroupVo);
-
-            //把[{"tableKey":"a1","sort":0},{"tableKey":"a2","sort":1}]转换成Map对象
-            JSONArray jsonArray = JSON.parseArray( dragTableGroup.getGroupTableInfo());
-            //排序确保表格的顺序
-            JSONArray sortArray = jsonArray.stream().sorted(
-                    Comparator.comparingLong(
-                            // 根据对象中的ID进行排序
-                            e -> JSONObject.parseObject(e.toString()).getIntValue("sort")
-                    )
-            ).collect(Collectors.toCollection(JSONArray::new));
-            //用in查询
-            List<String> tableKeys = new ArrayList<>();
-            sortArray.stream().forEach(item->
-                    tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
-
-            //查询表格信息
-            List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeysOrderby(tableKeys);
-            dragTableVos.forEach(item->{
-                // 动态表格按钮信息
-                //根据tableKey获取根节点信息
-                List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(item.getTableKey());
-                //获取根节点数据
-                if(btnKeys.size() > 0){
-                    List<DragTableBtn> rootNodes = dragTableBtnMapper.selectDragTableBtnListByBtnKey(btnKeys);
-                    //查询子节点
-                    List<Long> ids = rootNodes.stream().map(m -> m.getId()).collect(Collectors.toList());
-                    if (ids.isEmpty()){
-                         item.setDragTableBtnList(rootNodes);
-                    }else {
-                        List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
-                        List<DragTableBtn> btnList = rootNodes.stream().peek(
-                                root -> root.setChildren(getChildrenList(root, childNodes))
-                        ).collect(Collectors.toList());
-                        item.setDragTableBtnList(btnList);
+    public AjaxResult initiatedBtn(CommonEntity commonEntity) throws JsonProcessingException {
+        //是否开启弹窗
+        if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
+            if (commonEntity.getBasicMap().containsKey("btnKey")) {  // 按钮提交时会触发别的操作
+                // 根据按钮别名查询按钮详细信息
+                DragTableBtn dragTableBtn = iDragTableBtnService.selectDragTableBtnByBtnKey(commonEntity.getBasicMap().get("btnKey").toString());
+                // 根据流程的key判断当前按钮是否执行触发流程
+                if (!dragTableBtn.getBtnProcessKey().isEmpty()) {
+                    //  表示对当前操作是及时选择的流程模板
+                    if (dragTableBtn.getBtnProcessKey().equals("unknown")) {
+                        // 调用发起流程接口
+                        fromUtils.runBpmProductionScheduling(commonEntity);
+                    } else {
+                        // 执行当前按钮绑定的流程-》暂无直接执行流程
                     }
                 }
-            });
-            //查询表格按钮
-            dragTableGroupVo.setDragTables(dragTableVos);
-            map.put("template", null);
-            //把groupKey放进去
-            map.put("result",dragTableGroupVo);
-        }else {
+            }
+            toAjax(commonService.edit(commonEntity));
+            return AjaxResult.success("启动流程成功!");
+        } else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
+            Map<String, Object> map = new HashMap<>();
+            // 单纯是表格还是弹窗里有表格
             String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
             DragForm dragForm = dragFormService.selectDragFormBySqlKey(sqlKey);
             map.put("template", dragForm);
-            //返回结果
+            // 返回结果
             map.put("result", commonService.getInfoById(commonEntity));
+            return success(map);
+        } else {
+            // return warn("暂不支持该操作!");
+            return AjaxResult.error("发起流程失败!");
         }
-        return success(map);
     }
 
+
     /**
-     * 递归查询按钮子级的方法
-     * @param root
-     * @param childNodes
-     * @return
+     * 动态表格绑定的弹窗表格结构信息
+     */
+    @GetMapping(value = "/getProcessPopupTableInfo")
+    public AjaxResult getProcessPopupTableInfo(CommonEntity commonEntity) {
+        return AjaxResult.success(dragTableGroupService.getProcessPopupTableInfo(commonEntity));
+    }
+
+    /**
+     * 动态表格弹窗表格信息
      */
-    private List<DragTableBtn> getChildrenList(DragTableBtn root, List<DragTableBtn> childNodes) {
-        List<DragTableBtn> list = childNodes.stream().filter(dragTableBtn ->
-                //筛选出下一节点元素
-                Objects.equals(dragTableBtn.getBtnParentId(), root.getId())).map(dragTableBtn -> {
-            //递归set子节点
-            dragTableBtn.setChildren(this.getChildrenList(dragTableBtn, childNodes));
-            return dragTableBtn;
-        }).collect(Collectors.toList());
-        return list;
+    @GetMapping(value = "/getProcessPopupTableList")
+    public AjaxResult getProcessPopupTableList(CommonEntity commonEntity) {
+        return AjaxResult.success(dragTableGroupService.getProcessPopupTableList(commonEntity));
     }
 
 

+ 29 - 1
zkqy-business/src/main/java/com/zkqy/business/service/IDragTableGroupService.java

@@ -1,6 +1,7 @@
 package com.zkqy.business.service;
 
 
+import com.zkqy.business.entity.CommonEntity;
 import com.zkqy.business.entity.DragTableGroup;
 import com.zkqy.business.entity.vo.DragTableGroupVo;
 
@@ -32,6 +33,7 @@ public interface IDragTableGroupService {
 
     /**
      * 根据表格组key查询表格组信息
+     *
      * @param groupKey
      * @return
      */
@@ -39,6 +41,7 @@ public interface IDragTableGroupService {
 
     /**
      * 查询表格组包含的详细信息
+     *
      * @param dragTableGroup
      * @return
      */
@@ -48,4 +51,29 @@ public interface IDragTableGroupService {
      * 查询当前组下是否包含有表格信息
      */
     Boolean selectDragTableGroupTableListSize(Long[] ids);
-}
+
+    /**
+     * 弹窗查询表格结构信息
+     *
+     * @param commonEntity
+     * @return
+     */
+    CommonEntity getProcessPopupTableInfo(CommonEntity commonEntity);
+
+
+    /**
+     * 弹窗查询表格数据信息
+     *
+     * @param commonEntity
+     * @return
+     */
+    CommonEntity getProcessPopupTableList(CommonEntity commonEntity);
+
+    /**
+     * 查询拖拽表格组
+     *
+     * @param groupKey
+     * @return
+     */
+    DragTableGroup selectDragTableGroupInfoByGroupKey(String groupKey);
+}

+ 170 - 12
zkqy-business/src/main/java/com/zkqy/business/service/impl/DragTableGroupServiceImpl.java

@@ -3,24 +3,20 @@ package com.zkqy.business.service.impl;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
-import com.zkqy.business.entity.DragTable;
-import com.zkqy.business.entity.DragTableCondition;
-import com.zkqy.business.entity.DragTableGroup;
-import com.zkqy.business.entity.TableSql;
+import com.zkqy.business.entity.*;
 import com.zkqy.business.entity.vo.DragTableGroupVo;
 import com.zkqy.business.entity.vo.DragTableVo;
-import com.zkqy.business.mapper.DragTableConditionMapper;
-import com.zkqy.business.mapper.DragTableGroupMapper;
-import com.zkqy.business.mapper.DragTableMapper;
-import com.zkqy.business.mapper.TableSqlMapper;
+import com.zkqy.business.mapper.*;
+import com.zkqy.business.service.IDragTableBtnRelevanceService;
 import com.zkqy.business.service.IDragTableGroupService;
+import com.zkqy.business.service.ITableSqlService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
 /**
@@ -31,18 +27,37 @@ import java.util.stream.Collectors;
 @Service
 public class DragTableGroupServiceImpl implements IDragTableGroupService {
 
+
     @Autowired
     private DragTableGroupMapper dragTableGroupMapper;
 
     @Autowired
     private DragTableMapper dragTableMapper;
 
+    @Autowired
+    private DragTableServiceImpl dragTableService;
+
     @Autowired
     private DragTableConditionMapper dragTableConditionMapper;
 
     @Autowired
     private TableSqlMapper tableSqlMapper;
 
+    @Autowired
+    private IDragTableBtnRelevanceService dragTableBtnRelevanceService;
+
+    @Resource
+    private CommonMapper commonMapper;
+
+    @Resource  // 动态sql
+    private ITableSqlService iTableSqlService;
+
+    @Resource
+    private DragTableBtnRelevanceMapper dragTableBtnRelevanceMapper;
+
+    @Resource
+    private DragTableBtnMapper dragTableBtnMapper;
+
 
     /**
      * 查询拖拽格组
@@ -165,4 +180,147 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         return true;
     }
 
+    /**
+     * 工艺工序弹窗里边的表格结构信息
+     * @param commonEntity
+     * @return
+     */
+    @Override
+    public CommonEntity getProcessPopupTableInfo(CommonEntity commonEntity) {
+        String groupKey = commonEntity.getQueryMap().get("groupKey").toString();
+        //查询组信息
+        DragTableGroup dragTableGroup = dragTableGroupMapper.selectDragTableGroupOneByGroupKey(groupKey);
+        //把[{"tableKey":"a1","sort":0},{"tableKey":"a2","sort":1}]转换成Map对象
+        JSONArray jsonArray = JSON.parseArray( dragTableGroup.getGroupTableInfo());
+        //排序确保表格的顺序
+        JSONArray sortArray = jsonArray.stream().sorted(
+                Comparator.comparingLong(
+                        // 根据对象中的ID进行排序
+                        e -> JSONObject.parseObject(e.toString()).getIntValue("sort")
+                )
+        ).collect(Collectors.toCollection(JSONArray::new));
+        //用in查询
+        List<String> tableKeys = new ArrayList<>();
+        sortArray.stream().forEach(item->tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
+        //查询表格信息
+        List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeysOrderby(tableKeys);
+        //存条件的数组
+        List<String> conditionCollectString=new ArrayList<>();
+        //查询表格按钮信息
+        dragTableVos.forEach(item->{
+            // 动态表格按钮信息
+            //根据tableKey获取根节点信息
+            List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(item.getTableKey());
+            //获取根节点数据
+            if(btnKeys.size() > 0){
+                List<DragTableBtn> rootNodes = dragTableBtnMapper.selectDragTableBtnListByBtnKey(btnKeys);
+                //查询子节点
+                List<Long> ids = rootNodes.stream().map(m -> m.getId()).collect(Collectors.toList());
+                if (ids.isEmpty()){
+                    item.setDragTableBtnList(rootNodes);
+                }else {
+                    List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
+                    List<DragTableBtn> btnList = rootNodes.stream().peek(
+                            root -> root.setChildren(getChildrenList(root, childNodes))
+                    ).collect(Collectors.toList());
+                    item.setDragTableBtnList(btnList);
+                }
+            }
+            //根据动态表格查询条件信息
+            List<DragTableCondition> dragTableConditions = dragTableConditionMapper.selectDragTableConditionByTid(item.gettId());
+            //拿到条件
+            List<String> conditionCollect= dragTableConditions.stream().map(condition -> condition.getConditionDefaultValue()).collect(Collectors.toList());
+            //添加所有集合到大条件中
+            conditionCollectString.addAll(conditionCollect);
+        });
+        //数组集合去重
+        List<String>  distinctCondition = conditionCollectString.stream().distinct().collect(Collectors.toList());
+        CommonEntity common=new CommonEntity();
+        //模版结果Map
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("template",dragTableVos);
+        resultMap.put("condition",distinctCondition);
+        common.setResultMap(resultMap);
+        return  common;
+    }
+
+
+
+    /**
+     * 工艺工序弹窗里边的表格数据信息
+     * @param commonEntity
+     * @return
+     */
+    @Override
+    public CommonEntity getProcessPopupTableList(CommonEntity commonEntity) {
+        //拿到表格组名称
+        String groupKey = commonEntity.getQueryMap().get("groupKey").toString();
+        //查询表格组信息
+        String groupTableInfo = dragTableGroupMapper.selectDragTableGroupByGroupKey(groupKey);
+        //查询出来的表信息
+        List<DragTableVo> dragTableVos = getDragTableVos(groupTableInfo);
+        //根据sqlKey查询TableSql数据
+        CommonEntity common=new CommonEntity();
+        List<List<CommonEntity>> commonEntityList=new ArrayList<>();
+        dragTableVos.forEach(item->{
+            TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(item.getSqlKey());
+            //sql的条件值
+            AtomicReference<String> tableSqlTableCondition= new AtomicReference<>(tableSql.getTableCondition());
+            //循环替换条件占位的值
+            commonEntity.getQueryMap().forEach((k,v)->{
+                tableSqlTableCondition.set(tableSqlTableCondition.get().replace(k, "'"+v.toString()+"'"));
+            });
+            //sql的执行语句
+            String sqlString = tableSql.getTableSql() + " where " + tableSqlTableCondition.get();
+            List<CommonEntity> commonEntities = commonMapper.queryTableList(sqlString);
+            //很多条数据
+            commonEntityList.add(commonEntities);
+        });
+        //结果Map
+        HashMap hashMap = new HashMap();
+        hashMap.put("result",commonEntityList);
+        common.setResultMap(hashMap);
+        return common;
+    }
+
+    @Override
+    public DragTableGroup selectDragTableGroupInfoByGroupKey(String groupKey) {
+        return dragTableGroupMapper.selectDragTableGroupOneByGroupKey(groupKey);
+    }
+
+    private List<DragTableVo> getDragTableVos(String groupTableInfo) {
+        //把他转换成Map对象
+        JSONArray jsonArray = JSON.parseArray(groupTableInfo);
+        //排序确保表格的顺序
+        JSONArray sortArray = jsonArray.stream().sorted(
+                Comparator.comparingLong(
+                        // 根据对象中的ID进行排序
+                        e -> JSONObject.parseObject(e.toString()).getIntValue("sort")
+                )
+        ).collect(Collectors.toCollection(JSONArray::new));
+        //把查询出来的动态表格数据放到一个集合里边
+        List<DragTableVo> dragTableList=new ArrayList<>();
+        sortArray.forEach(e->{
+            JSONObject jsonObject = JSON.parseObject(e.toString());
+            String str = jsonObject.get("tableKey").toString();
+            DragTable dragTable = dragTableMapper.selectDragTableByTableKey(str);
+            DragTableVo dragTableVo=new DragTableVo();
+            BeanUtils.copyProperties(dragTable, dragTableVo);
+            dragTableList.add( dragTableVo);
+        });
+        return dragTableList;
+    }
+
+    //得到按钮表格的循环
+    private List<DragTableBtn> getChildrenList(DragTableBtn root, List<DragTableBtn> childNodes) {
+        List<DragTableBtn> list = childNodes.stream().filter(dragTableBtn ->
+                //筛选出下一节点元素
+                Objects.equals(dragTableBtn.getBtnParentId(), root.getId())).map(dragTableBtn -> {
+            //递归set子节点
+            dragTableBtn.setChildren(this.getChildrenList(dragTableBtn, childNodes));
+            return dragTableBtn;
+        }).collect(Collectors.toList());
+        return list;
+    }
+
 }