瀏覽代碼

feat:动态表格数据统计、样式、按钮相关接口

xuezizhuo 1 年之前
父節點
當前提交
d59de05053
共有 21 個文件被更改,包括 1344 次插入62 次删除
  1. 110 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableBtnController.java
  2. 28 11
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableController.java
  3. 275 0
      ruoyi-system/src/main/java/com/ruoyi/system/entity/DragTableBtn.java
  4. 52 0
      ruoyi-system/src/main/java/com/ruoyi/system/entity/DragTableBtnRelevance.java
  5. 33 13
      ruoyi-system/src/main/java/com/ruoyi/system/entity/vo/DragTableVo.java
  6. 80 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableBtnMapper.java
  7. 67 0
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableBtnRelevanceMapper.java
  8. 2 2
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableStatisticMapper.java
  9. 2 2
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableStyleMapper.java
  10. 63 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IDragTableBtnRelevanceService.java
  11. 70 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/IDragTableBtnService.java
  12. 2 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/IDragTableService.java
  13. 100 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableBtnRelevanceServiceImpl.java
  14. 165 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableBtnServiceImpl.java
  15. 39 0
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableServiceImpl.java
  16. 1 2
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableStatisticServiceImpl.java
  17. 1 1
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableStyleServiceImpl.java
  18. 14 16
      ruoyi-system/src/main/resources/mapper/DragTableStyleMapper.xml
  19. 169 0
      ruoyi-system/src/main/resources/mapper/dragmapper/DragTableBtnMapper.xml
  20. 60 0
      ruoyi-system/src/main/resources/mapper/dragmapper/DragTableBtnRelevanceMapper.xml
  21. 11 13
      ruoyi-system/src/main/resources/mapper/dragmapper/DragTableStatisticMapper.xml

+ 110 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableBtnController.java

@@ -0,0 +1,110 @@
+package com.ruoyi.web.controller.dragForm;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.common.annotation.Anonymous;
+import com.ruoyi.system.entity.DragTableBtn;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.system.service.IDragTableBtnService;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+
+/**
+ * 格绑定的自定义按钮Controller
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+@RestController
+@RequestMapping("/system/btn")
+public class DragTableBtnController extends BaseController
+{
+    @Autowired
+    private IDragTableBtnService dragTableBtnService;
+
+    /**
+     * 查询格绑定的自定义按钮列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:btn:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(DragTableBtn dragTableBtn)
+    {
+        startPage();
+        List<DragTableBtn> list = dragTableBtnService.selectDragTableBtnList(dragTableBtn);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出格绑定的自定义按钮列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:btn:export')")
+    @Log(title = "格绑定的自定义按钮", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, DragTableBtn dragTableBtn)
+    {
+        List<DragTableBtn> list = dragTableBtnService.selectDragTableBtnList(dragTableBtn);
+        ExcelUtil<DragTableBtn> util = new ExcelUtil<DragTableBtn>(DragTableBtn.class);
+        util.exportExcel(response, list, "格绑定的自定义按钮数据");
+    }
+
+    /**
+     * 获取格绑定的自定义按钮详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:btn:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(dragTableBtnService.selectDragTableBtnById(id));
+    }
+
+    /**
+     * 新增格绑定的自定义按钮
+     */
+    @PreAuthorize("@ss.hasPermi('system:btn:add')")
+    @Log(title = "格绑定的自定义按钮", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody DragTableBtn dragTableBtn)
+    {
+        dragTableBtnService.insertDragTableBtn(dragTableBtn);
+        return AjaxResult.success();
+    }
+
+    /**
+     * 修改格绑定的自定义按钮
+     */
+    @PreAuthorize("@ss.hasPermi('system:btn:edit')")
+    @Log(title = "格绑定的自定义按钮", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody DragTableBtn dragTableBtn)
+    {
+        return toAjax(dragTableBtnService.updateDragTableBtn(dragTableBtn));
+    }
+
+    /**
+     * 删除格绑定的自定义按钮
+     */
+    @PreAuthorize("@ss.hasPermi('system:btn:remove')")
+    @Log(title = "格绑定的自定义按钮", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{id}")
+    public AjaxResult remove(@PathVariable Long id)
+    {
+        if (dragTableBtnService.hasChildByBtnId(id)) {
+            return warn("存在子按钮,不允许删除");
+        }
+        return toAjax(dragTableBtnService.deleteDragTableBtnById(id));
+    }
+}

+ 28 - 11
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableController.java

@@ -7,16 +7,13 @@ import javax.servlet.http.HttpServletResponse;
 import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.system.entity.DragTable;
 import com.ruoyi.system.entity.vo.DragTableVo;
-import com.ruoyi.system.service.IDragTableStatisticService;
-import com.ruoyi.system.service.IDragTableStyleService;
-import org.springframework.security.access.prepost.PreAuthorize;
+import com.ruoyi.system.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.system.service.IDragTableService;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.page.TableDataInfo;
 
@@ -39,6 +36,9 @@ public class DragTableController extends BaseController {
     @Autowired
     private IDragTableStyleService dragTableStyleService;
 
+    @Autowired
+    private IDragTableBtnRelevanceService dragTableBtnRelevanceService;
+    
     /**
      * 查询动态表格列表
      */
@@ -99,15 +99,22 @@ public class DragTableController extends BaseController {
      * 新增动态表格模版数据
      */
     @PostMapping("/addDragTable")
-    public AjaxResult addDragTable(@RequestBody DragTableVo dragTableVo) {
+    public AjaxResult addDragTable(@RequestBody DragTableVo dragTableVo){
         //新增动态表格信息
         dragTableService.addDragTable(dragTableVo);
-        //新增动态表格样式
-        if (dragTableVo.getDragTableStyleList() != null)
-            if (dragTableVo.getDragTableStyleList().size() > 0) {
-                dragTableStyleService.batchInsertDragTableStyle(dragTableVo);
-            }
-        return AjaxResult.success();
+        //新增动态表格样式信息
+        if(dragTableVo.getDragTableStyleList().size() > 0){
+            dragTableStyleService.batchInsertDragTableStyle(dragTableVo);
+        }
+        //新增动态表格数据统计信息
+        if(dragTableVo.getDragTableStatisticList().size() > 0){
+            dragTableStatisticService.batchInsertDragTableStatistic(dragTableVo);
+        }
+        //新增表格按钮关联表
+        if(dragTableVo.getDragTableBtnRelevanceList().size() > 0){
+            dragTableBtnRelevanceService.batchInsertDragTableBtnRelevance(dragTableVo.getDragTableBtnRelevanceList());
+        }
+         return AjaxResult.success();
     }
 
     /**
@@ -127,6 +134,10 @@ public class DragTableController extends BaseController {
         dragTableService.updateDragTable(dragTableVo);
         //修改动态表格样式信息
         dragTableStyleService.updateDragTableStyle(dragTableVo);
+        //修改动态表格数据统计信息
+        dragTableStatisticService.updateDragTableStatistic(dragTableVo);
+        //修改动态表格和按钮关联表
+        dragTableBtnRelevanceService.updateDragTableBtnRelevance(dragTableVo);
         return AjaxResult.success();
     }
 
@@ -138,9 +149,15 @@ public class DragTableController extends BaseController {
         List<Long> tIds = (List<Long>) map.get("tIds");
         List<String> sqlKeys = (List<String>) map.get("sqlKeys");
         List<String> tableKeys = (List<String>) map.get("tableKeys");
+        // 删除动态表格
         dragTableService.deleteDragTable(tIds, sqlKeys);
+        // 删除动态表格统计
         dragTableStatisticService.deleteDragTableStatisticByTableKeys(tableKeys);
+        // 删除动态表格样式
         dragTableStyleService.deleteDragTableStyleByTableKeys(tableKeys);
+        // 删除动态表格和按钮关联表
+        dragTableBtnRelevanceService.deleteDragTableBtnRelevanceByTableKeys(tableKeys);
+
         return AjaxResult.success();
     }
 

+ 275 - 0
ruoyi-system/src/main/java/com/ruoyi/system/entity/DragTableBtn.java

@@ -0,0 +1,275 @@
+package com.ruoyi.system.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 格绑定的自定义按钮对象 drag_table_btn
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+public class DragTableBtn extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long id;
+
+    /** 父级ID */
+    private Long btnParentId;
+
+    /** 祖籍列表 */
+    private String ancestorsId;
+
+    /** 按钮别名 */
+    private String btnKey;
+
+    /** 按钮组名称 */
+    private String btnGroupName;
+
+    /** 按钮名称 */
+    private String btnName;
+
+    /** 按钮类型(0:操作按钮,1,其他,2表单,3跳转,4流程,5脚本,6目录) */
+    private String btnType;
+
+    /** 按钮图标 */
+    private String btnIcon;
+
+    /** 表单唯一标识 */
+    private String btnFormKey;
+
+    /** 流程唯一标识 */
+    private String btnProcessKey;
+
+    /** 表格唯一标识 */
+    private String btnTableKey;
+
+    /** 脚本唯一标识 */
+    private String btnScriptKey;
+
+    /** 按钮显示条件 */
+    private String btnShowCondition;
+
+    /** 操作参数 */
+    private String btnParams;
+
+    /** 权限字符 */
+    private String btnHasPermi;
+
+    /** 按钮顺序 */
+    private Long btnSort;
+
+    /** 删除标志(0:否;1:是) */
+    private String delFlag;
+
+    /** 创建者ID */
+    private Long createById;
+
+    /** 更新者ID */
+    private Long updateById;
+
+    /** 子菜单 */
+    private List<DragTableBtn> children = new ArrayList<DragTableBtn>();
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public Long getBtnParentId() {
+        return btnParentId;
+    }
+
+    public void setBtnParentId(Long btnParentId) {
+        this.btnParentId = btnParentId;
+    }
+
+    public String getAncestorsId() {
+        return ancestorsId;
+    }
+
+    public void setAncestorsId(String ancestorsId) {
+        this.ancestorsId = ancestorsId;
+    }
+
+    public String getBtnKey() {
+        return btnKey;
+    }
+
+    public void setBtnKey(String btnKey) {
+        this.btnKey = btnKey;
+    }
+
+    public String getBtnGroupName() {
+        return btnGroupName;
+    }
+
+    public void setBtnGroupName(String btnGroupName) {
+        this.btnGroupName = btnGroupName;
+    }
+
+    public String getBtnName() {
+        return btnName;
+    }
+
+    public void setBtnName(String btnName) {
+        this.btnName = btnName;
+    }
+
+    public String getBtnType() {
+        return btnType;
+    }
+
+    public void setBtnType(String btnType) {
+        this.btnType = btnType;
+    }
+
+    public String getBtnFormKey() {
+        return btnFormKey;
+    }
+
+    public void setBtnFormKey(String btnFormKey) {
+        this.btnFormKey = btnFormKey;
+    }
+
+    public String getBtnProcessKey() {
+        return btnProcessKey;
+    }
+
+    public void setBtnProcessKey(String btnProcessKey) {
+        this.btnProcessKey = btnProcessKey;
+    }
+
+    public String getBtnTableKey() {
+        return btnTableKey;
+    }
+
+    public void setBtnTableKey(String btnTableKey) {
+        this.btnTableKey = btnTableKey;
+    }
+
+    public String getBtnScriptKey() {
+        return btnScriptKey;
+    }
+
+    public void setBtnScriptKey(String btnScriptKey) {
+        this.btnScriptKey = btnScriptKey;
+    }
+
+    public String getBtnShowCondition() {
+        return btnShowCondition;
+    }
+
+    public void setBtnShowCondition(String btnShowCondition) {
+        this.btnShowCondition = btnShowCondition;
+    }
+
+    public String getBtnParams() {
+        return btnParams;
+    }
+
+    public void setBtnParams(String btnParams) {
+        this.btnParams = btnParams;
+    }
+
+    public String getBtnHasPermi() {
+        return btnHasPermi;
+    }
+
+    public void setBtnHasPermi(String btnHasPermi) {
+        this.btnHasPermi = btnHasPermi;
+    }
+
+    public Long getBtnSort() {
+        return btnSort;
+    }
+
+    public void setBtnSort(Long btnSort) {
+        this.btnSort = btnSort;
+    }
+
+    public String getDelFlag() {
+        return delFlag;
+    }
+
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
+    }
+
+    @Override
+    public Long getCreateById() {
+        return createById;
+    }
+
+    @Override
+    public void setCreateById(Long createById) {
+        this.createById = createById;
+    }
+
+    @Override
+    public Long getUpdateById() {
+        return updateById;
+    }
+
+    @Override
+    public void setUpdateById(Long updateById) {
+        this.updateById = updateById;
+    }
+
+    public List<DragTableBtn> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<DragTableBtn> children) {
+        this.children = children;
+    }
+
+    public String getBtnIcon() {
+        return btnIcon;
+    }
+
+    public void setBtnIcon(String btnIcon) {
+        this.btnIcon = btnIcon;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("btnParentId", getBtnParentId())
+            .append("ancestorsId",getAncestorsId())
+            .append("btnKey", getBtnKey())
+            .append("btnName", getBtnName())
+            .append("btnType", getBtnType())
+            .append("btnFormKey", getBtnFormKey())
+            .append("btnProcessKey", getBtnProcessKey())
+            .append("btnTableKey", getBtnTableKey())
+            .append("btnScriptKey", getBtnScriptKey())
+            .append("btnShowCondition", getBtnShowCondition())
+            .append("btnParams", getBtnParams())
+            .append("btnHasPermi", getBtnHasPermi())
+            .append("btnSort", getBtnSort())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createById", getCreateById())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateById", getUpdateById())
+            .append("updateTime", getUpdateTime())
+            .append("remark", getRemark())
+            .append("children",getChildren())
+            .append("btnGroupName",getBtnGroupName())
+            .append("btnIcon",getBtnIcon())
+            .toString();
+    }
+}

+ 52 - 0
ruoyi-system/src/main/java/com/ruoyi/system/entity/DragTableBtnRelevance.java

@@ -0,0 +1,52 @@
+package com.ruoyi.system.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
+/**
+ * 动态格和动态格按钮关联对象 drag_table_btn_relevance
+ * 
+ * @author ruoyi
+ * @date 2023-11-09
+ */
+public class DragTableBtnRelevance extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 动态表格key(唯一标识) */
+    @Excel(name = "动态表格key", readConverterExp = "唯=一标识")
+    private String tableKey;
+
+    /** 动态表格按钮key(唯一标识) */
+    @Excel(name = "动态表格按钮key", readConverterExp = "唯=一标识")
+    private String btnKey;
+
+    public void setTableKey(String tableKey) 
+    {
+        this.tableKey = tableKey;
+    }
+
+    public String getTableKey() 
+    {
+        return tableKey;
+    }
+    public void setBtnKey(String btnKey) 
+    {
+        this.btnKey = btnKey;
+    }
+
+    public String getBtnKey() 
+    {
+        return btnKey;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("tableKey", getTableKey())
+            .append("btnKey", getBtnKey())
+            .toString();
+    }
+}

+ 33 - 13
ruoyi-system/src/main/java/com/ruoyi/system/entity/vo/DragTableVo.java

@@ -2,13 +2,10 @@ package com.ruoyi.system.entity.vo;
 
 import com.ruoyi.common.annotation.Excel;
 import com.ruoyi.common.core.domain.BaseEntity;
-import com.ruoyi.system.entity.DragTableStatistic;
-import com.ruoyi.system.entity.DragTableStyle;
-import com.ruoyi.system.entity.TableSql;
+import com.ruoyi.system.entity.*;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -134,6 +131,12 @@ public class DragTableVo {
      */
     private List<DragTableStyle> dragTableStyleList;
 
+    /** 表格按钮 */
+    private List<DragTableBtn> dragTableBtnList;
+
+    /** 表格和按钮管理 */
+    private List<DragTableBtnRelevance> dragTableBtnRelevanceList;
+
     public Long gettId() {
         return tId;
     }
@@ -222,6 +225,14 @@ public class DragTableVo {
         this.searchFieldList = searchFieldList;
     }
 
+    public Map<String, Object> getConditionDefaultValueMap() {
+        return conditionDefaultValueMap;
+    }
+
+    public void setConditionDefaultValueMap(Map<String, Object> conditionDefaultValueMap) {
+        this.conditionDefaultValueMap = conditionDefaultValueMap;
+    }
+
     public String getTableSql() {
         return tableSql;
     }
@@ -238,7 +249,7 @@ public class DragTableVo {
         this.tableExportField = tableExportField;
     }
 
-    public Object getTableExportFieldEcho() {
+    public String getTableExportFieldEcho() {
         return tableExportFieldEcho;
     }
 
@@ -310,22 +321,26 @@ public class DragTableVo {
         this.dragTableStyleList = dragTableStyleList;
     }
 
-    public Map<String, Object> getConditionDefaultValueMap() {
+    public List<DragTableBtn> getDragTableBtnList() {
+        return dragTableBtnList;
+    }
 
-        if (conditionDefaultValueMap == null) {
-            conditionDefaultValueMap = new HashMap<>();
-        }
-        return conditionDefaultValueMap;
+    public void setDragTableBtnList(List<DragTableBtn> dragTableBtnList) {
+        this.dragTableBtnList = dragTableBtnList;
     }
 
-    public void setConditionDefaultValueMap(Map<String, Object> conditionDefaultValueMap) {
-        this.conditionDefaultValueMap = conditionDefaultValueMap;
+    public List<DragTableBtnRelevance> getDragTableBtnRelevanceList() {
+        return dragTableBtnRelevanceList;
+    }
+
+    public void setDragTableBtnRelevanceList(List<DragTableBtnRelevance> dragTableBtnRelevanceList) {
+        this.dragTableBtnRelevanceList = dragTableBtnRelevanceList;
     }
 
     public DragTableVo() {
     }
 
-    public DragTableVo(Long tId, String dtName, String dtNickname, String tableKey, String sqlKey, String dtTableName, Object dtColumnName, String dtColumnNameEcho, String timeFormat, String isSelection, List<String> searchFieldList, Map<String, Object> conditionDefaultValueMap, String tableSql, Object tableExportField, String tableExportFieldEcho, String echoData, Long menuId, String primaryKey, String orderByColumn, String sortOrder, List<DragTableStatistic> dragTableStatisticList, List<TableSql> tableSqlList, List<DragTableStyle> dragTableStyleList) {
+    public DragTableVo(Long tId, String dtName, String dtNickname, String tableKey, String sqlKey, String dtTableName, Object dtColumnName, String dtColumnNameEcho, String timeFormat, String isSelection, List<String> searchFieldList, Map<String, Object> conditionDefaultValueMap, String tableSql, Object tableExportField, String tableExportFieldEcho, String echoData, Long menuId, String primaryKey, String orderByColumn, String sortOrder, List<DragTableStatistic> dragTableStatisticList, List<TableSql> tableSqlList, List<DragTableStyle> dragTableStyleList, List<DragTableBtn> dragTableBtnList, List<DragTableBtnRelevance> dragTableBtnRelevanceList) {
         this.tId = tId;
         this.dtName = dtName;
         this.dtNickname = dtNickname;
@@ -349,6 +364,8 @@ public class DragTableVo {
         this.dragTableStatisticList = dragTableStatisticList;
         this.tableSqlList = tableSqlList;
         this.dragTableStyleList = dragTableStyleList;
+        this.dragTableBtnList = dragTableBtnList;
+        this.dragTableBtnRelevanceList = dragTableBtnRelevanceList;
     }
 
     @Override
@@ -365,6 +382,7 @@ public class DragTableVo {
                 ", timeFormat='" + timeFormat + '\'' +
                 ", isSelection='" + isSelection + '\'' +
                 ", searchFieldList=" + searchFieldList +
+                ", conditionDefaultValueMap=" + conditionDefaultValueMap +
                 ", tableSql='" + tableSql + '\'' +
                 ", tableExportField=" + tableExportField +
                 ", tableExportFieldEcho='" + tableExportFieldEcho + '\'' +
@@ -376,6 +394,8 @@ public class DragTableVo {
                 ", dragTableStatisticList=" + dragTableStatisticList +
                 ", tableSqlList=" + tableSqlList +
                 ", dragTableStyleList=" + dragTableStyleList +
+                ", dragTableBtnList=" + dragTableBtnList +
+                ", dragTableBtnRelevanceList=" + dragTableBtnRelevanceList +
                 '}';
     }
 }

+ 80 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableBtnMapper.java

@@ -0,0 +1,80 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.entity.DragTableBtn;
+
+import java.util.List;
+
+/**
+ * 格绑定的自定义按钮Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+public interface DragTableBtnMapper 
+{
+    /**
+     * 查询格绑定的自定义按钮
+     * 
+     * @param id 格绑定的自定义按钮主键
+     * @return 格绑定的自定义按钮
+     */
+    DragTableBtn selectDragTableBtnById(Long id);
+
+    /**
+     * 查询格绑定的自定义按钮列表
+     * 
+     * @param dragTableBtn 格绑定的自定义按钮
+     * @return 格绑定的自定义按钮集合
+     */
+    List<DragTableBtn> selectDragTableBtnList(DragTableBtn dragTableBtn);
+
+    /**
+     * 新增格绑定的自定义按钮
+     * 
+     * @param dragTableBtn 格绑定的自定义按钮
+     * @return 结果
+     */
+    int insertDragTableBtn(DragTableBtn dragTableBtn);
+
+    /**
+     * 修改格绑定的自定义按钮
+     * 
+     * @param dragTableBtn 格绑定的自定义按钮
+     * @return 结果
+     */
+    int updateDragTableBtn(DragTableBtn dragTableBtn);
+
+    /**
+     * 删除格绑定的自定义按钮
+     * 
+     * @param id 格绑定的自定义按钮主键
+     * @return 结果
+     */
+    int deleteDragTableBtnById(Long id);
+
+    /**
+     * 批量删除格绑定的自定义按钮
+     * 
+     * @param btnTableKeys 需要删除的数据主键集合
+     * @return 结果
+     */
+    int batchDeleteDragTableBtnByTableKey(List<String> btnTableKeys);
+
+    /**
+     * 查询动态表格绑定的自定义按钮
+     */
+    List<DragTableBtn> selectDragTableBtnListByBtnKey(List<String> btnKeys);
+
+    /**
+     * 根据id查询所有子节点数据
+     */
+    List<DragTableBtn> selectChildNodeById(List<Long> idList);
+
+    /**
+     * 是否存在按钮子节点
+     *
+     * @param btnId 按钮ID
+     * @return 结果
+     */
+    int hasChildByBtnId(Long btnId);
+}

+ 67 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableBtnRelevanceMapper.java

@@ -0,0 +1,67 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.entity.DragTableBtnRelevance;
+
+import java.util.List;
+
+/**
+ * 动态格和动态格按钮关联Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-11-09
+ */
+public interface DragTableBtnRelevanceMapper 
+{
+    /**
+     * 查询动态格和动态格按钮关联
+     * 
+     * @param tableKey 动态格和动态格按钮关联主键
+     * @return 动态格和动态格按钮关联
+     */
+    DragTableBtnRelevance selectDragTableBtnRelevanceByTableKey(String tableKey);
+
+    /**
+     * 查询动态格和动态格按钮关联列表
+     * 
+     * @param dragTableBtnRelevance 动态格和动态格按钮关联
+     * @return 动态格和动态格按钮关联集合
+     */
+    List<DragTableBtnRelevance> selectDragTableBtnRelevanceList(DragTableBtnRelevance dragTableBtnRelevance);
+
+    /**
+     * 新增动态格和动态格按钮关联
+     * 
+     * @param dragTableBtnRelevance 动态格和动态格按钮关联
+     * @return 结果
+     */
+    int batchInsertDragTableBtnRelevance(List<DragTableBtnRelevance> dragTableBtnRelevance);
+
+    /**
+     * 修改动态格和动态格按钮关联
+     * 
+     * @param dragTableBtnRelevance 动态格和动态格按钮关联
+     * @return 结果
+     */
+    int updateDragTableBtnRelevance(DragTableBtnRelevance dragTableBtnRelevance);
+
+    /**
+     * 删除动态格和动态格按钮关联
+     * 
+     * @param tableKey 动态格和动态格按钮关联主键
+     * @return 结果
+     */
+    int deleteDragTableBtnRelevanceByTableKey(String tableKey);
+
+    /**
+     * 批量删除动态格和动态格按钮关联
+     * 
+     * @param tableKeys 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteDragTableBtnRelevanceByTableKeys(List<String> tableKeys);
+
+    /**
+     * 根据tableKey查询所有按钮key
+     */
+    List<String> selectBtnKeyByTableKey(String tableKey);
+}

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableStatisticMapper.java

@@ -39,10 +39,10 @@ public interface DragTableStatisticMapper
     /**
      * 修改动态表格统计
      * 
-     * @param dragTableStatisticList 动态表格统计
+     * @param dragTableStatistic 动态表格统计
      * @return 结果
      */
-    int batchUpdateDragTableStatistic(List<DragTableStatistic> dragTableStatisticList);
+    int updateDragTableStatistic(DragTableStatistic dragTableStatistic);
 
     /**
      * 删除动态表格统计

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableStyleMapper.java

@@ -39,10 +39,10 @@ public interface DragTableStyleMapper
     /**
      * 批量修改动态格样式
      * 
-     * @param dragTableStyleList 动态格样式
+     * @param dragTableStyle 动态格样式
      * @return 结果
      */
-    int batchUpdateDragTableStyle(List<DragTableStyle> dragTableStyleList);
+    int updateDragTableStyle(DragTableStyle dragTableStyle);
 
     /**
      * 删除动态格样式

+ 63 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IDragTableBtnRelevanceService.java

@@ -0,0 +1,63 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.entity.DragTableBtnRelevance;
+import com.ruoyi.system.entity.vo.DragTableVo;
+
+import java.util.List;
+
+/**
+ * 动态格和动态格按钮关联Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-11-09
+ */
+public interface IDragTableBtnRelevanceService 
+{
+    /**
+     * 查询动态格和动态格按钮关联
+     * 
+     * @param tableKey 动态格和动态格按钮关联主键
+     * @return 动态格和动态格按钮关联
+     */
+    DragTableBtnRelevance selectDragTableBtnRelevanceByTableKey(String tableKey);
+
+    /**
+     * 查询动态格和动态格按钮关联列表
+     * 
+     * @param dragTableBtnRelevance 动态格和动态格按钮关联
+     * @return 动态格和动态格按钮关联集合
+     */
+    List<DragTableBtnRelevance> selectDragTableBtnRelevanceList(DragTableBtnRelevance dragTableBtnRelevance);
+
+    /**
+     * 新增动态格和动态格按钮关联
+     * 
+     * @param dragTableBtnRelevanceList 动态格和动态格按钮关联
+     * @return 结果
+     */
+    int batchInsertDragTableBtnRelevance(List<DragTableBtnRelevance> dragTableBtnRelevanceList);
+
+    /**
+     * 修改动态格和动态格按钮关联
+     * 
+     * @param dragTableVo 动态格VO
+     * @return 结果
+     */
+    void updateDragTableBtnRelevance(DragTableVo dragTableVo);
+
+    /**
+     * 批量删除动态格和动态格按钮关联
+     * 
+     * @param tableKeys 需要删除的动态格和动态格按钮关联主键集合
+     * @return 结果
+     */
+    int deleteDragTableBtnRelevanceByTableKeys(List<String> tableKeys);
+
+    /**
+     * 删除动态格和动态格按钮关联信息
+     * 
+     * @param tableKey 动态格和动态格按钮关联主键
+     * @return 结果
+     */
+    int deleteDragTableBtnRelevanceByTableKey(String tableKey);
+}

+ 70 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IDragTableBtnService.java

@@ -0,0 +1,70 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.entity.DragTableBtn;
+
+import java.util.List;
+
+/**
+ * 格绑定的自定义按钮Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+public interface IDragTableBtnService 
+{
+    /**
+     * 查询格绑定的自定义按钮
+     * 
+     * @param id 格绑定的自定义按钮主键
+     * @return 格绑定的自定义按钮
+     */
+    DragTableBtn selectDragTableBtnById(Long id);
+
+    /**
+     * 查询格绑定的自定义按钮列表
+     * 
+     * @param dragTableBtn 格绑定的自定义按钮
+     * @return 格绑定的自定义按钮集合
+     */
+    List<DragTableBtn> selectDragTableBtnList(DragTableBtn dragTableBtn);
+
+    /**
+     * 新增格绑定的自定义按钮
+     * 
+     * @param dragTableBtn 格绑定的自定义按钮
+     * @return 结果
+     */
+    int insertDragTableBtn(DragTableBtn dragTableBtn);
+
+    /**
+     * 修改格绑定的自定义按钮
+     * 
+     * @param dragTableBtn 格绑定的自定义按钮
+     * @return 结果
+     */
+    int updateDragTableBtn(DragTableBtn dragTableBtn);
+
+    /**
+     * 批量删除格绑定的自定义按钮
+     * 
+     * @param btnTableKeys 需要删除的格绑定的自定义按钮主键集合
+     * @return 结果
+     */
+    int batchDeleteDragTableBtnByTableKey(List<String> btnTableKeys);
+
+    /**
+     * 删除格绑定的自定义按钮信息
+     * 
+     * @param id 格绑定的自定义按钮主键
+     * @return 结果
+     */
+    int deleteDragTableBtnById(Long id);
+
+    /**
+     * 是否存在按钮子节点
+     *
+     * @param btnId 菜单ID
+     * @return 结果 true 存在 false 不存在
+     */
+    boolean hasChildByBtnId(Long btnId);
+}

+ 2 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/IDragTableService.java

@@ -66,10 +66,10 @@ public interface IDragTableService
     /**
      * 查询动态表格
      *
-     * @param sqlKey 唯一标识
+     * @param tableKey 唯一标识
      * @return 动态表格
      */
-    CommonEntity dragTableInfo(String sqlKey);
+    CommonEntity dragTableInfo(String tableKey);
 
     /**
      * 新增动态表格

+ 100 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableBtnRelevanceServiceImpl.java

@@ -0,0 +1,100 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.List;
+
+import com.ruoyi.system.entity.DragTableBtnRelevance;
+import com.ruoyi.system.entity.vo.DragTableVo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.DragTableBtnRelevanceMapper;
+import com.ruoyi.system.service.IDragTableBtnRelevanceService;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 动态格和动态格按钮关联Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-11-09
+ */
+@Service
+public class DragTableBtnRelevanceServiceImpl implements IDragTableBtnRelevanceService 
+{
+    @Autowired
+    private DragTableBtnRelevanceMapper dragTableBtnRelevanceMapper;
+
+    /**
+     * 查询动态格和动态格按钮关联
+     * 
+     * @param tableKey 动态格和动态格按钮关联主键
+     * @return 动态格和动态格按钮关联
+     */
+    @Override
+    public DragTableBtnRelevance selectDragTableBtnRelevanceByTableKey(String tableKey)
+    {
+        return dragTableBtnRelevanceMapper.selectDragTableBtnRelevanceByTableKey(tableKey);
+    }
+
+    /**
+     * 查询动态格和动态格按钮关联列表
+     * 
+     * @param dragTableBtnRelevance 动态格和动态格按钮关联
+     * @return 动态格和动态格按钮关联
+     */
+    @Override
+    public List<DragTableBtnRelevance> selectDragTableBtnRelevanceList(DragTableBtnRelevance dragTableBtnRelevance)
+    {
+        return dragTableBtnRelevanceMapper.selectDragTableBtnRelevanceList(dragTableBtnRelevance);
+    }
+
+    /**
+     * 新增动态格和动态格按钮关联
+     * 
+     * @param dragTableBtnRelevanceList 动态格和动态格按钮关联
+     * @return 结果
+     */
+    @Override
+    public int batchInsertDragTableBtnRelevance(List<DragTableBtnRelevance> dragTableBtnRelevanceList)
+    {
+        return dragTableBtnRelevanceMapper.batchInsertDragTableBtnRelevance(dragTableBtnRelevanceList);
+    }
+
+    /**
+     * 修改动态格和动态格按钮关联
+     * 
+     * @param dragTableVo 动态格和动态格VO
+     * @return 结果
+     */
+    @Override
+    @Transactional
+    public void updateDragTableBtnRelevance(DragTableVo dragTableVo)
+    {
+        // delete
+        dragTableBtnRelevanceMapper.deleteDragTableBtnRelevanceByTableKey(dragTableVo.getTableKey());
+        // insert
+        dragTableBtnRelevanceMapper.batchInsertDragTableBtnRelevance(dragTableVo.getDragTableBtnRelevanceList());
+    }
+
+    /**
+     * 批量删除动态格和动态格按钮关联
+     * 
+     * @param tableKeys 需要删除的动态格和动态格按钮关联主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDragTableBtnRelevanceByTableKeys(List<String> tableKeys)
+    {
+        return dragTableBtnRelevanceMapper.deleteDragTableBtnRelevanceByTableKeys(tableKeys);
+    }
+
+    /**
+     * 删除动态格和动态格按钮关联信息
+     * 
+     * @param tableKey 动态格和动态格按钮关联主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDragTableBtnRelevanceByTableKey(String tableKey)
+    {
+        return dragTableBtnRelevanceMapper.deleteDragTableBtnRelevanceByTableKey(tableKey);
+    }
+}

+ 165 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableBtnServiceImpl.java

@@ -0,0 +1,165 @@
+package com.ruoyi.system.service.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import com.ruoyi.common.core.domain.entity.SysMenu;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.system.entity.DragTableBtn;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.system.mapper.DragTableBtnMapper;
+import com.ruoyi.system.service.IDragTableBtnService;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 格绑定的自定义按钮Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-11-07
+ */
+@Service
+public class DragTableBtnServiceImpl implements IDragTableBtnService 
+{
+    @Autowired
+    private DragTableBtnMapper dragTableBtnMapper;
+
+    /**
+     * 查询格绑定的自定义按钮
+     * 
+     * @param id 格绑定的自定义按钮主键
+     * @return 格绑定的自定义按钮
+     */
+    @Override
+    public DragTableBtn selectDragTableBtnById(Long id)
+    {
+        return dragTableBtnMapper.selectDragTableBtnById(id);
+    }
+
+    /**
+     * 查询格绑定的自定义按钮列表
+     * 
+     * @param dragTableBtn 格绑定的自定义按钮
+     * @return 格绑定的自定义按钮
+     */
+    @Override
+    public List<DragTableBtn> selectDragTableBtnList(DragTableBtn dragTableBtn)
+    {
+        // 根据分页得到根节点数据
+        List<DragTableBtn> rootNodes = dragTableBtnMapper.selectDragTableBtnList(dragTableBtn);
+        //查询子节点
+        List<Long> ids = rootNodes.stream().map(m -> m.getId()).collect(Collectors.toList());
+        if (ids.isEmpty()){
+            return rootNodes;
+        }
+        List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
+        //递归处理树结构
+        return rootNodes.stream().peek(
+                root -> root.setChildren(getChildrenList(root, childNodes))
+        ).collect(Collectors.toList());
+    }
+
+    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;
+    }
+
+    @Override
+    @Transactional
+    public int insertDragTableBtn(DragTableBtn dragTableBtn){
+        dragTableBtn.setCreateById(SecurityUtils.getUserId());
+        dragTableBtn.setCreateBy(SecurityUtils.getUsername());
+        dragTableBtn.setCreateTime(DateUtils.getNowDate());
+        if(dragTableBtn.getBtnParentId() == 0L){
+            dragTableBtn.setAncestorsId("0");
+        }else {
+            dragTableBtn.setAncestorsId(dragTableBtnMapper.selectDragTableBtnById(dragTableBtn.getBtnParentId()).getAncestorsId()+","+dragTableBtn.getBtnParentId());
+        }
+        return dragTableBtnMapper.insertDragTableBtn(dragTableBtn);
+    }
+
+//    @Override
+//    @Transactional
+//    public void insertDragTableBtn(List<DragTableBtn> dragTableBtnList)
+//    {
+//        List<DragTableBtn> list = new ArrayList<>();
+//        list = dragTableBtnList.stream().filter(dragTableBtn -> 0L == dragTableBtn.getBtnParentId()).collect(Collectors.toList());
+//        //循环遍历数据新增
+//        for (int i = 0; i < list.size(); i++){
+//            printTree(list.get(i),0L);
+//        }
+//    }
+//    //新增动态表格自定义按钮
+//    public void printTree(DragTableBtn dragTableBtn, Long parentId) {
+//        if (dragTableBtn == null) {
+//            return;
+//        }
+//        //add按钮
+//        dragTableBtn.setCreateBy(SecurityUtils.getUsername());
+//        dragTableBtn.setCreateById(SecurityUtils.getUserId());
+//        dragTableBtn.setCreateTime(DateUtils.getNowDate());
+//        dragTableBtn.setBtnParentId(parentId);
+//        dragTableBtnMapper.insertDragTableBtn(dragTableBtn);
+//        for (DragTableBtn child : dragTableBtn.getChildren()) {  // 遍历子节点
+//            printTree(child,dragTableBtn.getId());  // 递归调用
+//        }
+//    }
+
+    /**
+     * 修改格绑定的自定义按钮
+     * 
+     * @param dragTableBtn 格绑定的自定义按钮
+     * @return 结果
+     */
+    @Override
+    public int updateDragTableBtn(DragTableBtn dragTableBtn)
+    {
+        dragTableBtn.setUpdateById(SecurityUtils.getUserId());
+        dragTableBtn.setUpdateBy(SecurityUtils.getUsername());
+        dragTableBtn.setUpdateTime(DateUtils.getNowDate());
+        if(dragTableBtn.getBtnParentId() == 0L){
+            dragTableBtn.setAncestorsId("0");
+        }else {
+            dragTableBtn.setAncestorsId(dragTableBtnMapper.selectDragTableBtnById(dragTableBtn.getBtnParentId()).getAncestorsId()+","+dragTableBtn.getBtnParentId());
+        }
+        return dragTableBtnMapper.updateDragTableBtn(dragTableBtn);
+    }
+
+    /**
+     * 批量删除格绑定的自定义按钮
+     * 
+     * @param btnTableKeys 需要删除的格绑定的自定义按钮主键
+     * @return 结果
+     */
+    @Override
+    public int batchDeleteDragTableBtnByTableKey(List<String> btnTableKeys)
+    {
+        return dragTableBtnMapper.batchDeleteDragTableBtnByTableKey(btnTableKeys);
+    }
+
+    /**
+     * 删除格绑定的自定义按钮信息
+     * 
+     * @param id 格绑定的自定义按钮主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDragTableBtnById(Long id)
+    {
+        return dragTableBtnMapper.deleteDragTableBtnById(id);
+    }
+
+    @Override
+    public boolean hasChildByBtnId(Long btnId) {
+        return dragTableBtnMapper.hasChildByBtnId(btnId) > 0;
+    }
+}

+ 39 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableServiceImpl.java

@@ -57,6 +57,12 @@ public class DragTableServiceImpl implements IDragTableService {
     @Resource
     private DragTableStyleMapper dragTableStyleMapper;
 
+    @Resource
+    private DragTableBtnMapper dragTableBtnMapper;
+
+    @Resource
+    private DragTableBtnRelevanceMapper dragTableBtnRelevanceMapper;
+
     /**
      * 查询动态表格
      *
@@ -153,11 +159,40 @@ public class DragTableServiceImpl implements IDragTableService {
         dragTableStyle.setTableKey(dragTable.getTableKey());
         List<DragTableStyle> dragTableStyleList = dragTableStyleMapper.selectDragTableStyleList(dragTableStyle);
         resultMap.put("style",dragTableStyleList);
+        // 动态表格按钮信息
+        //根据tableKey获取根节点信息
+        List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(dragTable.getTableKey());
+        //获取根节点数据
+        System.err.println(btnKeys.toString());
+        List<DragTableBtn> rootNodes = dragTableBtnMapper.selectDragTableBtnListByBtnKey(btnKeys);
+        System.err.println(rootNodes.toString());
+        //查询子节点
+        List<Long> ids = rootNodes.stream().map(m -> m.getId()).collect(Collectors.toList());
+        if (ids.isEmpty()){
+            resultMap.put("button",rootNodes);
+        }else {
+            List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
+            List<DragTableBtn> btnList = rootNodes.stream().peek(
+                    root -> root.setChildren(getChildrenList(root, childNodes))
+            ).collect(Collectors.toList());
+            resultMap.put("button",btnList);
+        }
         CommonEntity commonEntity = new CommonEntity();
         commonEntity.setResultMap(resultMap);
         return 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;
+    }
+
     // SQL 条件的开始
     public static final String SQL_START = "CONCAT(";
 
@@ -315,6 +350,10 @@ public class DragTableServiceImpl implements IDragTableService {
         DragTableStyle dragTableStyle = new DragTableStyle();
         dragTableStyle.setTableKey(vo.getTableKey());
         vo.setDragTableStyleList(dragTableStyleMapper.selectDragTableStyleList(dragTableStyle));
+        //查询动态表格和按钮关联表信息
+        DragTableBtnRelevance dragTableBtnRelevance = new DragTableBtnRelevance();
+        dragTableBtnRelevance.setTableKey(vo.getTableKey());
+        vo.setDragTableBtnRelevanceList(dragTableBtnRelevanceMapper.selectDragTableBtnRelevanceList(dragTableBtnRelevance));
         return vo;
     }
 

+ 1 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableStatisticServiceImpl.java

@@ -165,8 +165,7 @@ public class DragTableStatisticServiceImpl implements IDragTableStatisticService
         }
         //update Statistic
         if(editList.size() > 0){
-            dragTableStatisticMapper.batchUpdateDragTableStatistic(editList);
-
+            editList.stream().forEach(e -> dragTableStatisticMapper.updateDragTableStatistic(e));
         }
         // select Statistic sqlKey
         List<String> allSqlKey = dragTableStatisticMapper.selectSqlKeyByTableKey(vo.getTableKey());

+ 1 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableStyleServiceImpl.java

@@ -105,7 +105,7 @@ public class DragTableStyleServiceImpl implements IDragTableStyleService
             dragTableStyleMapper.batchInsertDragTableStyle(addList);
         }
         if(editList.size() >0){
-            dragTableStyleMapper.batchUpdateDragTableStyle(editList);
+            editList.stream().forEach(e -> dragTableStyleMapper.updateDragTableStyle(e));
         }
     }
 

+ 14 - 16
ruoyi-system/src/main/resources/mapper/DragTableStyleMapper.xml

@@ -60,25 +60,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </foreach>
     </insert>
 
-    <update id="batchUpdateDragTableStyle" parameterType="com.ruoyi.system.entity.DragTableStyle">
-        <foreach collection="list" item="item" separator=";">
+    <update id="updateDragTableStyle" parameterType="com.ruoyi.system.entity.DragTableStyle">
             update drag_table_style
             <trim prefix="SET" suffixOverrides=",">
-                <if test="item.styleName != null">style_name = #{item.styleName},</if>
-                <if test="item.styleCode != null">style_code = #{item.styleCode},</if>
-                <if test="item.tableKey != null">table_key = #{item.tableKey},</if>
-                <if test="item.styleCondtion != null and item.styleCondtion != ''">style_condtion = #{item.styleCondtion},</if>
-                <if test="item.styleField != null">style_field = #{item.styleField},</if>
-                <if test="item.styleType != null">style_type = #{item.styleType},</if>
-                <if test="item.styleDescription != null">style_description = #{item.styleDescription},</if>
-                <if test="item.spare1 != null">spare1 = #{item.spare1},</if>
-                <if test="item.spare2 != null">spare2 = #{item.spare2},</if>
-                <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
-                <if test="item.updateById != null">update_by_id = #{item.updateById},</if>
-                <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
+                <if test="styleName != null">style_name = #{styleName},</if>
+                <if test="styleCode != null">style_code = #{styleCode},</if>
+                <if test="tableKey != null">table_key = #{tableKey},</if>
+                <if test="styleCondtion != null and styleCondtion != ''">style_condtion = #{styleCondtion},</if>
+                <if test="styleField != null">style_field = #{styleField},</if>
+                <if test="styleType != null">style_type = #{styleType},</if>
+                <if test="styleDescription != null">style_description = #{styleDescription},</if>
+                <if test="spare1 != null">spare1 = #{spare1},</if>
+                <if test="spare2 != null">spare2 = #{spare2},</if>
+                <if test="updateBy != null">update_by = #{updateBy},</if>
+                <if test="updateById != null">update_by_id = #{updateById},</if>
+                <if test="updateTime != null">update_time = #{updateTime},</if>
             </trim>
-            where id = #{item.id}
-        </foreach>
+            where id = #{id}
     </update>
 
     <update id="deleteDragTableStyleByTableKeys" parameterType="String">

+ 169 - 0
ruoyi-system/src/main/resources/mapper/dragmapper/DragTableBtnMapper.xml

@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.system.mapper.DragTableBtnMapper">
+    
+    <resultMap type="com.ruoyi.system.entity.DragTableBtn" id="DragTableBtnResult">
+        <result property="id"    column="id"    />
+        <result property="btnParentId"    column="btn_parent_id"    />
+        <result property="btnKey"    column="btn_key"    />
+        <result property="ancestorsId" column="ancestors_id"/>
+        <result property="btnGroupName" column="btn_group_name"/>
+        <result property="btnName"    column="btn_name"    />
+        <result property="btnType"    column="btn_type"    />
+        <result property="btnIcon" column="btn_icon"/>
+        <result property="btnFormKey"    column="btn_form_key"    />
+        <result property="btnProcessKey"    column="btn_process_key"    />
+        <result property="btnTableKey"    column="btn_table_key"    />
+        <result property="btnScriptKey"    column="btn_script_key"    />
+        <result property="btnShowCondition"    column="btn_show_condition"    />
+        <result property="btnParams"    column="btn_params"    />
+        <result property="btnHasPermi"    column="btn_has_permi"    />
+        <result property="btnSort"    column="btn_sort"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createById"    column="create_by_id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateById"    column="update_by_id"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectDragTableBtnVo">
+        select id, btn_parent_id,ancestors_id, btn_key,btn_group_name, btn_name, btn_type,btn_icon, btn_form_key, btn_process_key, btn_table_key, btn_script_key, btn_show_condition, btn_params, btn_has_permi, btn_sort, del_flag, create_by, create_by_id, create_time, update_by, update_by_id, update_time, remark from drag_table_btn
+    </sql>
+
+    <select id="selectDragTableBtnList" parameterType="com.ruoyi.system.entity.DragTableBtn" resultMap="DragTableBtnResult">
+        <include refid="selectDragTableBtnVo"/>
+        where del_flag = '0'
+            <if test="btnParentId != null "> and btn_parent_id = #{btnParentId}</if>
+            <if test="btnKey != null  and btnKey != ''"> and btn_key = #{btnKey}</if>
+            <if test="btnGroupName != null  and btnGroupName != ''"> and btn_group_name like concat('%', #{btnGroupName}, '%')</if>
+            <if test="btnName != null  and btnName != ''"> and btn_name like concat('%', #{btnName}, '%')</if>
+            <if test="btnType != null  and btnType != ''"> and btn_type = #{btnType}</if>
+            <if test="btnFormKey != null  and btnFormKey != ''"> and btn_form_key = #{btnFormKey}</if>
+            <if test="btnProcessKey != null  and btnProcessKey != ''"> and btn_process_key = #{btnProcessKey}</if>
+            <if test="btnTableKey != null  and btnTableKey != ''"> and btn_table_key = #{btnTableKey}</if>
+            <if test="btnScriptKey != null  and btnScriptKey != ''"> and btn_script_key = #{btnScriptKey}</if>
+            <if test="btnShowCondition != null  and btnShowCondition != ''"> and btn_show_condition = #{btnShowCondition}</if>
+            <if test="btnParams != null  and btnParams != ''"> and btn_params = #{btnParams}</if>
+            <if test="btnHasPermi != null  and btnHasPermi != ''"> and btn_has_permi = #{btnHasPermi}</if>
+            <if test="btnSort != null "> and btn_sort = #{btnSort}</if>
+            <if test="createById != null "> and create_by_id = #{createById}</if>
+            <if test="updateById != null "> and update_by_id = #{updateById}</if>
+             order by btn_sort asc
+    </select>
+    
+    <select id="selectDragTableBtnById" parameterType="Long" resultMap="DragTableBtnResult">
+        <include refid="selectDragTableBtnVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertDragTableBtn" parameterType="com.ruoyi.system.entity.DragTableBtn">
+        insert into drag_table_btn
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="btnParentId != null">btn_parent_id,</if>
+            <if test="btnKey != null">btn_key,</if>
+            <if test="ancestorsId != null">ancestors_id,</if>
+            <if test="btnGroupName != null">btn_group_name,</if>
+            <if test="btnName != null">btn_name,</if>
+            <if test="btnType != null">btn_type,</if>
+            <if test="btnIcon != null">btn_icon,</if>
+            <if test="btnFormKey != null">btn_form_key,</if>
+            <if test="btnProcessKey != null">btn_process_key,</if>
+            <if test="btnTableKey != null">btn_table_key,</if>
+            <if test="btnScriptKey != null">btn_script_key,</if>
+            <if test="btnShowCondition != null">btn_show_condition,</if>
+            <if test="btnParams != null">btn_params,</if>
+            <if test="btnHasPermi != null">btn_has_permi,</if>
+            <if test="btnSort != null">btn_sort,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createById != null">create_by_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="remark != null">remark,</if>
+            del_flag
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="btnParentId != null">#{btnParentId},</if>
+            <if test="btnKey != null">#{btnKey},</if>
+            <if test="ancestorsId != null">#{ancestorsId},</if>
+            <if test="btnGroupName != null">#{btnGroupName},</if>
+            <if test="btnName != null">#{btnName},</if>
+            <if test="btnType != null">#{btnType},</if>
+            <if test="btnIcon != null">#{btnIcon},</if>
+            <if test="btnFormKey != null">#{btnFormKey},</if>
+            <if test="btnProcessKey != null">#{btnProcessKey},</if>
+            <if test="btnTableKey != null">#{btnTableKey},</if>
+            <if test="btnScriptKey != null">#{btnScriptKey},</if>
+            <if test="btnShowCondition != null">#{btnShowCondition},</if>
+            <if test="btnParams != null">#{btnParams},</if>
+            <if test="btnHasPermi != null">#{btnHasPermi},</if>
+            <if test="btnSort != null">#{btnSort},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createById != null">#{createById},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="remark != null">#{remark},</if>
+            '0'
+         </trim>
+    </insert>
+
+    <update id="updateDragTableBtn" parameterType="com.ruoyi.system.entity.DragTableBtn">
+        update drag_table_btn
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="btnParentId != null">btn_parent_id = #{btnParentId},</if>
+            <if test="btnKey != null">btn_key = #{btnKey},</if>
+            <if test="ancestorsId != null">ancestors_id = #{ancestorsId},</if>
+            <if test="btnGroupName != null">btn_group_name = #{btnGroupName},</if>
+            <if test="btnName != null">btn_name = #{btnName},</if>
+            <if test="btnType != null">btn_type = #{btnType},</if>
+            <if test="btnIcon != null">btn_icon = #{btnIcon},</if>
+            <if test="btnFormKey != null">btn_form_key = #{btnFormKey},</if>
+            <if test="btnProcessKey != null">btn_process_key = #{btnProcessKey},</if>
+            <if test="btnTableKey != null">btn_table_key = #{btnTableKey},</if>
+            <if test="btnScriptKey != null">btn_script_key = #{btnScriptKey},</if>
+            <if test="btnShowCondition != null">btn_show_condition = #{btnShowCondition},</if>
+            <if test="btnParams != null">btn_params = #{btnParams},</if>
+            <if test="btnHasPermi != null">btn_has_permi = #{btnHasPermi},</if>
+            <if test="btnSort != null">btn_sort = #{btnSort},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateById != null">update_by_id = #{updateById},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <update id="deleteDragTableBtnById" parameterType="Long">
+        update drag_table_btn set del_flag = '2' where id = #{id}
+    </update>
+
+    <update id="batchDeleteDragTableBtnByTableKey" parameterType="String">
+        update drag_table_btn set del_flag = '2' where btn_table_key in
+        <foreach item="btnTableKey" collection="list" open="(" separator="," close=")">
+            #{btnTableKey}
+        </foreach>
+    </update>
+
+    <select id="selectDragTableBtnListByBtnKey" resultMap="DragTableBtnResult">
+        <include refid="selectDragTableBtnVo"></include>
+        where del_flag = '0' and btn_key in
+        <foreach collection="list" item="btnKey" open="(" close=")" separator=",">
+            #{btnKey}
+        </foreach>
+    </select>
+
+    <select id="selectChildNodeById" resultMap="DragTableBtnResult">
+        <include refid="selectDragTableBtnVo"></include>
+        where del_flag = '0' and
+        <foreach collection="list" item="id" open="(" close=")" separator="or">
+            FIND_IN_SET(#{id},ancestors_id)
+        </foreach>
+    </select>
+
+    <select id="hasChildByBtnId" resultType="Integer">
+        select count(1) from drag_table_btn where btn_parent_id = #{btnId}
+    </select>
+
+</mapper>

+ 60 - 0
ruoyi-system/src/main/resources/mapper/dragmapper/DragTableBtnRelevanceMapper.xml

@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.system.mapper.DragTableBtnRelevanceMapper">
+    
+    <resultMap type="com.ruoyi.system.entity.DragTableBtnRelevance" id="DragTableBtnRelevanceResult">
+        <result property="tableKey"    column="table_key"    />
+        <result property="btnKey"    column="btn_key"    />
+    </resultMap>
+
+    <sql id="selectDragTableBtnRelevanceVo">
+        select table_key, btn_key from drag_table_btn_relevance
+    </sql>
+
+    <select id="selectDragTableBtnRelevanceList" parameterType="com.ruoyi.system.entity.DragTableBtnRelevance" resultMap="DragTableBtnRelevanceResult">
+        <include refid="selectDragTableBtnRelevanceVo"/>
+        <where>  
+            <if test="tableKey != null  and tableKey != ''"> and table_key = #{tableKey}</if>
+            <if test="btnKey != null  and btnKey != ''"> and btn_key = #{btnKey}</if>
+        </where>
+    </select>
+    
+    <select id="selectDragTableBtnRelevanceByTableKey" parameterType="String" resultMap="DragTableBtnRelevanceResult">
+        <include refid="selectDragTableBtnRelevanceVo"/>
+        where table_key = #{tableKey}
+    </select>
+        
+    <insert id="batchInsertDragTableBtnRelevance" parameterType="com.ruoyi.system.entity.DragTableBtnRelevance">
+        insert into drag_table_btn_relevance
+            (table_key,btn_key)
+            values
+            <foreach collection="list" item="item" separator=",">
+                (#{item.tableKey},#{item.btnKey})
+            </foreach>
+    </insert>
+
+    <update id="updateDragTableBtnRelevance" parameterType="com.ruoyi.system.entity.DragTableBtnRelevance">
+        update drag_table_btn_relevance
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="btnKey != null">btn_key = #{btnKey},</if>
+        </trim>
+        where table_key = #{tableKey}
+    </update>
+
+    <delete id="deleteDragTableBtnRelevanceByTableKey" parameterType="String">
+        delete from drag_table_btn_relevance where table_key = #{tableKey}
+    </delete>
+
+    <delete id="deleteDragTableBtnRelevanceByTableKeys" parameterType="String">
+        delete from drag_table_btn_relevance where table_key in 
+        <foreach item="tableKey" collection="list" open="(" separator="," close=")">
+            #{tableKey}
+        </foreach>
+    </delete>
+
+    <select id="selectBtnKeyByTableKey" resultType="string">
+        select btn_key from drag_table_btn_relevance where table_key = #{tableKey}
+    </select>
+</mapper>

+ 11 - 13
ruoyi-system/src/main/resources/mapper/dragmapper/DragTableStatisticMapper.xml

@@ -50,22 +50,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </insert>
 
-    <update id="batchUpdateDragTableStatistic">
-        <foreach collection="list" item="item" separator=";">
+    <update id="updateDragTableStatistic">
         update drag_table_statistic
         <trim prefix="SET" suffixOverrides=",">
-            <if test="item.statisticTitle != null">statistic_title = #{item.statisticTitle},</if>
-            <if test="item.tableKey != null">table_key = #{item.tableKey},</if>
-            <if test="item.statisticDescription != null">statistic_description = #{item.statisticDescription},</if>
-            <if test="item.statisticType != null">statistic_type = #{item.statisticType},</if>
-            <if test="item.statisticField != null">statistic_field = #{item.statisticField},</if>
-            <if test="item.statisticObject != null">statistic_object = #{item.statisticObject},</if>
-            <if test="item.sqlKey != null">sql_key = #{item.sqlKey},</if>
-            <if test="item.updateBy != null">update_by = #{item.updateBy},</if>
-            <if test="item.updateTime != null">update_time = #{item.updateTime},</if>
+            <if test="statisticTitle != null">statistic_title = #{statisticTitle},</if>
+            <if test="tableKey != null">table_key = #{tableKey},</if>
+            <if test="statisticDescription != null">statistic_description = #{statisticDescription},</if>
+            <if test="statisticType != null">statistic_type = #{statisticType},</if>
+            <if test="statisticField != null">statistic_field = #{statisticField},</if>
+            <if test="statisticObject != null">statistic_object = #{statisticObject},</if>
+            <if test="sqlKey != null">sql_key = #{sqlKey},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
         </trim>
-        where id = #{item.id}
-        </foreach>
+        where id = #{id}
     </update>
 
     <update id="deleteDragTableStatisticByTableKey" parameterType="String">