侯茂昌 před 1 rokem
rodič
revize
5a01501a3c
66 změnil soubory, kde provedl 2878 přidání a 227 odebrání
  1. 6 0
      pom.xml
  2. 6 0
      ruoyi-admin/pom.xml
  3. 61 9
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/CommonController.java
  4. 34 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragFormController.java
  5. 102 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableBtnController.java
  6. 32 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableConditionController.java
  7. 114 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableController.java
  8. 92 1
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableGroupController.java
  9. 24 17
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableStatisticController.java
  10. 0 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableStyleController.java
  11. 1 0
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/TableSqlController.java
  12. 6 0
      ruoyi-business/pom.xml
  13. 274 0
      ruoyi-business/src/main/java/com/ruoyi/business/entity/DragTableBtn.java
  14. 52 0
      ruoyi-business/src/main/java/com/ruoyi/business/entity/DragTableBtnRelevance.java
  15. 15 0
      ruoyi-business/src/main/java/com/ruoyi/business/entity/DragTableGroup.java
  16. 34 13
      ruoyi-business/src/main/java/com/ruoyi/business/entity/vo/DragTableVo.java
  17. 10 0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/CommonMapper.java
  18. 89 0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/DragTableBtnMapper.java
  19. 68 0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/DragTableBtnRelevanceMapper.java
  20. 6 0
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/DragTableGroupMapper.java
  21. 4 2
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/DragTableStatisticMapper.java
  22. 3 2
      ruoyi-business/src/main/java/com/ruoyi/business/mapper/DragTableStyleMapper.java
  23. 16 2
      ruoyi-business/src/main/java/com/ruoyi/business/service/ICommonService.java
  24. 3 1
      ruoyi-business/src/main/java/com/ruoyi/business/service/IDragFormService.java
  25. 64 0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableBtnRelevanceService.java
  26. 79 0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableBtnService.java
  27. 2 0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableConditionService.java
  28. 19 0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableGroupService.java
  29. 4 2
      ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableService.java
  30. 0 1
      ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableStatisticService.java
  31. 2 0
      ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableStyleService.java
  32. 2 1
      ruoyi-business/src/main/java/com/ruoyi/business/service/ITableSqlService.java
  33. 15 7
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/CommonServiceImpl.java
  34. 22 11
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragFormServiceImpl.java
  35. 103 0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableBtnRelevanceServiceImpl.java
  36. 168 0
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableBtnServiceImpl.java
  37. 239 19
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableGroupServiceImpl.java
  38. 79 28
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableServiceImpl.java
  39. 15 13
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableStatisticServiceImpl.java
  40. 2 7
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableStyleServiceImpl.java
  41. 1 5
      ruoyi-business/src/main/java/com/ruoyi/business/service/impl/TableSqlServiceImpl.java
  42. 15 0
      ruoyi-business/src/main/resources/mapper/common/CommonMapper.xml
  43. 1 7
      ruoyi-business/src/main/resources/mapper/dragmapper/DragFormMapper.xml
  44. 174 0
      ruoyi-business/src/main/resources/mapper/dragmapper/DragTableBtnMapper.xml
  45. 60 0
      ruoyi-business/src/main/resources/mapper/dragmapper/DragTableBtnRelevanceMapper.xml
  46. 2 2
      ruoyi-business/src/main/resources/mapper/dragmapper/DragTableConditionMapper.xml
  47. 1 3
      ruoyi-business/src/main/resources/mapper/dragmapper/DragTableFormMapper.xml
  48. 8 0
      ruoyi-business/src/main/resources/mapper/dragmapper/DragTableGroupMapper.xml
  49. 4 1
      ruoyi-business/src/main/resources/mapper/dragmapper/DragTableMapper.xml
  50. 14 16
      ruoyi-business/src/main/resources/mapper/dragmapper/DragTableStatisticMapper.xml
  51. 14 16
      ruoyi-business/src/main/resources/mapper/dragmapper/DragTableStyleMapper.xml
  52. 6 0
      ruoyi-common/pom.xml
  53. 41 0
      ruoyi-common/src/main/java/com/ruoyi/common/constant/ButtonTypeConstants.java
  54. 6 0
      ruoyi-framework/pom.xml
  55. 1 0
      ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SqlInterceptor.java
  56. 6 0
      ruoyi-system/pom.xml
  57. 3 0
      ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml
  58. 45 0
      ruoyi-ui/src/api/bpmprocess/run/executeMiddle.js
  59. 44 0
      ruoyi-ui/src/api/bpmprocess/run/executeNode.js
  60. 64 0
      ruoyi-ui/src/api/bpmprocess/run/executeProcess.js
  61. 8 8
      ruoyi-ui/src/api/tablelist/commonTable.js
  62. 51 10
      ruoyi-ui/src/views/bussiness/components/TaskItem.vue
  63. 28 12
      ruoyi-ui/src/views/bussiness/components/taskList.vue
  64. 74 0
      ruoyi-ui/src/views/bussiness/dialogCompments/GY1.vue
  65. 276 4
      ruoyi-ui/src/views/bussiness/processMange.vue
  66. 64 3
      ruoyi-ui/src/views/bussiness/progressShow.vue

+ 6 - 0
pom.xml

@@ -205,6 +205,12 @@
             <version>3.3.2</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <build>

+ 6 - 0
ruoyi-admin/pom.xml

@@ -52,6 +52,12 @@
             <artifactId>ruoyi-business</artifactId>
             <version>3.8.5</version>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <build>

+ 61 - 9
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/CommonController.java

@@ -1,18 +1,19 @@
 package com.ruoyi.web.controller.dragForm;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.ruoyi.business.entity.CommonEntity;
+import com.ruoyi.business.entity.DragForm;
 import com.ruoyi.business.entity.TableSql;
-import com.ruoyi.business.service.ICommonService;
-import com.ruoyi.business.service.IDragTableGroupService;
-import com.ruoyi.business.service.IDragTableService;
-import com.ruoyi.business.service.ITableSqlService;
+import com.ruoyi.business.service.*;
+import com.ruoyi.common.constant.ButtonTypeConstants;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.exception.tenantdatassource.TenantDataSource;
 import org.springframework.web.bind.annotation.*;
-
 import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/dragform/common")
@@ -21,12 +22,18 @@ public class CommonController extends BaseController {
     @Resource
     private ICommonService commonService;
 
-    @Resource
+    @Resource  // 动态sql
     private ITableSqlService iTableSqlService;
 
-    @Resource
+    @Resource // 动态表格
     private IDragTableService dragTableService;
 
+    @Resource
+    private IDragTableGroupService dragTableGroupService;
+
+    @Resource
+    private IDragFormService dragFormService;
+
     /**
      * 共通查询
      */
@@ -69,8 +76,9 @@ public class CommonController extends BaseController {
     @GetMapping("/getTableList")
     public TableDataInfo queryTableList(CommonEntity commonEntity) throws TenantDataSource {
         TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(commonEntity.getQueryMap().get("sqlkey").toString());
+        System.err.println(tableSql);
         startPage();  // 校验是否sqlserver 否执行 是执行另一种方式的分页
-        return getDataTable(commonService.queryTableList2(commonEntity, tableSql));
+        return getDataTable(commonService.queryGroupTableList(commonEntity, tableSql));
     }
 
     /**
@@ -82,14 +90,58 @@ public class CommonController extends BaseController {
     }
 
     /**
-     *  动态表单预览接口
+     * 查询表格组信息
      * @param commonEntity
      * @return
      */
+    @GetMapping("/dragGroupTableInfo")
+    public AjaxResult dragGroupTableInfo(CommonEntity commonEntity) {
+        return   AjaxResult.success(dragTableGroupService.selectDragTableGroup(commonEntity.getQueryMap().get("groupKey").toString()));
+    }
+
+    /**
+     * 动态表单预览接口
+     */
     @GetMapping("/dragTablePreview")
     public TableDataInfo DragTablePreview(CommonEntity commonEntity) {
         startPage();
         return getDataTable(commonService.dragTablePreview(commonEntity));
     }
 
+    /**
+     * 处理按钮通用接口(新增、修改、删除)
+     */
+    @PostMapping("/commonBtnHandle")
+    public AjaxResult commonBtnHandle(@RequestBody CommonEntity commonEntity) throws JsonProcessingException {
+        //按钮类型
+        Long btnType = Long.valueOf(commonEntity.getBasicMap().get("btnType").toString());
+        //是否开启弹窗
+        String visible = commonEntity.getBasicMap().get("visible").toString();
+        /*
+        * 判断什么类型走什么接口:
+        * btnType  10:新增、8:修改、9:删除、5:脚本
+        * visible  false代表弹窗未开启时走回显表单模板及数据信息接口;true代表弹窗开启时走保存数据接口
+        * */
+        if (btnType == ButtonTypeConstants.INSERT && visible.equals("true")) {
+            return toAjax(commonService.batchInsert(commonEntity));
+        } else if (btnType == ButtonTypeConstants.INSERT && visible.equals("false")) {
+            String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
+            return success(dragFormService.selectDragFormBySqlKey(sqlKey));
+        } else if (btnType == ButtonTypeConstants.UPDATE && visible.equals("true")) {
+            return toAjax(commonService.edit(commonEntity));
+        } else if (btnType == ButtonTypeConstants.UPDATE && visible.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 if (btnType == ButtonTypeConstants.DELETE) {
+            return toAjax(commonService.batchDelete(commonEntity));
+        } else if(btnType == ButtonTypeConstants.SCRIPT) {
+        }
+        return warn("暂不支持该操作!");
+    }
 }

+ 34 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragFormController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.dragForm;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.ruoyi.business.entity.DragForm;
 import com.ruoyi.business.service.IDragFormService;
 import com.ruoyi.common.annotation.Log;
@@ -9,11 +10,11 @@ import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import org.springframework.web.bind.annotation.*;
-
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
+
 /**
  * 动态表单
  * Controller
@@ -64,12 +65,43 @@ public class DragFormController extends BaseController {
         return success(dragFormService.selectDragFormByFId(fId));
     }
 
+    /**
+     * 新增动态表单
+     */
+    //@PreAuthorize("@ss.hasPermi('system:form:add')")
+    @Log(title = "动态表单", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody DragForm dragForm) {
+        return dragFormService.insertDragForm(dragForm);
+    }
+
+    /**
+     * 修改动态表单
+     */
+    //@PreAuthorize("@ss.hasPermi('system:form:edit')")
+    @Log(title = "动态表单", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody DragForm dragForm) {
+        return toAjax(dragFormService.updateDragForm(dragForm));
+    }
+
+    /**
+     * 删除动态表单
+     */
+    //@PreAuthorize("@ss.hasPermi('system:form:remove')")
+    @Log(title = "动态表单", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{fIds}")
+    public AjaxResult remove(@PathVariable Long[] fIds) {
+        return toAjax(dragFormService.deleteDragFormByFIds(fIds));
+    }
+
     /**
      * 获取动态表单
      * 详细信息
      */
     @GetMapping("/getInfoBySqlKey/{sqlKey}")
-    public AjaxResult getInfoBySqlKey(@PathVariable("sqlKey") String sqlKey) {
+    public AjaxResult getInfoBySqlKey(@PathVariable("sqlKey") String sqlKey) throws JsonProcessingException {
         return success(dragFormService.selectDragFormBySqlKey(sqlKey));
     }
+
 }

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

@@ -0,0 +1,102 @@
+package com.ruoyi.web.controller.dragForm;
+
+import com.ruoyi.business.entity.DragTableBtn;
+import com.ruoyi.business.service.IDragTableBtnService;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+
+/**
+ * 格绑定的自定义按钮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));
+    }
+}

+ 32 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableConditionController.java

@@ -35,4 +35,36 @@ public class DragTableConditionController extends BaseController
         return getDataTable(dragTableConditionService.selectDragTableConditionList(commonEntity));
     }
 
+    /**
+     * 新增动态表格条件
+     */
+    @PreAuthorize("@ss.hasPermi('system:condition:add')")
+    @Log(title = "动态表格条件", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody CommonEntity commonEntity)
+    {
+        return toAjax(dragTableConditionService.insertDragTableCondition(commonEntity));
+    }
+
+    /**
+     * 修改动态表格条件
+     */
+    @PreAuthorize("@ss.hasPermi('system:condition:edit')")
+    @Log(title = "动态表格条件", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody CommonEntity commonEntity)
+    {
+        return toAjax(dragTableConditionService.updateDragTableCondition(commonEntity));
+    }
+
+    /**
+     * 删除动态表格条件
+     */
+    @PreAuthorize("@ss.hasPermi('system:condition:remove')")
+    @Log(title = "动态表格条件", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{tcIds}")
+    public AjaxResult remove(@RequestBody CommonEntity commonEntity)
+    {
+        return toAjax(dragTableConditionService.deleteDragTableConditionByTcIds(commonEntity));
+    }
 }

+ 114 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableController.java

@@ -2,7 +2,9 @@ package com.ruoyi.web.controller.dragForm;
 
 import com.ruoyi.business.entity.DragTable;
 import com.ruoyi.business.entity.vo.DragTableVo;
+import com.ruoyi.business.service.IDragTableBtnRelevanceService;
 import com.ruoyi.business.service.IDragTableService;
+import com.ruoyi.business.service.IDragTableStatisticService;
 import com.ruoyi.business.service.IDragTableStyleService;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
@@ -12,8 +14,10 @@ import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 动态表格Controller
@@ -28,6 +32,15 @@ public class DragTableController extends BaseController {
     @Autowired
     private IDragTableService dragTableService;
 
+    @Autowired
+    private IDragTableStatisticService dragTableStatisticService;
+
+    @Autowired
+    private IDragTableStyleService dragTableStyleService;
+
+    @Autowired
+    private IDragTableBtnRelevanceService dragTableBtnRelevanceService;
+    
     /**
      * 查询动态表格列表
      */
@@ -49,6 +62,63 @@ public class DragTableController extends BaseController {
         util.exportExcel(response, list, "动态表格数据");
     }
 
+    /**
+     * 获取动态表格详细信息
+     */
+//    @GetMapping(value = "/{tId}")
+//    public AjaxResult getInfo(@PathVariable("tId") Long tId) {
+//        return success(dragTableService.selectDragTableByTId(tId));
+//    }
+
+    /**
+     * 新增动态表格
+     */
+    @Log(title = "动态表格", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody DragTable dragTable) {
+        return toAjax(dragTableService.insertDragTable(dragTable));
+    }
+
+//    /**
+//     * 修改动态表格
+//     */
+//    @Log(title = "动态表格", businessType = BusinessType.UPDATE)
+//    @PutMapping
+//    public AjaxResult edit(@RequestBody DragTable dragTable) {
+//        return toAjax(dragTableService.updateDragTable(dragTable));
+//    }
+
+//    /**
+//     * 删除动态表格
+//     */
+//    @Log(title = "动态表格", businessType = BusinessType.DELETE)
+//    @DeleteMapping("/{tIds}")
+//    public AjaxResult remove(@PathVariable Long[] tIds) {
+//        return toAjax(dragTableService.deleteDragTableByTIds(tIds));
+//    }
+
+    /**
+     * 新增动态表格模版数据
+     */
+    @PostMapping("/addDragTable")
+    public AjaxResult addDragTable(@RequestBody DragTableVo dragTableVo){
+        //新增动态表格信息
+        dragTableService.addDragTable(dragTableVo);
+        //新增动态表格样式信息
+        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();
+    }
+
     /**
      * 获取动态表格详细信息
      */
@@ -57,4 +127,48 @@ public class DragTableController extends BaseController {
         return success(dragTableService.selectDragTableVoByTId(tId));
     }
 
+    /**
+     * 修改动态表格
+     */
+    @PutMapping("/edit")
+    public AjaxResult edit(@RequestBody DragTableVo dragTableVo) {
+        //修改动态表格信息
+        dragTableService.updateDragTable(dragTableVo);
+        //修改动态表格样式信息
+        dragTableStyleService.updateDragTableStyle(dragTableVo);
+        //修改动态表格数据统计信息
+//        dragTableStatisticService.updateDragTableStatistic(dragTableVo);
+        //修改动态表格和按钮关联表
+        dragTableBtnRelevanceService.updateDragTableBtnRelevance(dragTableVo);
+        return AjaxResult.success();
+    }
+
+    /**
+     * 删除动态表格
+     */
+    @DeleteMapping("/remove")
+    public AjaxResult remove(@RequestBody Map<String, Object> map) {
+        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();
+    }
+
+    /**
+     * 查询动态表格列表
+     */
+    @GetMapping("/dragTableList")
+    public AjaxResult dragTableList() {
+        return AjaxResult.success(dragTableService.selectDragTableList(new DragTable()));
+    }
+
 }

+ 92 - 1
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableGroupController.java

@@ -4,14 +4,19 @@ import com.ruoyi.business.entity.CommonEntity;
 import com.ruoyi.business.entity.DragTableGroup;
 import com.ruoyi.business.entity.vo.DragTableGroupVo;
 import com.ruoyi.business.service.IDragTableGroupService;
+import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
-
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 /**
  * @author hmc
@@ -36,6 +41,18 @@ public class DragTableGroupController extends BaseController {
         return   AjaxResult.success(dragTableGroupService.selectDragTableGroup(commonEntity.getQueryMap().get("groupKey").toString()));
     }
 
+    /**
+     * 查询拖拽格组列表
+     * @PreAuthorize("@ss.hasPermi('system:group:list')")
+     */
+    @GetMapping("/list")
+    @ApiOperation(value = "查询拖拽格组列表")
+    public TableDataInfo list(DragTableGroup dragTableGroup)
+    {
+        startPage();
+        List<DragTableGroup> list = dragTableGroupService.selectDragTableGroupList(dragTableGroup);
+        return getDataTable(list);
+    }
 
     /**
      * 查询拖拽表格组详细信息
@@ -50,6 +67,19 @@ public class DragTableGroupController extends BaseController {
         return AjaxResult.success(list);
     }
 
+    /**
+     * 导出拖拽格组列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:group:export')")
+    @Log(title = "拖拽格组", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ApiOperation(value = "导出拖拽格组列表")
+    public void export(HttpServletResponse response, DragTableGroup dragTableGroup)
+    {
+        List<DragTableGroup> list = dragTableGroupService.selectDragTableGroupList(dragTableGroup);
+        ExcelUtil<DragTableGroup> util = new ExcelUtil<DragTableGroup>(DragTableGroup.class);
+        util.exportExcel(response, list, "拖拽格组数据");
+    }
 
     /**
      * 获取拖拽格组详细信息
@@ -61,4 +91,65 @@ public class DragTableGroupController extends BaseController {
     {
         return success(dragTableGroupService.selectDragTableGroupById(id));
     }
+
+    /**
+     * 新增拖拽格组
+     */
+    @Log(title = "拖拽格组", businessType = BusinessType.INSERT)
+    @PostMapping
+    @ApiOperation(value = "新增拖拽格组")
+    public AjaxResult add(@RequestBody DragTableGroupVo dragTableGroupVo)
+    {
+        return toAjax(dragTableGroupService.insertDragTableGroup(dragTableGroupVo));
+    }
+
+    /**
+     * 新增配置表格组
+     */
+    @Log(title = "新增配置组", businessType = BusinessType.INSERT)
+    @PostMapping("/addConfigurationGroup")
+    @ApiOperation(value = "新增拖拽格组")
+    public AjaxResult addConfigurationGroup(@RequestBody DragTableGroupVo dragTableGroupVo)
+    {
+        return toAjax(dragTableGroupService.insertDragTableConfigurationGroup(dragTableGroupVo));
+    }
+
+    /**
+     * 修改拖拽格组
+     */
+    @PreAuthorize("@ss.hasPermi('system:group:edit')")
+    @Log(title = "拖拽格组", businessType = BusinessType.UPDATE)
+    @PutMapping
+    @ApiOperation(value = "修改拖拽格组")
+    public AjaxResult edit(@RequestBody DragTableGroupVo dragTableGroupVo)
+    {
+        return toAjax(dragTableGroupService.updateDragTableGroup(dragTableGroupVo));
+    }
+
+    /**
+     * 修改拖拽配置表格组
+     */
+    @PreAuthorize("@ss.hasPermi('system:group:edit')")
+    @Log(title = "拖拽格组", businessType = BusinessType.UPDATE)
+    @PutMapping("/editConfigurationGroup")
+    @ApiOperation(value = "修改拖拽配置表格组")
+    public AjaxResult editConfigurationGroup(@RequestBody DragTableGroupVo dragTableGroupVo)
+    {
+        return toAjax(dragTableGroupService.editConfigurationGroup(dragTableGroupVo));
+    }
+
+
+    /**
+     * 批量删除拖拽格组
+     */
+    @PreAuthorize("@ss.hasPermi('system:group:remove')")
+    @Log(title = "拖拽格组", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    @ApiOperation(value = "删除拖拽格组")
+    public AjaxResult batchRemove(@PathVariable Long[] ids)
+    {
+        //Boolean aBoolean = dragTableGroupService.selectDragTableGroupTableListSize(ids);
+        return toAjax(dragTableGroupService.deleteDragTableGroupByIds(ids));
+    }
+
 }

+ 24 - 17
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableStatisticController.java

@@ -15,10 +15,10 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
-
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
+
 /**
  * 动态表格统计Controller
  *
@@ -28,18 +28,19 @@ import java.util.List;
 @RestController
 @RequestMapping("/system/statistic")
 @Api(value = "/system/statistic", description = "动态表格统计-接口")
-public class DragTableStatisticController extends BaseController {
-
+public class DragTableStatisticController extends BaseController
+{
     @Autowired
     private IDragTableStatisticService dragTableStatisticService;
 
-    /**
-     * 查询动态表格统计列表
-     */
-    @PreAuthorize("@ss.hasPermi('system:statistic:list')")
-    @GetMapping("/list")
-    @ApiOperation(value = "查询动态表格统计列表")
-    public TableDataInfo list(DragTableStatistic dragTableStatistic) {
+/**
+ * 查询动态表格统计列表
+ */
+@PreAuthorize("@ss.hasPermi('system:statistic:list')")
+@GetMapping("/list")
+@ApiOperation(value = "查询动态表格统计列表")
+    public TableDataInfo list(DragTableStatistic dragTableStatistic)
+    {
         startPage();
         List<DragTableStatistic> list = dragTableStatisticService.selectDragTableStatisticList(dragTableStatistic);
         return getDataTable(list);
@@ -52,7 +53,8 @@ public class DragTableStatisticController extends BaseController {
     @Log(title = "动态表格统计", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ApiOperation(value = "导出动态表格统计列表")
-    public void export(HttpServletResponse response, DragTableStatistic dragTableStatistic) {
+    public void export(HttpServletResponse response, DragTableStatistic dragTableStatistic)
+    {
         List<DragTableStatistic> list = dragTableStatisticService.selectDragTableStatisticList(dragTableStatistic);
         ExcelUtil<DragTableStatistic> util = new ExcelUtil<DragTableStatistic>(DragTableStatistic.class);
         util.exportExcel(response, list, "动态表格统计数据");
@@ -64,7 +66,8 @@ public class DragTableStatisticController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:statistic:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取动态表格统计详细信息")
-    public AjaxResult getInfo(@PathVariable("id") Long id) {
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
         return success(dragTableStatisticService.selectDragTableStatisticById(id));
     }
 
@@ -75,7 +78,8 @@ public class DragTableStatisticController extends BaseController {
     @Log(title = "动态表格统计", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation(value = "新增动态表格统计")
-    public AjaxResult add(@RequestBody DragTableVo vo) {
+    public AjaxResult add(@RequestBody DragTableVo vo)
+    {
         return toAjax(dragTableStatisticService.batchInsertDragTableStatistic(vo));
     }
 
@@ -86,7 +90,8 @@ public class DragTableStatisticController extends BaseController {
     @Log(title = "动态表格统计", businessType = BusinessType.UPDATE)
     @PutMapping
     @ApiOperation(value = "修改动态表格统计")
-    public AjaxResult edit(@RequestBody DragTableVo vo) {
+    public AjaxResult edit(@RequestBody DragTableVo vo)
+    {
         dragTableStatisticService.updateDragTableStatistic(vo);
         return AjaxResult.success();
     }
@@ -98,7 +103,8 @@ public class DragTableStatisticController extends BaseController {
     @Log(title = "动态表格统计", businessType = BusinessType.DELETE)
     @DeleteMapping("/{tableKey}")
     @ApiOperation(value = "删除动态表格统计")
-    public AjaxResult remove(@PathVariable String tableKey) {
+    public AjaxResult remove(@PathVariable String tableKey)
+    {
         return toAjax(dragTableStatisticService.deleteDragTableStatisticByTableKey(tableKey));
     }
 
@@ -108,7 +114,8 @@ public class DragTableStatisticController extends BaseController {
     @PreAuthorize("@ss.hasPermi('system:statistic:query')")
     @GetMapping("/getInfoBySqlKey")
     @ApiOperation(value = "获取动态表格统计详细信息")
-    public AjaxResult getInfoBySqlKey(@RequestParam("sqlKey") String sqlKey) {
+    public AjaxResult getInfoBySqlKey(@RequestParam("sqlKey") String sqlKey)
+    {
         return success(dragTableStatisticService.getInfoBySqlKey(sqlKey));
     }
 
@@ -116,7 +123,7 @@ public class DragTableStatisticController extends BaseController {
      * 获取列表统计信息
      */
     @GetMapping("/getStatisticList")
-    public AjaxResult getStatisticList(CommonEntity commonEntity) {
+    public AjaxResult getStatisticList(CommonEntity commonEntity){
         return AjaxResult.success(dragTableStatisticService.getStatisticList(commonEntity));
     }
 

+ 0 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableStyleController.java

@@ -12,7 +12,6 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
-
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
@@ -97,5 +96,4 @@ public class DragTableStyleController extends BaseController
     {
         return toAjax(dragTableStyleService.deleteDragTableStyleByIds(ids));
     }
-
 }

+ 1 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/TableSqlController.java

@@ -11,6 +11,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
+
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 

+ 6 - 0
ruoyi-business/pom.xml

@@ -26,6 +26,12 @@
             <version>3.3.2</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
     <properties>

+ 274 - 0
ruoyi-business/src/main/java/com/ruoyi/business/entity/DragTableBtn.java

@@ -0,0 +1,274 @@
+package com.ruoyi.business.entity;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+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-business/src/main/java/com/ruoyi/business/entity/DragTableBtnRelevance.java

@@ -0,0 +1,52 @@
+package com.ruoyi.business.entity;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 动态格和动态格按钮关联对象 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();
+    }
+}

+ 15 - 0
ruoyi-business/src/main/java/com/ruoyi/business/entity/DragTableGroup.java

@@ -26,6 +26,11 @@ public class DragTableGroup extends BaseEntity {
     @Excel(name = "表格组key")
     private String groupKey;
 
+
+    /** 表格组类型 */
+    @Excel(name = "表格组key")
+    private String groupType;
+
     /** 表格组描述 */
     @Excel(name = "表格组描述")
     private String groupDescription;
@@ -82,6 +87,16 @@ public class DragTableGroup extends BaseEntity {
         this.groupKey = groupKey;
     }
 
+
+    public String getGroupType() {
+        return groupType;
+    }
+
+    public void setGroupType(String groupType) {
+        this.groupType = groupType;
+    }
+
+
     public String getDelFlag() {
         return delFlag;
     }

+ 34 - 13
ruoyi-business/src/main/java/com/ruoyi/business/entity/vo/DragTableVo.java

@@ -1,9 +1,7 @@
 package com.ruoyi.business.entity.vo;
 
-import com.ruoyi.business.entity.DragTableStatistic;
-import com.ruoyi.business.entity.DragTableStyle;
-import com.ruoyi.business.entity.TableSql;
-import java.util.HashMap;
+import com.ruoyi.business.entity.*;
+
 import java.util.List;
 import java.util.Map;
 
@@ -128,6 +126,12 @@ public class DragTableVo {
      */
     private List<DragTableStyle> dragTableStyleList;
 
+    /** 表格按钮 */
+    private List<DragTableBtn> dragTableBtnList;
+
+    /** 表格和按钮管理 */
+    private List<DragTableBtnRelevance> dragTableBtnRelevanceList;
+
     public Long gettId() {
         return tId;
     }
@@ -216,6 +220,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;
     }
@@ -232,7 +244,7 @@ public class DragTableVo {
         this.tableExportField = tableExportField;
     }
 
-    public Object getTableExportFieldEcho() {
+    public String getTableExportFieldEcho() {
         return tableExportFieldEcho;
     }
 
@@ -304,22 +316,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;
@@ -343,6 +359,8 @@ public class DragTableVo {
         this.dragTableStatisticList = dragTableStatisticList;
         this.tableSqlList = tableSqlList;
         this.dragTableStyleList = dragTableStyleList;
+        this.dragTableBtnList = dragTableBtnList;
+        this.dragTableBtnRelevanceList = dragTableBtnRelevanceList;
     }
 
     @Override
@@ -359,6 +377,7 @@ public class DragTableVo {
                 ", timeFormat='" + timeFormat + '\'' +
                 ", isSelection='" + isSelection + '\'' +
                 ", searchFieldList=" + searchFieldList +
+                ", conditionDefaultValueMap=" + conditionDefaultValueMap +
                 ", tableSql='" + tableSql + '\'' +
                 ", tableExportField=" + tableExportField +
                 ", tableExportFieldEcho='" + tableExportFieldEcho + '\'' +
@@ -370,6 +389,8 @@ public class DragTableVo {
                 ", dragTableStatisticList=" + dragTableStatisticList +
                 ", tableSqlList=" + tableSqlList +
                 ", dragTableStyleList=" + dragTableStyleList +
+                ", dragTableBtnList=" + dragTableBtnList +
+                ", dragTableBtnRelevanceList=" + dragTableBtnRelevanceList +
                 '}';
     }
 }

+ 10 - 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/CommonMapper.java

@@ -48,4 +48,14 @@ public interface CommonMapper {
      */
     List<Map<String,Object>> selectDropDownListByDict(String dictType);
 
+    /**
+     * 获取详情
+     */
+    CommonEntity getInfoById(@Param("tableName") String tableName, @Param("conditions") Map<String, Object> conditions);
+
+    /**
+     * 执行sql,直接返回map形式
+     */
+    List<Map<String,Object>> executeSql(String sql);
+
 }

+ 89 - 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/DragTableBtnMapper.java

@@ -0,0 +1,89 @@
+package com.ruoyi.business.mapper;
+
+
+import com.ruoyi.business.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 btnKeys 需要删除的数据主键集合
+     * @return 结果
+     */
+    int batchDeleteDragTableBtnByBtnKeys(List<String> btnKeys);
+
+    /**
+     * 查询动态表格绑定的自定义按钮
+     */
+    List<DragTableBtn> selectDragTableBtnListByBtnKey(List<String> btnKeys);
+
+    /**
+     * 根据id查询所有子节点数据
+     */
+    List<DragTableBtn> selectChildNodeById(List<Long> idList);
+
+    /**
+     * 是否存在按钮子节点
+     *
+     * @param btnId 按钮ID
+     * @return 结果
+     */
+    int hasChildByBtnId(Long btnId);
+
+    /**
+     * 查询格绑定的自定义按钮
+     *
+     * @param btnKey 格绑定的自定义按钮唯一标识
+     * @return 格绑定的自定义按钮
+     */
+    DragTableBtn selectDragTableBtnByBtnKey(String btnKey);
+}

+ 68 - 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/DragTableBtnRelevanceMapper.java

@@ -0,0 +1,68 @@
+package com.ruoyi.business.mapper;
+
+
+import com.ruoyi.business.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);
+}

+ 6 - 0
ruoyi-business/src/main/java/com/ruoyi/business/mapper/DragTableGroupMapper.java

@@ -72,4 +72,10 @@ public interface DragTableGroupMapper {
      */
     public  List<DragTableGroup> selectDragTableGroupByIdIn(Long[] ids);
 
+    /**
+     * 通过GroupKey
+     * @return
+     */
+    public  DragTableGroup selectDragTableGroupOneByGroupKey(String groupKey);
+
 }

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

@@ -1,6 +1,8 @@
 package com.ruoyi.business.mapper;
 
+
 import com.ruoyi.business.entity.DragTableStatistic;
+
 import java.util.List;
 
 /**
@@ -38,10 +40,10 @@ public interface DragTableStatisticMapper
     /**
      * 修改动态表格统计
      * 
-     * @param dragTableStatisticList 动态表格统计
+     * @param dragTableStatistic 动态表格统计
      * @return 结果
      */
-    int batchUpdateDragTableStatistic(List<DragTableStatistic> dragTableStatisticList);
+    int updateDragTableStatistic(DragTableStatistic dragTableStatistic);
 
     /**
      * 删除动态表格统计

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

@@ -1,5 +1,6 @@
 package com.ruoyi.business.mapper;
 
+
 import com.ruoyi.business.entity.DragTableStyle;
 
 import java.util.List;
@@ -39,10 +40,10 @@ public interface DragTableStyleMapper
     /**
      * 批量修改动态格样式
      * 
-     * @param dragTableStyleList 动态格样式
+     * @param dragTableStyle 动态格样式
      * @return 结果
      */
-    int batchUpdateDragTableStyle(List<DragTableStyle> dragTableStyleList);
+    int updateDragTableStyle(DragTableStyle dragTableStyle);
 
     /**
      * 删除动态格样式

+ 16 - 2
ruoyi-business/src/main/java/com/ruoyi/business/service/ICommonService.java

@@ -1,12 +1,13 @@
 package com.ruoyi.business.service;
 
+
 import com.ruoyi.business.entity.CommonEntity;
 import com.ruoyi.business.entity.TableSql;
 
-
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
+
 public interface ICommonService {
 
 
@@ -35,7 +36,13 @@ public interface ICommonService {
      */
     List<CommonEntity> queryTableList(CommonEntity commonEntity, TableSql tableSql);
 
-     List<CommonEntity> queryTableList2(CommonEntity commonEntity, TableSql tableSql);
+    /**
+     * 表格组查询表格信息
+     * @param commonEntity
+     * @param tableSql
+     * @return
+     */
+    List<CommonEntity> queryGroupTableList(CommonEntity commonEntity, TableSql tableSql);
 
     /**
      * 导出列表
@@ -52,4 +59,11 @@ public interface ICommonService {
      */
     List<CommonEntity> dragTablePreview(CommonEntity commonEntity);
 
+    /**
+     * 获取详情
+     */
+    CommonEntity getInfoById(CommonEntity commonEntity);
+
+
+
 }

+ 3 - 1
ruoyi-business/src/main/java/com/ruoyi/business/service/IDragFormService.java

@@ -2,11 +2,13 @@ package com.ruoyi.business.service;
 
 
 
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.ruoyi.business.entity.DragForm;
 import com.ruoyi.common.core.domain.AjaxResult;
 
 import java.util.List;
 
+
 /**
  * 动态表单
  * Service接口
@@ -72,5 +74,5 @@ public interface IDragFormService {
     /**
      * 根据sqlKey查询动态表单
      */
-    DragForm selectDragFormBySqlKey(String sqlKey);
+    DragForm selectDragFormBySqlKey(String sqlKey) throws JsonProcessingException;
 }

+ 64 - 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableBtnRelevanceService.java

@@ -0,0 +1,64 @@
+package com.ruoyi.business.service;
+
+
+import com.ruoyi.business.entity.DragTableBtnRelevance;
+import com.ruoyi.business.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);
+}

+ 79 - 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableBtnService.java

@@ -0,0 +1,79 @@
+package com.ruoyi.business.service;
+
+
+import com.ruoyi.business.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 btnKeys 需要删除的格绑定的自定义按钮主键集合
+     * @return 结果
+     */
+    int batchDeleteDragTableBtnByBtnKeys(List<String> btnKeys);
+
+    /**
+     * 删除格绑定的自定义按钮信息
+     * 
+     * @param id 格绑定的自定义按钮主键
+     * @return 结果
+     */
+    int deleteDragTableBtnById(Long id);
+
+    /**
+     * 是否存在按钮子节点
+     *
+     * @param btnId 菜单ID
+     * @return 结果 true 存在 false 不存在
+     */
+    boolean hasChildByBtnId(Long btnId);
+
+    /**
+     * 查询格绑定的自定义按钮
+     *
+     * @param btnKey 格绑定的自定义按钮唯一标识
+     * @return 格绑定的自定义按钮
+     */
+    DragTableBtn selectDragTableBtnByBtnKey(String btnKey);
+}

+ 2 - 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableConditionService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.business.service;
 
+
 import com.ruoyi.business.entity.CommonEntity;
+
 import java.util.List;
 
 /**

+ 19 - 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableGroupService.java

@@ -1,9 +1,12 @@
 package com.ruoyi.business.service;
 
+
 import com.ruoyi.business.entity.DragTableGroup;
 import com.ruoyi.business.entity.vo.DragTableGroupVo;
+
 import java.util.List;
 
+
 /**
  * @author hmc
  * @date 2023-11-01 14:26
@@ -35,6 +38,13 @@ public interface IDragTableGroupService {
      */
     public int insertDragTableGroup(DragTableGroupVo dragTableGroupVo);
 
+    /**
+     * 新增拖拽配置组
+     * @param dragTableGroupVo
+     * @return
+     */
+    public int insertDragTableConfigurationGroup(DragTableGroupVo dragTableGroupVo);
+
     /**
      * 修改拖拽格组
      *
@@ -43,6 +53,15 @@ public interface IDragTableGroupService {
      */
     public int updateDragTableGroup(DragTableGroupVo dragTableGroupVo);
 
+    /**
+     * 修改配置组
+     *
+     * @param dragTableGroupVo 拖拽格组
+     * @return 结果
+     */
+    public int editConfigurationGroup(DragTableGroupVo dragTableGroupVo);
+
+
     /**
      * 批量删除拖拽格组
      *

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

@@ -1,9 +1,11 @@
 package com.ruoyi.business.service;
 
+
 import com.ruoyi.business.entity.CommonEntity;
 import com.ruoyi.business.entity.DragTable;
 import com.ruoyi.business.entity.vo.DragTableGroupVo;
 import com.ruoyi.business.entity.vo.DragTableVo;
+
 import java.util.List;
 
 /**
@@ -65,10 +67,10 @@ public interface IDragTableService
     /**
      * 查询动态表格
      *
-     * @param sqlKey 唯一标识
+     * @param tableKey 唯一标识
      * @return 动态表格
      */
-    CommonEntity dragTableInfo(String sqlKey);
+    CommonEntity dragTableInfo(String tableKey);
 
     /**
      * 新增动态表格

+ 0 - 1
ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableStatisticService.java

@@ -4,7 +4,6 @@ import com.ruoyi.business.entity.CommonEntity;
 import com.ruoyi.business.entity.DragTableStatistic;
 import com.ruoyi.business.entity.vo.DragTableVo;
 
-
 import java.util.List;
 import java.util.Map;
 

+ 2 - 0
ruoyi-business/src/main/java/com/ruoyi/business/service/IDragTableStyleService.java

@@ -1,5 +1,7 @@
 package com.ruoyi.business.service;
 
+
+
 import com.ruoyi.business.entity.DragTableStyle;
 import com.ruoyi.business.entity.vo.DragTableVo;
 

+ 2 - 1
ruoyi-business/src/main/java/com/ruoyi/business/service/ITableSqlService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.business.service;
 
 
+
+
 import com.ruoyi.business.entity.TableSql;
 import java.util.List;
 
@@ -11,7 +13,6 @@ import java.util.List;
  * @date 2023-07-19
  */
 public interface ITableSqlService {
-
     /**
      * 查询table 联合查询sql存储
      *

+ 15 - 7
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/CommonServiceImpl.java

@@ -16,11 +16,13 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.stereotype.Service;
+
 import javax.annotation.Resource;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
+
 import static com.ruoyi.common.utils.StringUtils.*;
 
 
@@ -73,13 +75,13 @@ public class CommonServiceImpl implements ICommonService {
         fields.keySet().forEach(item -> {
             endfields.put(toUnderScoreCase(item), fields.get(item));
         });
-        endfields.put("update_by", SecurityUtils.getUsername());
-        endfields.put("update_by_id", SecurityUtils.getUserId());
         endfields.put("update_time", DateUtils.getTime());
-
+        endfields.put("update_by", SecurityUtils.getUsername());
+        endfields.put("update_by_id", String.valueOf(SecurityUtils.getUserId()));
         return commonMapper.edit(endfields, tableName, conditions);
     }
 
+
     @Override
     public int batchDelete(CommonEntity commonEntity) {
         String tableName = (String) commonEntity.getBasicMap().get("tableName");
@@ -88,7 +90,7 @@ public class CommonServiceImpl implements ICommonService {
     }
 
 
-    public List<CommonEntity> queryTableList2(CommonEntity commonEntity, TableSql tableSql) {
+    public List<CommonEntity> queryGroupTableList(CommonEntity commonEntity, TableSql tableSql) {
            //前端传递过来的参数
            Map<String, Object> queryMap = commonEntity.getQueryMap();
            //是否存在
@@ -96,7 +98,7 @@ public class CommonServiceImpl implements ICommonService {
            //循环前端传过来的参数 跳过 sqlkey
            AtomicReference<String> replaceSql= new AtomicReference<>(tableSql.getTableCondition());
            queryMap.forEach((k,v)->{
-               if(!k.equals("sqlkey")){
+               if(!k.equals("sqlkey")&&!k.equals("queryCriteriaValue")){ //查询第一个表的数据是不会进行任何替换的
                    int isExistIndex = tableSql.getTableCondition().indexOf(k);
                    replaceSql.set(tableSql.getTableCondition().replace(k, v.toString()));
                    if(isExistIndex<0){
@@ -115,6 +117,7 @@ public class CommonServiceImpl implements ICommonService {
                return  commonEntityList;
            }
            Map<String, Object> conditions = JSONObject.parseObject(JSON.toJSONString(commonEntity.getQueryMap()));
+           //正常的查询
            String queryCriteriaValue =
                         conditions.containsKey("queryCriteriaValue") == true
                                 ? conditions.get("queryCriteriaValue").toString() : "";
@@ -126,7 +129,6 @@ public class CommonServiceImpl implements ICommonService {
 
     @Override
     public List<CommonEntity> queryTableList(CommonEntity commonEntity, TableSql tableSql) {
-
         // 根据sqlkey查询得到当前表单对应的sql
         Map<String, Object> conditions = JSONObject.parseObject(JSON.toJSONString(commonEntity.getQueryMap()));
         // 得到查询条件的值
@@ -136,7 +138,6 @@ public class CommonServiceImpl implements ICommonService {
         // 得到需要执行的sql条件语句
         String endSQL = tableSql.getTableCondition().replace("#{val}", queryCriteriaValue);
         return commonMapper.queryTableList(tableSql.getTableSql() + " where " + endSQL);
-
     }
 
     @Override
@@ -236,6 +237,13 @@ public class CommonServiceImpl implements ICommonService {
         return commonMapper.queryTableList(sql);
     }
 
+    @Override
+    public CommonEntity getInfoById(CommonEntity commonEntity) {
+        String tableName = (String) commonEntity.getBasicMap().get("tableName");
+        Map<String, Object> conditions = JSONObject.parseObject(JSON.toJSONString(commonEntity.getConditionMap()));
+        return commonMapper.getInfoById(tableName,conditions);
+    }
+
     public static String extractSubstring(String input, String identifier) {
         int startIndex = input.indexOf(identifier);
         if (startIndex == -1) {

+ 22 - 11
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragFormServiceImpl.java

@@ -1,24 +1,26 @@
 package com.ruoyi.business.service.impl;
 
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.gson.Gson;
 import com.ruoyi.business.entity.DragForm;
 import com.ruoyi.business.entity.DragTableForm;
+import com.ruoyi.business.mapper.CommonMapper;
 import com.ruoyi.business.mapper.DragFormMapper;
 import com.ruoyi.business.mapper.DragTableFormMapper;
 import com.ruoyi.business.service.IDragFormService;
 import com.ruoyi.common.config.RuoYiConfig;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
-
 import javax.annotation.Resource;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.util.List;
+import java.util.Map;
 import java.util.UUID;
 
 /**
@@ -37,6 +39,9 @@ public class DragFormServiceImpl implements IDragFormService {
     @Resource
     private DragTableFormMapper dragTableFormMapper;
 
+    @Resource
+    private CommonMapper commonMapper;
+
     /**
      * 查询动态表单
      *
@@ -75,15 +80,12 @@ public class DragFormServiceImpl implements IDragFormService {
         createForm(fileName, dragForm.getDfHtmlTemplate());
         // 使用租户名 加uuid 定义表单文件名称
         dragForm.setDfFliePath(fileName);
-        dragForm.setCreateTime(DateUtils.getNowDate());
-        dragForm.setCreateById(SecurityUtils.getUserId());
         //校验dtId是否唯一
         if (dragTableFormMapper.selectDtIdCount(dragForm.getDtId()) > 0) {
             return AjaxResult.warn("该表格已绑定表单!");
         }
         //新增表单
         dragFormMapper.insertDragForm(dragForm);
-
         //新增关联表
         DragTableForm dragTableForm = new DragTableForm();
         dragTableForm.setDfId(dragForm.getfId());
@@ -102,8 +104,6 @@ public class DragFormServiceImpl implements IDragFormService {
     public int updateDragForm(DragForm dragForm) {
         // 修改的时候删除表单源文件后重新创建
         delFileForm(dragForm.getfId());
-        dragForm.setUpdateTime(DateUtils.getNowDate());
-        dragForm.setUpdateById(SecurityUtils.getUserId());
         return dragFormMapper.updateDragForm(dragForm);
     }
 
@@ -145,11 +145,22 @@ public class DragFormServiceImpl implements IDragFormService {
     }
 
     @Override
-    public DragForm selectDragFormBySqlKey(String sqlKey) {
-        return dragFormMapper.selectDragFormBySqlKey(sqlKey);
+    public DragForm selectDragFormBySqlKey(String sqlKey) throws JsonProcessingException {
+        DragForm dragForm = dragFormMapper.selectDragFormBySqlKey(sqlKey);
+        ObjectMapper objectMapper = new ObjectMapper();
+        Gson gson = new Gson();
+        //单个下拉框
+        //获取要执行sql
+        Map<String,Object> sqlMap = objectMapper.readValue(dragForm.getDfFormSql(), Map.class);
+        //循环得到每一个sql语句返回结果
+        for(Map.Entry<String, Object> entry : sqlMap.entrySet()){
+            List<Map<String, Object>> mapList = commonMapper.executeSql(entry.getValue().toString());
+            sqlMap.put(entry.getKey(),mapList);
+        }
+        dragForm.setDfFormSql(gson.toJson(sqlMap));
+        return dragForm;
     }
 
-
     /**
      * 删除表单源文件
      *

+ 103 - 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableBtnRelevanceServiceImpl.java

@@ -0,0 +1,103 @@
+package com.ruoyi.business.service.impl;
+
+
+import com.ruoyi.business.entity.DragTableBtnRelevance;
+import com.ruoyi.business.entity.vo.DragTableVo;
+import com.ruoyi.business.mapper.DragTableBtnRelevanceMapper;
+import com.ruoyi.business.service.IDragTableBtnRelevanceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 动态格和动态格按钮关联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
+        if(dragTableVo.getDragTableBtnRelevanceList().size() > 0){
+            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);
+    }
+}

+ 168 - 0
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableBtnServiceImpl.java

@@ -0,0 +1,168 @@
+package com.ruoyi.business.service.impl;
+
+import com.ruoyi.business.entity.DragTableBtn;
+import com.ruoyi.business.mapper.DragTableBtnMapper;
+import com.ruoyi.business.service.IDragTableBtnService;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 格绑定的自定义按钮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 btnKeys 需要删除的格绑定的自定义按钮主键
+     * @return 结果
+     */
+    @Override
+    public int batchDeleteDragTableBtnByBtnKeys(List<String> btnKeys)
+    {
+        return dragTableBtnMapper.batchDeleteDragTableBtnByBtnKeys(btnKeys);
+    }
+
+    /**
+     * 删除格绑定的自定义按钮信息
+     * 
+     * @param id 格绑定的自定义按钮主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDragTableBtnById(Long id)
+    {
+        return dragTableBtnMapper.deleteDragTableBtnById(id);
+    }
+
+    @Override
+    public boolean hasChildByBtnId(Long btnId) {
+        return dragTableBtnMapper.hasChildByBtnId(btnId) > 0;
+    }
+
+    @Override
+    public DragTableBtn selectDragTableBtnByBtnKey(String btnKey) {
+        return dragTableBtnMapper.selectDragTableBtnByBtnKey(btnKey);
+    }
+}

+ 239 - 19
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableGroupServiceImpl.java

@@ -3,20 +3,27 @@ package com.ruoyi.business.service.impl;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
+import com.ruoyi.business.entity.DragTable;
 import com.ruoyi.business.entity.DragTableCondition;
 import com.ruoyi.business.entity.DragTableGroup;
+import com.ruoyi.business.entity.TableSql;
 import com.ruoyi.business.entity.vo.DragTableGroupVo;
 import com.ruoyi.business.entity.vo.DragTableVo;
 import com.ruoyi.business.mapper.DragTableConditionMapper;
 import com.ruoyi.business.mapper.DragTableGroupMapper;
 import com.ruoyi.business.mapper.DragTableMapper;
 import com.ruoyi.business.mapper.TableSqlMapper;
+import com.ruoyi.business.service.IDragTableBtnRelevanceService;
 import com.ruoyi.business.service.IDragTableGroupService;
+import com.ruoyi.common.utils.SecurityUtils;
+
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import java.util.ArrayList;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -45,6 +52,8 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
     @Autowired
     private TableSqlMapper tableSqlMapper;
 
+    @Autowired
+    private IDragTableBtnRelevanceService dragTableBtnRelevanceService;
     /**
      * 查询拖拽格组
      *
@@ -69,6 +78,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         return dragTableGroupMapper.selectDragTableGroupList(dragTableGroup);
     }
 
+
     /**
      * 新增拖拽格组
      *
@@ -84,8 +94,38 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         BeanUtils.copyProperties(dragTableGroupVo,dragTableGroup);
         //添加动态表格列表
         dragTableService.addDragTable(dragTableGroupVo);
+        //默认添加的是联动表格
+        dragTableGroup.setGroupType("0");
         return dragTableGroupMapper.insertDragTableGroup(dragTableGroup);
     }
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int insertDragTableConfigurationGroup(DragTableGroupVo dragTableGroupVo)
+    {
+        //表格组实体类拷贝数据
+        DragTableGroup dragTableGroup=new DragTableGroup();
+        BeanUtils.copyProperties(dragTableGroupVo,dragTableGroup);
+        //添加动态表格列表
+        dragTableService.addDragTable(dragTableGroupVo);
+        dragTableGroup.setGroupType("1");
+        return dragTableGroupMapper.insertDragTableGroup(dragTableGroup);
+    }
+
+
+    // SQL 条件的开始
+    public static final String SQL_START = "CONCAT(";
+
+    // SQL 超级查询常量
+    public static final String SQL_MIDDLE = "IFNULL( #{VAL}, '' )";
+
+    // sqlserver || DM 数据类型的超级查询常量
+    public static final String SQL_DM_SERVER_MIDDLE = "COALESCE( #{VAL}, '' )";
+
+    // SQL 条件的结束
+    public static final String SQL_END = "LIKE '%#{val}%'";
+
     /**
      * 修改拖拽格组
      *
@@ -93,8 +133,8 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
      * @return 结果
      */
     @Override
-    public int updateDragTableGroup(DragTableGroupVo dragTableGroupVo)
-    {
+    @Transactional(rollbackFor = Exception.class)
+    public int updateDragTableGroup(DragTableGroupVo dragTableGroupVo) {
         //根据id查询表格组信息
         DragTableGroup dragTableGroupOne = dragTableGroupMapper.selectDragTableGroupById(dragTableGroupVo.getId());
         //得到group_table_info
@@ -104,22 +144,158 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         //收集tableKey
         List<String> tableKeys = jsonArray.stream().map(item -> JSONObject.parseObject(item.toString()).get("tableKey").toString()
         ).collect(Collectors.toList());
-        //删除表格数据
-        dragTableMapper.deleteDragTableByTableKeys(tableKeys);
         //删除条件数据
         List<Long> dragTableIds = dragTableMapper.selectDragTableTableKeys(tableKeys)
                 .stream().map(item -> item.gettId()).collect(Collectors.toList());
         dragTableConditionMapper.deleteDragTableConditionBytIds(dragTableIds);
         //删除sql数据
-        Long[] dragTableIds1 = dragTableIds.toArray(new Long[0]);
-        tableSqlMapper.deleteTableSqlByTIds(dragTableIds1);
+        //Long[] dragTableIds1 = dragTableIds.toArray(new Long[0]);
+        //tableSqlMapper.deleteTableSqlByTIds(dragTableIds1);
+        //删除表格数据
+        //dragTableMapper.deleteDragTableByTableKeys(tableKeys);
+
+        //优化逻辑 1、表格组信息 2、表格信息、条件信息、sql信息
+        List<DragTableVo> dragTables = dragTableGroupVo.getDragTables();
+        if (dragTables.size()>0) {
+            dragTables.stream().forEach(dragTableVo->{
+                String SQL="";
+                //update drag_table
+                DragTable dragTable = new DragTable();
+                BeanUtils.copyProperties(dragTableVo, dragTable);
+                dragTable.setDtColumnName(dragTableVo.getDtColumnName().toString());
+                dragTable.setPrimaryKey(dragTableVo.getPrimaryKey());
+                dragTable.setMenuId(dragTableVo.getMenuId());
+                dragTable.setDtType("1");
+                dragTableMapper.updateDragTable(dragTable);
+                //update table_sql
+                TableSql tableSql = new TableSql();
+                //拼接sql查询条件
+                switch (SecurityUtils.getDatabaseType().toUpperCase()) {
+                    case "MYSQL":
+                        for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                            SQL += " AND "+dragTableVo.getSearchFieldList().get(i)+"="+dragTableVo.getConditionDefaultValueMap().get(dragTableVo.getSearchFieldList().get(i));
+                        }
+                        break;
+                    case "DM":
+                    case "SQLSERVER":
+                        SQL += SQL_START;
+                        for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                            SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
+                            SQL += dragTableVo.getSearchFieldList().size() - 1 == i ? ",'')" : ",\n";
+                        }
+                        break;
+                    case "ORACLE":
+                        //SQL_START = "";
+                        for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                            SQL += dragTableVo.getSearchFieldList().get(i);
+                            SQL += (dragTableVo.getSearchFieldList().size() - 1 == i ? " " : "||");
+                        }
+                        break;
+                }
+                String where = dragTableVo.getDtTableName() + ".del_flag = '0'";
+                tableSql.setTableCondition(where + SQL);
+                tableSql.setTableAlias(dragTableVo.getDtTableName());
+                tableSql.setOrderByColumn(dragTableVo.getOrderByColumn());
+                tableSql.setSortOrder(dragTableVo.getSortOrder());
+                tableSql.setSqlKey(dragTableVo.getSqlKey());
+                int i = tableSqlMapper.updateTableSqlBySqlKey(tableSql);
+                System.out.println(i);
+                //add drag_table_condition
+                if (dragTableVo.getSearchFieldList().size() > 0) {
+                    List<DragTableCondition> dragTableConditionList = new ArrayList<>();
+                    dragTableVo.getSearchFieldList().forEach(item -> {
+                        dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item,dragTableVo.getConditionDefaultValueMap().get(item).toString()));
+                    });
+                    dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
+                }
+            });
+        }
         //修改表格组列表信息
-        DragTableGroup dragTableGroup=new DragTableGroup();
-        BeanUtils.copyProperties(dragTableGroupVo,dragTableGroup );
-        dragTableGroupMapper.updateDragTableGroup(dragTableGroup);
-        //从新插入数据
-        int insertRow = this.insertDragTableGroup(dragTableGroupVo);
-        return insertRow;
+        DragTableGroup dragTableGroup = new DragTableGroup();
+        BeanUtils.copyProperties(dragTableGroupVo, dragTableGroup);
+        int i = dragTableGroupMapper.updateDragTableGroup(dragTableGroup);
+        return i;
+    }
+
+    @Override
+    public int editConfigurationGroup(DragTableGroupVo dragTableGroupVo) {
+        //根据id查询表格组信息
+        DragTableGroup dragTableGroupOne = dragTableGroupMapper.selectDragTableGroupById(dragTableGroupVo.getId());
+        //得到group_table_info
+        String groupTableInfo = dragTableGroupOne.getGroupTableInfo();
+        //把他转换成Map对象
+        JSONArray jsonArray = JSON.parseArray(groupTableInfo);
+        //收集tableKey
+        List<String> tableKeys = jsonArray.stream().map(item -> JSONObject.parseObject(item.toString()).get("tableKey").toString()
+        ).collect(Collectors.toList());
+        //删除条件数据
+        List<Long> dragTableIds = dragTableMapper.selectDragTableTableKeys(tableKeys)
+                .stream().map(item -> item.gettId()).collect(Collectors.toList());
+        dragTableConditionMapper.deleteDragTableConditionBytIds(dragTableIds);
+        //优化逻辑 1、表格组信息 2、表格信息、条件信息、sql信息
+        List<DragTableVo> dragTables = dragTableGroupVo.getDragTables();
+        if (dragTables.size()>0) {
+            dragTables.stream().forEach(dragTableVo->{
+                String SQL="";
+                //add drag_table
+                DragTable dragTable = new DragTable();
+                BeanUtils.copyProperties(dragTableVo, dragTable);
+                dragTable.setDtColumnName(dragTableVo.getDtColumnName().toString());
+                dragTable.setPrimaryKey(dragTableVo.getPrimaryKey());
+                dragTable.setMenuId(dragTableVo.getMenuId());
+                dragTable.setDtType("1");
+                //add table_sql
+                TableSql tableSql = new TableSql();
+                tableSql.setSqlKey(dragTableVo.getSqlKey());
+                tableSql.setTableSql(dragTableVo.getTableSql());
+                dragTableMapper.updateDragTable(dragTable);
+                //拼接sql查询条件
+                switch (SecurityUtils.getDatabaseType().toUpperCase()) {
+                    case "MYSQL":
+                        for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                            SQL += " AND "+dragTableVo.getSearchFieldList().get(i)+"="+dragTableVo.getConditionDefaultValueMap().get(dragTableVo.getSearchFieldList().get(i));
+                        }
+                        break;
+                    case "DM":
+                    case "SQLSERVER":
+                        SQL += SQL_START;
+                        for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                            SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
+                            SQL += dragTableVo.getSearchFieldList().size() - 1 == i ? ",'')" : ",\n";
+                        }
+                        break;
+                    case "ORACLE":
+                        //SQL_START = "";
+                        for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                            SQL += dragTableVo.getSearchFieldList().get(i);
+                            SQL += (dragTableVo.getSearchFieldList().size() - 1 == i ? " " : "||");
+                        }
+                        break;
+                }
+                String where = dragTableVo.getDtTableName() + ".del_flag = '0'";
+                tableSql.setTableCondition(where + SQL);
+                tableSql.setTableAlias(dragTableVo.getDtTableName());
+                tableSql.setSqlKey(dragTableVo.getSqlKey());
+                tableSql.setOrderByColumn(dragTableVo.getOrderByColumn());
+                tableSql.setSortOrder(dragTableVo.getSortOrder());
+                tableSqlMapper.updateTableSql(tableSql);
+                //add drag_table_condition
+                if (dragTableVo.getSearchFieldList().size() > 0) {
+                    List<DragTableCondition> dragTableConditionList = new ArrayList<>();
+                    dragTableVo.getSearchFieldList().forEach(item -> {
+                        dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item,dragTableVo.getConditionDefaultValueMap().get(item).toString()));
+                    });
+                    dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
+                }
+                //修改按钮信息
+                dragTableBtnRelevanceService.updateDragTableBtnRelevance(dragTableVo);
+            });
+        }
+        //修改表格组列表信息
+        DragTableGroup dragTableGroup = new DragTableGroup();
+        BeanUtils.copyProperties(dragTableGroupVo, dragTableGroup);
+        int i = dragTableGroupMapper.updateDragTableGroup(dragTableGroup);
+        return i;
     }
 
     /**
@@ -129,8 +305,35 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
      * @return 结果
      */
     @Override
+    @Transactional
     public int deleteDragTableGroupByIds(Long[] ids)
     {
+        //表格数据
+        List<String> tableKeys = new ArrayList<>();
+        //删除条件数据
+        List<Long> dragTableIds =new ArrayList<>();
+        for (Long id : ids) {
+            //根据id查询表格组信息
+            DragTableGroup dragTableGroupOne = dragTableGroupMapper.selectDragTableGroupById(id);
+            //得到group_table_info
+            String groupTableInfo = dragTableGroupOne.getGroupTableInfo();
+            //把他转换成Map对象
+            JSONArray jsonArray = JSON.parseArray(groupTableInfo);
+            //收集tableKey
+            jsonArray.stream().forEach(item->
+                    tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
+            //删除条件数据
+            dragTableMapper.selectDragTableTableKeys(tableKeys)
+                    .stream().forEach(item ->dragTableIds.add(item.gettId()));
+        }
+        //删除表格数据
+        dragTableMapper.deleteDragTableByTableKeys(tableKeys);
+        //删除条件数据
+        dragTableConditionMapper.deleteDragTableConditionBytIds(dragTableIds);
+        //删除sql数据
+        Long[] dragTableIds1 = dragTableIds.toArray(new Long[0]);
+        tableSqlMapper.deleteTableSqlByTIds(dragTableIds1);
+        //删除组数据
         return dragTableGroupMapper.deleteDragTableGroupByIds(ids);
     }
 
@@ -154,15 +357,25 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         String groupTableInfo = dragTableGroupOne.getGroupTableInfo();
         //把他转换成Map对象
         JSONArray jsonArray = JSON.parseArray(groupTableInfo);
-        List<String> stringList=new ArrayList<>();
-        //收集下tableKey
-        jsonArray.forEach(e->{
+        //排序确保表格的顺序
+        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();
-            stringList.add(str);
+            DragTable dragTable = dragTableMapper.selectDragTableByTableKey(str);
+            DragTableVo dragTableVo=new DragTableVo();
+            BeanUtils.copyProperties(dragTable, dragTableVo);
+            dragTableList.add( dragTableVo);
         });
-        //根据tableKey批量查询表格数据
-        List<DragTableVo> dragTables = dragTableMapper.selectDragTableTableKeys(stringList).stream().map(item -> {
+        //查询这个动态表格的 1.条件 2.sql信息
+        dragTableList.stream().map(item -> {
             //拿到这个表格的所有条件数据
             List<DragTableCondition> dragTableConditions = dragTableConditionMapper.selectDragTableConditionByTid(item.gettId());
             //条件
@@ -177,11 +390,16 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
                     item.setConditionDefaultValueMap(conditionDefaultValueMap);
                 }
             });
+            //排序字段
+            TableSql tableSql = tableSqlMapper.selectTableSqlByTSqlKey(item.getSqlKey());
+            if(tableSql!=null){
+                item.setOrderByColumn(tableSql.getOrderByColumn());
+            }
             return item;
         }).collect(Collectors.toList());
         DragTableGroupVo dragTableGroupVo=new DragTableGroupVo();
         BeanUtils.copyProperties(dragTableGroupOne, dragTableGroupVo);
-        dragTableGroupVo.setDragTables(dragTables);
+        dragTableGroupVo.setDragTables(dragTableList);
         //查询表格的关联数据
         return    dragTableGroupVo;
     }
@@ -206,4 +424,6 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         }
         return true;
     }
+
+
 }

+ 79 - 28
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableServiceImpl.java

@@ -6,7 +6,6 @@ import com.ruoyi.business.entity.vo.DragTableGroupVo;
 import com.ruoyi.business.entity.vo.DragTableVo;
 import com.ruoyi.business.mapper.*;
 import com.ruoyi.business.service.IDragTableService;
-import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -16,6 +15,7 @@ import org.springframework.transaction.support.TransactionTemplate;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 动态表格Service业务层处理
@@ -46,6 +46,12 @@ public class DragTableServiceImpl implements IDragTableService {
     @Resource
     private DragTableStyleMapper dragTableStyleMapper;
 
+    @Resource
+    private DragTableBtnMapper dragTableBtnMapper;
+
+    @Resource
+    private DragTableBtnRelevanceMapper dragTableBtnRelevanceMapper;
+
     /**
      * 查询动态表格
      *
@@ -76,9 +82,22 @@ public class DragTableServiceImpl implements IDragTableService {
      */
     @Override
     public int insertDragTable(DragTable dragTable) {
+        //dragTable.setCreateTime(DateUtils.getNowDate());
+        //dragTable.setCreateById(SecurityUtils.getUserId());
         return dragTableMapper.insertDragTable(dragTable);
     }
 
+//    /**
+//     * 修改动态表格
+//     *
+//     * @param dragTable 动态表格
+//     * @return 结果
+//     */
+//    @Override
+//    public int updateDragTable(DragTable dragTable) {
+//        dragTable.setUpdateTime(DateUtils.getNowDate());
+//        return dragTableMapper.updateDragTable(dragTable);
+//    }
 
     /**
      * 批量删除动态表格
@@ -130,10 +149,41 @@ public class DragTableServiceImpl implements IDragTableService {
         List<DragTableStyle> dragTableStyleList = dragTableStyleMapper.selectDragTableStyleList(dragTableStyle);
         resultMap.put("style",dragTableStyleList);
         CommonEntity commonEntity = new CommonEntity();
+        // 动态表格按钮信息
+        //根据tableKey获取根节点信息
+        List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(dragTable.getTableKey());
+        //获取根节点数据
+        System.err.println(btnKeys.toString());
+        if(btnKeys.size() > 0){
+            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.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(";
 
@@ -156,14 +206,10 @@ public class DragTableServiceImpl implements IDragTableService {
         dragTable.setDtColumnName(JSON.toJSONString(dragTableVo.getDtColumnName()));
         dragTable.setPrimaryKey(dragTableVo.getPrimaryKey());
         dragTable.setMenuId(dragTableVo.getMenuId());
-        dragTable.setCreateTime(DateUtils.getNowDate());
-        dragTable.setCreateById(SecurityUtils.getUserId());
-        dragTable.setDtType("1");//表格类型
+        dragTable.setDtType("0");//表格类型
         //add table_sql
         TableSql tableSql = new TableSql();
         tableSql.setTableSql(dragTableVo.getTableSql());
-        tableSql.setCreateTime(DateUtils.getNowDate());
-        tableSql.setCreateById(SecurityUtils.getUserId());
         dragTableMapper.insertDragTable(dragTable);
         // 拼接sql查询条件
         switch (SecurityUtils.getDatabaseType().toUpperCase()) {
@@ -202,7 +248,6 @@ public class DragTableServiceImpl implements IDragTableService {
         if (dragTableVo.getSearchFieldList().size() > 0) {
             List<DragTableCondition> dragTableConditionList = new ArrayList<>();
             dragTableVo.getSearchFieldList().forEach(item -> {
-                //dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item,dragTableVo.getConditionDefaultValueMap().get(item).toString()));
                 dragTableConditionList.add(new DragTableCondition(dragTable.gettId(),item));
             });
             dragTableConditionList.forEach(e->{
@@ -215,7 +260,6 @@ public class DragTableServiceImpl implements IDragTableService {
     @Transactional
     @Override
     public void addDragTable(DragTableGroupVo dragTableGroupVo) {
-
         for (DragTableVo dragTableVo : dragTableGroupVo.getDragTables()) {
             String SQL="";
             //add drag_table
@@ -224,19 +268,33 @@ public class DragTableServiceImpl implements IDragTableService {
             dragTable.setDtColumnName(JSON.toJSONString(dragTableVo.getDtColumnName()));
             dragTable.setPrimaryKey(dragTableVo.getPrimaryKey());
             dragTable.setMenuId(dragTableVo.getMenuId());
-            dragTable.setCreateTime(DateUtils.getNowDate());
-            dragTable.setCreateById(SecurityUtils.getUserId());
+            dragTable.setDtType("1");
             //add table_sql
             TableSql tableSql = new TableSql();
             tableSql.setTableSql(dragTableVo.getTableSql());
-            tableSql.setCreateTime(DateUtils.getNowDate());
-            tableSql.setCreateById(SecurityUtils.getUserId());
             dragTableMapper.insertDragTable(dragTable);
             //拼接sql查询条件
-            for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
-                //市:省  ${   }
-                //条件 市   {市:${省份字段}
-                SQL += " AND "+dragTableVo.getSearchFieldList().get(i)+"="+dragTableVo.getConditionDefaultValueMap().get(dragTableVo.getSearchFieldList().get(i));
+            switch (SecurityUtils.getDatabaseType().toUpperCase()) {
+                case "MYSQL":
+                    for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                            SQL += " AND "+dragTableVo.getSearchFieldList().get(i)+"="+dragTableVo.getConditionDefaultValueMap().get(dragTableVo.getSearchFieldList().get(i));
+                    }
+                    break;
+                case "DM":
+                case "SQLSERVER":
+                    SQL += SQL_START;
+                    for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                        SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
+                        SQL += dragTableVo.getSearchFieldList().size() - 1 == i ? ",'')" : ",\n";
+                    }
+                    break;
+                case "ORACLE":
+                    //SQL_START = "";
+                    for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                        SQL += dragTableVo.getSearchFieldList().get(i);
+                        SQL += (dragTableVo.getSearchFieldList().size() - 1 == i ? " " : "||");
+                    }
+                    break;
             }
             String where = dragTableVo.getDtTableName() + ".del_flag = '0'";
             tableSql.setTableCondition(where + SQL);
@@ -252,10 +310,6 @@ public class DragTableServiceImpl implements IDragTableService {
                     dragTableVo.getSearchFieldList().forEach(item -> {
                         dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item,dragTableVo.getConditionDefaultValueMap().get(item).toString()));
                     });
-                    //赋值创建人
-                    dragTableConditionList.forEach(e->{
-                        e.setCreateById(SecurityUtils.getUserId());
-                    });
                     dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
             }
         }
@@ -274,6 +328,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;
     }
 
@@ -285,14 +343,10 @@ public class DragTableServiceImpl implements IDragTableService {
         DragTable dragTable = new DragTable();
         BeanUtils.copyProperties(dragTableVo, dragTable);
         dragTable.setDtColumnName(JSON.toJSONString(dragTableVo.getDtColumnName()));
-        dragTable.setUpdateById(SecurityUtils.getUserId());
         dragTableMapper.updateDragTable(dragTable);
-
         //update table_sql
         TableSql tableSql = new TableSql();
         tableSql.setTableSql(dragTableVo.getTableSql());
-        //tableSql.setUpdateBy(dragTableVo.getTableSql());
-        tableSql.setUpdateById(SecurityUtils.getUserId());
         // 拼接sql查询条件
         switch (SecurityUtils.getDatabaseType().toUpperCase()) {
             case "MYSQL":
@@ -333,10 +387,7 @@ public class DragTableServiceImpl implements IDragTableService {
             //insert
             List<DragTableCondition> dragTableConditionList = new ArrayList<>();
             dragTableVo.getSearchFieldList().forEach(item -> {
-                dragTableConditionList.add(new DragTableCondition(dragTableVo.gettId(), item, dragTableVo.getConditionDefaultValueMap().get(item).toString()));
-            });
-            dragTableConditionList.forEach(e->{
-                e.setUpdateById(SecurityUtils.getUserId());
+                dragTableConditionList.add(new DragTableCondition(dragTable.gettId(),item));
             });
             dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
         }

+ 15 - 13
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableStatisticServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
+
 import javax.annotation.Resource;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -138,17 +139,19 @@ public class DragTableStatisticServiceImpl implements IDragTableStatisticService
         LinkedList<DragTableStatistic> editList = new LinkedList<>();
         List<Long> numList = new ArrayList<>();
         vo.getDragTableStatisticList().stream().forEach(s -> {
-            if(s.getId() == null){
-                s.setCreateBy(SecurityUtils.getUserId().toString());
-                s.setCreateTime(DateUtils.getNowDate());
-                addList.add(s);
-            }else {
-                s.setUpdateBy(SecurityUtils.getUserId().toString());
-                s.setUpdateTime(DateUtils.getNowDate());
-                editList.add(s);
-            }
-            numList.add(s.getId());
-        });
+               if(s.getId() == null){
+                   s.setCreateById(SecurityUtils.getUserId());
+                   s.setCreateBy(SecurityUtils.getUsername());
+                   s.setCreateTime(DateUtils.getNowDate());
+                   addList.add(s);
+               }else {
+                   s.setUpdateById(SecurityUtils.getUserId());
+                   s.setUpdateBy(SecurityUtils.getUsername());
+                   s.setUpdateTime(DateUtils.getNowDate());
+                   editList.add(s);
+               }
+               numList.add(s.getId());
+           });
         //select Statistic ids
         List<Long> allIds = dragTableStatisticMapper.selectIdsByTableKey(vo.getTableKey());
         allIds.removeAll(numList);
@@ -162,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());

+ 2 - 7
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/DragTableStyleServiceImpl.java

@@ -58,12 +58,7 @@ public class DragTableStyleServiceImpl implements IDragTableStyleService
     @Override
     public int batchInsertDragTableStyle(DragTableVo vo)
     {
-        vo.getDragTableStyleList().forEach(v -> {
-            v.setTableKey(vo.getTableKey());
-            v.setCreateById(SecurityUtils.getUserId());
-            v.setCreateBy(SecurityUtils.getUsername());
-            v.setCreateTime(DateUtils.getNowDate());
-        });
+        vo.getDragTableStyleList().forEach(v -> {v.setTableKey(vo.getTableKey());});
         return dragTableStyleMapper.batchInsertDragTableStyle(vo.getDragTableStyleList());
     }
 
@@ -106,7 +101,7 @@ public class DragTableStyleServiceImpl implements IDragTableStyleService
             dragTableStyleMapper.batchInsertDragTableStyle(addList);
         }
         if(editList.size() >0){
-            dragTableStyleMapper.batchUpdateDragTableStyle(editList);
+            editList.stream().forEach(e -> dragTableStyleMapper.updateDragTableStyle(e));
         }
     }
 

+ 1 - 5
ruoyi-business/src/main/java/com/ruoyi/business/service/impl/TableSqlServiceImpl.java

@@ -12,6 +12,7 @@ import java.util.List;
 
 /**
  * table 联合查询sql存储Service业务层处理
+ *
  * @author ruoyi
  * @date 2023-07-19
  */
@@ -32,11 +33,6 @@ public class TableSqlServiceImpl implements ITableSqlService {
         return tableSqlMapper.selectTableSqlByTId(tId);
     }
 
-    /**
-     * 根据SqlKey查询表的TableSql对象
-     * @param SQLKEY 绑定table唯一标识
-     * @return
-     */
     @Override
     public TableSql selectTableSqlByTSqlKey(String SQLKEY) {
         return tableSqlMapper.selectTableSqlByTSqlKey(SQLKEY);

+ 15 - 0
ruoyi-business/src/main/resources/mapper/common/CommonMapper.xml

@@ -80,4 +80,19 @@
         select dict_value as fieldKey,dict_label as fieldName from {DBNAME}.sys_dict_data where dict_type = #{dictType} and status = '0'
     </select>
 
+    <select id="getInfoById" resultMap="retMap">
+        select * from {DBNAME}.${tableName}
+        <where>
+            <if test="conditions != null">
+                <foreach collection="conditions" item="value" index="key" separator="and">
+                    ${key} = #{value}
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <select id="executeSql" resultType="map">
+        ${sql}
+    </select>
+
 </mapper>

+ 1 - 7
ruoyi-business/src/main/resources/mapper/dragmapper/DragFormMapper.xml

@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectDragFormVo">
-        select f_id,sql_key, df_name, df_nickname, df_vue_template, df_html_template, df_form_sql, df_node_id, df_database, df_table_name, df_flie_path, df_notes, del_flag, create_time, create_by, update_by, update_time, spare, spare1 from  {DBNAME}.drag_form
+        select f_id,sql_key, df_name, df_nickname, df_vue_template, df_html_template, df_form_sql, df_node_id, df_database, df_table_name, df_flie_path, df_notes, del_flag, create_time, create_by, update_by, update_time, spare, spare1 from {DBNAME}.drag_form
     </sql>
 
     <select id="selectDragFormList" parameterType="com.ruoyi.business.entity.DragForm" resultMap="DragFormResult">
@@ -98,8 +98,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time,</if>
             <if test="createById != null">create_by_id,</if>
             <if test="createBy != null">create_by,</if>
-            <if test="updateBy != null">update_by,</if>
-            <if test="updateTime != null">update_time,</if>
             <if test="spare != null">spare,</if>
             <if test="spare1 != null">spare1,</if>
          </trim>
@@ -119,8 +117,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">#{createTime},</if>
             <if test="createById != null">#{createById},</if>
             <if test="createBy != null">#{createBy},</if>
-            <if test="updateBy != null">#{updateBy},</if>
-            <if test="updateTime != null">#{updateTime},</if>
             <if test="spare != null">#{spare},</if>
             <if test="spare1 != null">#{spare1},</if>
          </trim>
@@ -141,8 +137,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dfFliePath != null">df_flie_path = #{dfFliePath},</if>
             <if test="dfNotes != null">df_notes = #{dfNotes},</if>
             <if test="delFlag != null">del_flag = #{delFlag},</if>
-            <if test="createTime != null">create_time = #{createTime},</if>
-            <if test="createBy != null">create_by = #{createBy},</if>
             <if test="updateById != null">update_by_id = #{updateById},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>

+ 174 - 0
ruoyi-business/src/main/resources/mapper/dragmapper/DragTableBtnMapper.xml

@@ -0,0 +1,174 @@
+<?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.business.mapper.DragTableBtnMapper">
+    
+    <resultMap type="com.ruoyi.business.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 {DBNAME}.drag_table_btn
+    </sql>
+
+    <select id="selectDragTableBtnList" parameterType="com.ruoyi.business.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.business.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.business.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="batchDeleteDragTableBtnByBtnKeys" parameterType="String">
+        update drag_table_btn set del_flag = '2' where btn_key in
+        <foreach item="btnKey" collection="list" open="(" separator="," close=")">
+            #{btnKey}
+        </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} and del_flag = '0'
+    </select>
+
+    <select id="selectDragTableBtnByBtnKey" parameterType="String" resultMap="DragTableBtnResult">
+        <include refid="selectDragTableBtnVo"/>
+        where btn_key = #{btnKey}
+    </select>
+
+</mapper>

+ 60 - 0
ruoyi-business/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.business.mapper.DragTableBtnRelevanceMapper">
+    
+    <resultMap type="com.ruoyi.business.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.business.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.business.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.business.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 {DBNAME}.drag_table_btn_relevance where table_key = #{tableKey}
+    </select>
+</mapper>

+ 2 - 2
ruoyi-business/src/main/resources/mapper/dragmapper/DragTableConditionMapper.xml

@@ -64,10 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <insert id="insertDragTableConditionByList"  parameterType="java.util.List">
         insert into drag_table_condition
-        (t_id,condition_field,create_by_id,condition_default_value)
+        (t_id,condition_field,create_by,create_by_id,create_time,condition_default_value)
         values
         <foreach collection="list" item="item" index="index" separator=",">
-            (#{item.tId},#{item.conditionField},#{item.createById},#{item.conditionDefaultValue})
+            (#{item.tId},#{item.conditionField},#{item.createBy},#{item.createById},#{item.createTime},#{item.conditionDefaultValue})
         </foreach>
     </insert>
 

+ 1 - 3
ruoyi-business/src/main/resources/mapper/dragmapper/DragTableFormMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.ruoyi.system.mapper.DragTableFormMapper">
+<mapper namespace="com.ruoyi.business.mapper.DragTableFormMapper">
     
     <resultMap type="com.ruoyi.business.entity.DragTableForm" id="DragTableFormResult">
         <result property="id" column="id"/>
@@ -28,6 +28,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         delete from drag_table_form where df_id = #{dfId}
     </delete>
 
-
-
 </mapper>

+ 8 - 0
ruoyi-business/src/main/resources/mapper/dragmapper/DragTableGroupMapper.xml

@@ -28,6 +28,7 @@
             <if test="groupName != null  and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
             <if test="groupDescription != null  and groupDescription != ''"> and group_description = #{groupDescription}</if>
             <if test="groupTableInfo != null  and groupTableInfo != ''"> and group_table_info = #{groupTableInfo}</if>
+            <if test="groupType !=null  and groupType!=''">and group_type = #{groupType}</if>
             <if test="createById != null   and createById != ''" > and create_by_id = #{createById}</if>
             <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
             <if test="updateById != null  and updateById != ''"> and update_by_id = #{updateById}</if>
@@ -53,6 +54,11 @@
         </foreach>
     </select>
 
+    <select id="selectDragTableGroupOneByGroupKey" resultType="com.ruoyi.business.entity.DragTableGroup" parameterType="string">
+        <include refid="selectDragTableGroupVo"/>
+        where  group_key=#{groupKey}
+    </select>
+
 
     <insert id="insertDragTableGroup" parameterType="com.ruoyi.business.entity.DragTableGroup">
         insert into drag_table_group
@@ -60,6 +66,7 @@
             <if test="id != null">id,</if>
             <if test="groupName != null">group_name,</if>
             <if test="groupKey!=null">group_key,</if>
+            <if test="groupType!=null">group_type,</if>
             <if test="groupDescription != null">group_description,</if>
             <if test="groupTableInfo != null">group_table_info,</if>
             <if test="createById != null">create_by_id,</if>
@@ -73,6 +80,7 @@
             <if test="id != null">#{id},</if>
             <if test="groupName != null">#{groupName},</if>
             <if test="groupKey != null">#{groupKey},</if>
+            <if test="groupType != null">#{groupType},</if>
             <if test="groupDescription != null">#{groupDescription},</if>
             <if test="groupTableInfo != null">#{groupTableInfo},</if>
             <if test="createById != null">#{createById},</if>

+ 4 - 1
ruoyi-business/src/main/resources/mapper/dragmapper/DragTableMapper.xml

@@ -66,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
             <if test="spare != null  and spare != ''">and spare = #{spare}</if>
             <if test="spare1 != null  and spare1 != ''">and spare1 = #{spare1}</if>
+            <if test="dtType !=null and  dtType!=''">and dt_type=#{dtType}</if>
         </where>
         ORDER BY t_id DESC
     </select>
@@ -126,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dtNickname != null">dt_nickname = #{dtNickname},</if>
             <if test="tableKey != null">table_key = #{tableKey},</if>
             <if test="sqlKey != null">sql_key = #{sqlKey},</if>
+            <if test="dtType != null">dt_type = #{dtType},</if>
             <if test="dtTableName != null">dt_table_name = #{dtTableName},</if>
             <if test="dtNotes != null">dt_notes = #{dtNotes},</if>
             <if test="dtColumnName != null">dt_column_name = #{dtColumnName},</if>
@@ -137,6 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="createById != null">create_by_id = #{createById},</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="isSelection != null">is_selection = #{isSelection},</if>
             <if test="echoData != null">echo_data = #{echoData},</if>
@@ -173,7 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         SELECT
             dt.*,
             ts.table_sql,
-            ts.table_export_field FROM {DBNAME}.drag_table dt
+            ts.table_export_field FROM drag_table dt
                 LEFT JOIN table_sql ts ON dt.sql_key = ts.sql_key
         WHERE
             dt.t_id = #{tId}

+ 14 - 16
ruoyi-business/src/main/resources/mapper/dragmapper/DragTableStatisticMapper.xml

@@ -21,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectDragTableStatisticVo">
-        select id, statistic_title, table_key, statistic_description, statistic_type, statistic_field, statistic_object, sql_key, del_flag, create_by, create_time, update_by, update_time from  {DBNAME}.drag_table_statistic
+        select id, statistic_title, table_key, statistic_description, statistic_type, statistic_field, statistic_object, sql_key, del_flag, create_by, create_time, update_by, update_time from {DBNAME}.drag_table_statistic
     </sql>
 
     <select id="selectDragTableStatisticList" parameterType="com.ruoyi.business.entity.DragTableStatistic" resultMap="DragTableStatisticResult">
@@ -42,30 +42,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         
     <insert id="batchInsertDragTableStatistic" useGeneratedKeys="true" keyProperty="id">
         insert into drag_table_statistic
-            (statistic_title,table_key,statistic_description,statistic_type,statistic_field,statistic_object,sql_key,create_by,create_time,del_flag)
+            (statistic_title,table_key,statistic_description,statistic_type,statistic_field,statistic_object,sql_key,create_by_id,create_by,create_time,del_flag)
             values
         <foreach collection="list" item="item" index="index" separator=",">
             (#{item.statisticTitle},#{item.tableKey},#{item.statisticDescription},#{item.statisticType},#{item.statisticField},#{item.statisticObject},
-             #{item.sqlKey},#{item.createBy},#{item.createTime},'0')
+             #{item.sqlKey},#{item.createById},#{item.createBy},#{item.createTime},'0')
         </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">

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

@@ -60,25 +60,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </foreach>
     </insert>
 
-    <update id="batchUpdateDragTableStyle" parameterType="com.ruoyi.business.entity.DragTableStyle">
-        <foreach collection="list" item="item" separator=";">
+    <update id="updateDragTableStyle" parameterType="com.ruoyi.business.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">

+ 6 - 0
ruoyi-common/pom.xml

@@ -154,6 +154,12 @@
             <version>3.3.2</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
 </project>

+ 41 - 0
ruoyi-common/src/main/java/com/ruoyi/common/constant/ButtonTypeConstants.java

@@ -0,0 +1,41 @@
+package com.ruoyi.common.constant;
+
+/**
+ * 按钮类型
+ */
+public class ButtonTypeConstants {
+
+    /** 操作按钮 */
+    public static final Long HANDLE = 0L;
+
+    /** 其他按钮 */
+    public static final Long OTHER = 1L;
+
+    /** 表单按钮 */
+    public static final Long FORM = 2L;
+
+    /** 内链按钮 */
+    public static final Long INNER_CHAIN = 3L;
+
+    /** 流程按钮 */
+    public static final Long PROCESS = 4L;
+
+    /** 脚本按钮 */
+    public static final Long SCRIPT = 5L;
+
+    /** 目录 */
+    public static final Long CATALOGUE = 6L;
+
+    /** 外链按钮 */
+    public static final Long OUTSIDE_CHAIN = 7L;
+
+    /** 修改按钮 */
+    public static final Long UPDATE = 8L;
+
+    /** 删除按钮 */
+    public static final Long DELETE = 9L;
+
+    /** 新增按钮 */
+    public static final Long INSERT = 10L;
+
+}

+ 6 - 0
ruoyi-framework/pom.xml

@@ -62,6 +62,12 @@
             <artifactId>easyexcel</artifactId>
             <version>3.3.2</version>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+            <scope>compile</scope>
+        </dependency>
     </dependencies>
 
 </project>

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SqlInterceptor.java

@@ -26,6 +26,7 @@ public class SqlInterceptor implements Interceptor {
     @Override
     public Object intercept(Invocation invocation) throws Throwable, TenantDataSource {
         StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
+        String s = MyThreadLocal.get();
         /**
          * //String handlerClassName = statementHandler.getClass().getName();
          * //String s = MyThreadLocal.get();

+ 6 - 0
ruoyi-system/pom.xml

@@ -28,6 +28,12 @@
             <version>3.3.2</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+            <scope>compile</scope>
+        </dependency>
 
     </dependencies>
 

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/SysMenuMapper.xml

@@ -77,6 +77,8 @@
 		from sys_menu m
 		left join sys_tenant_menu tm on tm.menu_id = m.menu_id
 		where tm.tenant_id = #{tenantId}
+		and m.menu_name not in ('数据引擎','流程引擎','表单引擎')
+		and parent_id not in (select menu_id from  sys_menu where menu_name in ("数据引擎","流程引擎","表单引擎"))
 		order by parent_id, order_num
 	</select>
 	
@@ -93,6 +95,7 @@
 		left join sys_menu m on tm.menu_id = m.menu_id
 		where m.menu_type in ('M', 'C') and m.status = 0 and tm.tenant_id = #{tenantId}
 		and m.menu_name not in ('数据引擎','流程引擎','表单引擎')
+		and parent_id not in (select menu_id from  sys_menu where menu_name in ("数据引擎","流程引擎","表单引擎"))
 		order by m.parent_id, m.order_num
 	</select>
 	

+ 45 - 0
ruoyi-ui/src/api/bpmprocess/run/executeMiddle.js

@@ -0,0 +1,45 @@
+import request from '@/utils/request'
+
+// 查询执行流程用户、节点关联脚本中间表列表
+export function listMiddle(query) {
+  return request({
+    url: '/system/middle/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询执行流程用户、节点关联脚本中间表详细
+export function getMiddle(id) {
+  return request({
+    url: '/system/middle/' + id,
+    method: 'get'
+  })
+}
+
+// 新增执行流程用户、节点关联脚本中间表
+export function addMiddle(data) {
+  return request({
+    url: '/system/middle',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改执行流程用户、节点关联脚本中间表
+export function updateMiddle(data) {
+  return request({
+    url: '/system/middle',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除执行流程用户、节点关联脚本中间表
+export function delMiddle(id) {
+  return request({
+    url: '/system/middle/' + id,
+    method: 'delete'
+  })
+}
+

+ 44 - 0
ruoyi-ui/src/api/bpmprocess/run/executeNode.js

@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 查询节点执行表(记录表)列表
+export function listNode(query) {
+  return request({
+    url: '/system/node/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询节点执行表(记录表)详细
+export function getNode(id) {
+  return request({
+    url: '/system/node/' + id,
+    method: 'get'
+  })
+}
+
+// 新增节点执行表(记录表)
+export function addNode(data) {
+  return request({
+    url: '/system/node',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改节点执行表(记录表)
+export function updateNode(data) {
+  return request({
+    url: '/system/node',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除节点执行表(记录表)
+export function delNode(id) {
+  return request({
+    url: '/system/node/' + id,
+    method: 'delete'
+  })
+}

+ 64 - 0
ruoyi-ui/src/api/bpmprocess/run/executeProcess.js

@@ -0,0 +1,64 @@
+import request from '@/utils/request'
+
+// 查询流程执行任务表列表
+export function listProcess(query) {
+  return request({
+    url: '/system/process/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询流程执行任务表详细
+export function getProcess(id) {
+  return request({
+    url: '/system/process/' + id,
+    method: 'get'
+  })
+}
+
+// 新增流程执行任务表
+export function addProcess(data) {
+  return request({
+    url: '/system/process',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改流程执行任务表
+export function updateProcess(data) {
+  return request({
+    url: '/system/process',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除流程执行任务表
+export function delProcess(id) {
+  return request({
+    url: '/system/process/' + id,
+    method: 'delete'
+  })
+}
+
+// 执行管道列表数据
+export function processList(query) {
+  return request({
+    url: '/system/execute/process/list',
+    method: 'get',
+    params: query,
+    baseURL: process.env.VUE_APP_BASE_API4,
+  })
+}
+
+// 运行节点
+export function runProcessNodeExecution(data) {
+  return request({
+    url: '/system/runbpm/process/processNodeExecution',
+    method: 'post',
+    data: data,
+    baseURL: process.env.VUE_APP_BASE_API4
+  })
+}

+ 8 - 8
ruoyi-ui/src/api/tablelist/commonTable.js

@@ -17,7 +17,7 @@ export function unionListTableData(query) {
     url: '/dragform/common/getTableList',
     method: 'get',
     params: query,
-    baseURL: process.env.VUE_APP_BASE_API3
+    baseURL: process.env.VUE_APP_BASE_API1
   })
 }
 
@@ -27,7 +27,7 @@ export function dragTableInfo(query) {
     url: '/dragform/common/dragTableInfo',
     method: 'get',
     params: query,
-    baseURL: process.env.VUE_APP_BASE_API3
+    baseURL: process.env.VUE_APP_BASE_API1
   })
 }
 
@@ -38,7 +38,7 @@ export function addTableData(data) {
     url: '/dragform/common/batchInsert',
     method: 'post',
     data: data,
-    baseURL: process.env.VUE_APP_BASE_API3
+    baseURL: process.env.VUE_APP_BASE_API1
   })
 }
 
@@ -48,7 +48,7 @@ export function batchEdit(data) {
     url: '/dragform/common/batchEdit',
     method: 'put',
     data: data,
-    baseURL: process.env.VUE_APP_BASE_API3
+    baseURL: process.env.VUE_APP_BASE_API1
   })
 }
 
@@ -68,7 +68,7 @@ export function delTableData(data) {
     url: '/dragform/common/batchDelete',
     method: 'delete',
     data: data,
-    baseURL: process.env.VUE_APP_BASE_API3
+    baseURL: process.env.VUE_APP_BASE_API1
   })
 }
 
@@ -125,7 +125,7 @@ export function getInfoBySqlKey(sqlKey) {
   return request({
     url: '/dragform/form/getInfoBySqlKey/' + sqlKey,
     method: 'get',
-    baseURL: process.env.VUE_APP_BASE_API3
+    baseURL: process.env.VUE_APP_BASE_API1
   })
 }
 
@@ -204,6 +204,6 @@ export function getStatisticList(query) {
     url: '/system/statistic/getStatisticList',
     method: 'get',
     params: query,
-    baseURL: process.env.VUE_APP_BASE_API3
+    baseURL: process.env.VUE_APP_BASE_API1
   })
-}
+}

+ 51 - 10
ruoyi-ui/src/views/bussiness/components/TaskItem.vue

@@ -1,20 +1,28 @@
 <template>
-  <div class="task-item-wrap">
+  <div
+    :class="{
+      'task-item-wrap': true,
+      'done-bg': cardData.isDone,
+      'now-border': cardData.isNow,
+    }"
+  >
     <div class="task-title">
-      <span>{{ itemData.index }}.</span>
-      <span>工艺校验</span>
+      <span class="mr5">{{ number }}.</span>
+      <span>{{ cardData.nodeInfo.name }}</span>
     </div>
     <div class="msg-list">
       <div class="msg-item">
-        <i class="el-icon-user-solid icon"></i>
-        <span>admin</span>
+        <i class="el-icon-s-tools icon"></i>
+        <span>{{ cardData.nodeInfo.name || "未命名节点" }}</span>
       </div>
       <div class="msg-item">
         <i class="el-icon-s-help icon"></i>
-        <span>任务类</span>
+        <span>{{ cardData.nodeInfo.localName || "未知类型" }}</span>
       </div>
       <div class="msg-item">
-        <i class="el-icon-success icon"></i>
+        <i v-if="cardData.isNow" class="el-icon-loading icon"></i>
+        <i v-else-if="cardData.isDone" class="el-icon-success icon"></i>
+        <i v-else class="el-icon-more icon"></i>
         <!-- <span>admin</span> -->
       </div>
     </div>
@@ -27,19 +35,46 @@ export default {
   props: ["itemData", "index"],
   components: {},
   data() {
-    return {};
+    return {
+      cardData: {},
+      number: "",
+    };
+  },
+  watch: {
+    myItemData: {
+      handler(nval) {
+        this.cardData = nval;
+      },
+      deep: true,
+      immediate: true,
+    },
+    myIndex: {
+      handler(nval) {
+        this.number = nval;
+      },
+      deep: true,
+      immediate: true,
+    },
+  },
+  computed: {
+    myItemData() {
+      return this.itemData;
+    },
+    myIndex() {
+      return this.index;
+    },
   },
-  computed: {},
   methods: {},
 };
 </script>
 
 <style scoped lang="scss">
 .task-item-wrap {
-  background-color: #cdf1e5 !important;
   padding: 12px 16px;
+  height: 130px;
   flex: 1;
   box-sizing: border-box;
+  background-color: #ebe6e6;
   // margin-right: 15px;
   .task-title {
     font-size: 14px;
@@ -58,4 +93,10 @@ export default {
     }
   }
 }
+.done-bg {
+  background-color: #cdf1e5 !important;
+}
+.now-border {
+  border: 5px solid rgb(167, 238, 171) !important;
+}
 </style>

+ 28 - 12
ruoyi-ui/src/views/bussiness/components/taskList.vue

@@ -3,23 +3,26 @@
     <div class="title-list">
       <div class="title-item">
         <span class="title-label">任务号:</span>
-        <span class="title-content">47AS04-51-1299_002</span>
+        <span class="title-content">{{ baseInfo.benTaskProcessKey }}</span>
       </div>
-      <div class="title-item">
+      <!-- <div class="title-item">
         <span class="title-label">图号:</span>
         <span class="title-content">1CG312-99</span>
-      </div>
+      </div> -->
       <div class="title-item">
         <span class="title-label">任务名称:</span>
-        <span class="title-content">支架</span>
+        <span class="title-content">{{ baseInfo.bepTaskName }}</span>
       </div>
-      <div class="title-item">
+      <!-- <div class="title-item">
         <span class="title-label">数量:</span>
         <span class="title-content">3</span>
-      </div>
+      </div> -->
       <div class="title-item">
-        <span class="title-label">完成时间:</span>
-        <span class="title-content">2023年11月1日</span>
+        <!-- <span class="title-label">完成时间:</span> -->
+        <span class="title-label">开始时间:</span>
+        <span class="title-content">{{
+          baseInfo.benCreateTime.replace("T", " ")
+        }}</span>
       </div>
     </div>
     <div class="card-list-wrap">
@@ -30,7 +33,7 @@
         <TaskItem
           class="card-item"
           v-for="(item, index) of tempList"
-          :key="item.taskKey"
+          :key="item.nodeId"
           :itemData="item"
           :index="index + 1"
         ></TaskItem>
@@ -48,10 +51,11 @@ import TaskItem from "./TaskItem.vue";
 import { start } from "nprogress";
 export default {
   name: "TaskList",
-  props: [],
+  props: ["cardData"],
   components: { TaskItem },
   data() {
     return {
+      baseInfo: {},
       start: 0,
       end: 5,
       taskItemList: [
@@ -140,13 +144,25 @@ export default {
   },
   computed: {
     tempList() {
-      return this.taskItemList.slice(this.start, this.end);
+      return this.baseInfo?.cardList.slice(this.start, this.end);
+    },
+    myCardData() {
+      return this.cardData;
+    },
+  },
+  watch: {
+    myCardData: {
+      handler(nval) {
+        this.baseInfo = nval;
+      },
+      deep: true,
+      immediate: true,
     },
   },
   methods: {
     prevOrNext(flag) {
       if (flag == 1) {
-        if (this.end >= this.taskItemList.length) return;
+        if (this.end >= this.baseInfo?.cardList.length) return;
         this.start++;
         this.end++;
       } else {

+ 74 - 0
ruoyi-ui/src/views/bussiness/dialogCompments/GY1.vue

@@ -0,0 +1,74 @@
+<template>
+  <div class="form-wrap">
+    <el-form
+      :model="form"
+      ref="form"
+      :rules="rules"
+      label-width="100px"
+      :inline="false"
+      size="normal"
+    >
+      <el-form-item prop="name" label="姓名:">
+        <el-input v-model="form.name"></el-input>
+      </el-form-item>
+      <el-form-item prop="number" label="运行数量:">
+        <el-input v-model="form.number"></el-input>
+      </el-form-item>
+      <el-form-item prop="remark" label="备注信息:">
+        <el-input v-model="form.remark"></el-input>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "GY1",
+  props: [],
+  components: {},
+  data() {
+    return {
+      form: {
+        name: "",
+        number: "",
+        remark: "",
+      },
+      rules: {
+        name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
+        number: [
+          { required: true, message: "请输入运行数量", trigger: "blur" },
+        ],
+        remark: [
+          { required: true, message: "请输入备注信息", trigger: "blur" },
+        ],
+      },
+    };
+  },
+  computed: {},
+  methods: {
+    async getFormData() {
+      let formData = {
+        flag: false,
+        msg: "",
+      };
+      try {
+        let valid = await this.$refs.form.validate();
+        if (valid) {
+          formData.flag = true;
+          formData.data = this.form;
+          return formData;
+        } else {
+          formData.msg = "表单校验异常,请规范填写表单数据";
+          return formData;
+        }
+      } catch (error) {
+        // console.log(error);
+        formData.msg = "表单校验异常,请规范填写表单数据";
+        return formData;
+      }
+    },
+  },
+};
+</script>
+
+<style scoped></style>

+ 276 - 4
ruoyi-ui/src/views/bussiness/processMange.vue

@@ -47,30 +47,291 @@
           </div>
           <div class="search-input">
             <el-input placeholder="请输入..." v-model="queryString">
-              <el-button slot="append" icon="el-icon-search"></el-button>
+              <el-button
+                slot="append"
+                icon="el-icon-search"
+                @click="getList"
+              ></el-button>
             </el-input>
           </div>
         </div>
       </div>
-      <div class="show-body"></div>
+      <div class="show-body">
+        <!--    流程任务列表    -->
+        <el-table :data="tableData" border stripe>
+          <el-table-column type="selection" width="55" align="center" />
+          <el-table-column type="index" width="50" align="center" />
+          <el-table-column
+            v-for="col in columns"
+            :prop="col.prop"
+            :key="col.prop"
+            :label="col.label"
+            align="center"
+          >
+            <template slot-scope="scope">
+              <span v-if="col.prop == 'benCreateTime'">{{
+                scope.row.benCreateTime.replace("T", " ")
+              }}</span>
+              <span v-else-if="col.prop == 'bepTaskProcessType'">{{
+                getDictLabel(scope.row.bepTaskProcessType, dict.type.bpm_type)
+              }}</span>
+              <span v-else-if="col.prop == 'benTaskNodeState'">{{
+                scope.row.benTaskNodeState == "0" ? "已执行" : "未执行"
+              }}</span>
+              <span v-else>{{ scope.row[col.prop] }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" align="center">
+            <template slot-scope="scope">
+              <div class="excute-wrap">
+                <el-button
+                  type="warning"
+                  plain
+                  size="small"
+                  class="mr10 mb5"
+                  @click="opneExecuteNode(scope.row)"
+                >
+                  运行
+                </el-button>
+                <el-dropdown>
+                  <el-button type="warning" plain size="small">
+                    处理<i class="el-icon-arrow-down el-icon--right"></i>
+                  </el-button>
+                  <el-dropdown-menu slot="dropdown">
+                    <!-- <el-dropdown-item>
+                      <el-button
+                        size="mini"
+                        type="text"
+                        icon="el-icon-edit"
+                        @click="excuteHandler(scope.row)"
+                        v-hasPermi="['system:user:edit']"
+                      >处理
+                      </el-button>
+                    </el-dropdown-item> -->
+                    <el-dropdown-item>
+                      <el-dropdown
+                        size="mini"
+                        @command="
+                          (command) => handleCommand(command, scope.row)
+                        "
+                      >
+                        <el-button
+                          size="mini"
+                          type="text"
+                          icon="el-icon-d-arrow-right"
+                          >触发异常
+                        </el-button>
+                        <el-dropdown-menu slot="dropdown"> </el-dropdown-menu>
+                      </el-dropdown>
+                    </el-dropdown-item>
+                  </el-dropdown-menu>
+                </el-dropdown>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+        <!--    分页    -->
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </div>
+      <div class="show-window">
+        <!-- 运行节点弹窗 -->
+        <el-dialog :title="nodeTitle" :visible.sync="open" width="50%">
+          <!-- <el-form label-width="100px" :model="commonData">
+            <h1>这里会引入当前节点需要处理的表单</h1>
+          </el-form> -->
+          <component v-if="myForm" :is="myForm" ref="myFormRef"></component>
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="closeExecuteNode">取消</el-button>
+            <el-button type="primary" @click="executeNode">运行</el-button>
+          </span>
+        </el-dialog>
+      </div>
     </div>
   </div>
 </template>
 
 <script>
+import {
+  processList,
+  runProcessNodeExecution,
+} from "@/api/bpmprocess/run/executeProcess";
+import getNodeSequence from "@/utils/bpmn/getNodeSequence";
+import GY1 from "./dialogCompments/GY1.vue";
+
 export default {
   name: "processMange",
   props: [],
-  components: {},
+  components: { GY1 },
+  dicts: ["bpm_type"],
   data() {
     return {
+      row: {}, //当前操作行数据
+      myForm: "", //自定义表单组件名
+      // 节点弹窗title
+      nodeTitle: "节点弹窗",
+      open: false,
+      // 节点弹窗对应的formData
+      commonData: {},
       taskType: 1,
       queryString: "",
       taskStatus: 3,
+      tableData: [], //表格数据
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      total: 0,
+      columns: [
+        {
+          prop: "bepTaskKey",
+          label: "任务编号",
+        },
+        {
+          prop: "bepTaskName",
+          label: "任务名称",
+        },
+        {
+          prop: "bepTaskProcessType",
+          label: "任务流程类型",
+        },
+        {
+          prop: "bepTaskProcessState",
+          label: "任务流程状态",
+        },
+        {
+          prop: "benTaskNodeName",
+          label: "节点名称",
+        },
+        {
+          prop: "benTaskNodeType",
+          label: "节点类型",
+        },
+        {
+          prop: "benTaskNodeState",
+          label: "节点状态",
+        },
+        {
+          prop: "benCreateBy",
+          label: "创建人",
+        },
+        {
+          prop: "benCreateTime",
+          label: "创建时间",
+        },
+      ],
     };
   },
   computed: {},
-  methods: {},
+  mounted() {
+    this.getList();
+  },
+  methods: {
+    // 获取列表数据
+    getList() {
+      processList(this.queryParams).then((res) => {
+        console.log(res);
+        if (res.code == 200) {
+          this.tableData = res.rows.map((item) => item.resultMap);
+          this.total = res.total;
+          console.log(this.tableData);
+        } else {
+          this.$message.error("网络异常,请稍后再试");
+        }
+      });
+    },
+    // 打开运行节点弹窗
+    opneExecuteNode(row) {
+      console.log(row);
+      this.myForm = row.benTaskNodeName.split("-")[0];
+      this.row = row; //记录当前行数据
+      this.open = true; // 打开弹窗
+      // 根据当前节点绑定的表单信息查询对应的表单进行展示
+    },
+    // 运行节点按钮
+    async executeNode() {
+      console.log(this.row);
+      let { benTaskNodeKey, bepTaskProcessXmlContent, implementationName } =
+        this.row;
+      let { nodeId, nextNodeId } = this.getNextNodeKey(
+        benTaskNodeKey,
+        bepTaskProcessXmlContent
+      );
+      let formData = {};
+      if (this.$refs.myFormRef) {
+        //获取自定义表单组件内容
+        formData = await this.$refs.myFormRef.getFormData();
+        if (!formData.flag) {
+          this.$message.error(formData.msg);
+          return;
+        }
+      }
+      // let payLoad = {
+      //   basicMap: {
+      //     taskNodeKey: nodeId,
+      //     nextNodeKey: nextNodeId,
+      //     // tableName: "",
+      //     implementationName: this.row.benmTaskAutomaticScriptTriggerType,
+      //     taskProcessKey: this.row.bepTaskKey,
+      //   },
+      //   commMap: {
+      //     //formData
+      //   },
+      // };
+
+      let payLoad = {
+        taskProcessKey: this.row.bepTaskKey, //当前任务流程编码
+        taskNodeKey: nodeId, //当前执行节点唯一编码
+        nextNodeKey: nextNodeId, //下一节点编码
+        implementationName: this.row.benmTaskAutomaticScriptTriggerType, //当前节点绑定的脚本名
+        taskProcessXmlContent: this.row.bepTaskProcessXmlContent, //当前流程xml
+        formDataMap: formData.data, //自定义表单组件收集的表单数据
+      };
+      runProcessNodeExecution(payLoad).then((res) => {
+        console.log(res);
+      });
+      console.log(payLoad);
+    },
+    // 关闭运行节点弹窗
+    closeExecuteNode(row) {
+      console.log(row);
+      this.open = false;
+    },
+    // 获取下一个节点的nodekey
+    getNextNodeKey(nodeKey, xmlStr) {
+      let xmlObj = this.xmlStr2XmlObj(xmlStr);
+      let nodeSequence = getNodeSequence(xmlObj);
+      return nodeSequence.find((item) => item.nodeId == nodeKey) || {};
+    },
+    // xml字符串转xml对象
+    xmlStr2XmlObj(xmlStr) {
+      var xmlObj = {};
+      if (document.all) {
+        var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
+        xmlDom.loadXML(xmlStr);
+        xmlObj = xmlDom;
+      } else {
+        xmlObj = new DOMParser().parseFromString(xmlStr, "text/xml");
+      }
+      return xmlObj;
+    },
+    // 触发异常回调
+    handleCommand(command, row) {
+      console.log("触发异常");
+    },
+    // 获取字典对应label
+    getDictLabel(value, dictLsit = []) {
+      return dictLsit.find((item) => {
+        return item.value == value;
+      })?.label;
+    },
+  },
 };
 </script>
 
@@ -78,6 +339,7 @@ export default {
 .process-mange-wrap {
   background-color: #f2f3f8;
   padding: 20px;
+
   .col {
     background-color: #fff;
     border-right: 1px solid #ebedf2;
@@ -89,19 +351,23 @@ export default {
       align-items: center;
       padding: 10px 17px;
       justify-content: space-between;
+
       .discription {
         display: flex;
         flex-direction: column;
+
         .title {
           line-height: 20px;
           font-size: 18px;
           font-weight: 700;
           margin-bottom: 5px;
         }
+
         .sub-title {
           font-size: 14px;
         }
       }
+
       .data {
         font-size: 20px;
         font-weight: 700;
@@ -113,6 +379,7 @@ export default {
     margin-top: 30px;
     box-shadow: 0 1px 15px 1px rgb(69 65 78 / 8%);
     background-color: #fff;
+
     .show-header {
       border-bottom: 1px solid #ebedf2;
       display: flex;
@@ -120,18 +387,23 @@ export default {
       justify-content: space-between;
       padding: 0px 20px 0px 20px;
       height: 70px;
+
       .header {
       }
+
       .search-list {
         display: flex;
+
         .search-tab {
           margin-right: 20px;
+
           .btn-list-two {
             margin-left: 10px;
           }
         }
       }
     }
+
     .show-body {
       padding: 25px;
     }

+ 64 - 3
ruoyi-ui/src/views/bussiness/progressShow.vue

@@ -35,7 +35,11 @@
         </div>
       </div>
       <div class="show-body">
-        <TaskList v-for="i of 5" :key="i"></TaskList>
+        <TaskList
+          v-for="(item, index) of tableData"
+          :key="index + 1"
+          :cardData="item"
+        ></TaskList>
         <pagination
           v-show="total > 0"
           :total="total"
@@ -50,6 +54,9 @@
 
 <script>
 import TaskList from "./components/taskList.vue";
+import { processList } from "@/api/bpmprocess/run/executeProcess";
+import getNodeSequence from "@/utils/bpmn/getNodeSequence";
+import { xmlStr2XmlObj } from "@/utils/bpmn/xml";
 export default {
   name: "ProgressShow",
   props: [],
@@ -58,16 +65,70 @@ export default {
     return {
       processType: 1,
       queryString: "",
-      total: 1,
+      total: 0,
       queryParams: {
         pageNum: 1,
         pageSize: 5,
       },
+      tableData: [], //列表数据
     };
   },
   computed: {},
   methods: {
-    getList() {},
+    // 获取列表数据
+    getList() {
+      processList(this.queryParams).then((res) => {
+        if (res.code == 200) {
+          this.tableData = this.getTableData(
+            res.rows.map((item) => item.resultMap)
+          );
+          this.total = res.total;
+          console.log(this.tableData);
+        } else {
+          this.$message.error("网络异常,请稍后再试");
+        }
+      });
+    },
+    // 获取表格展示数据
+    getTableData(dataList) {
+      let res = [];
+      res = dataList.map((item) => {
+        let baseObj = {
+          benTaskProcessKey: item.bepTaskKey, //任务编号
+          bepTaskName: item.bepTaskName, //任务名称
+          benCreateTime: item.benCreateTime, //开始或结束时间  需要根据bepTaskProcessState状态 来判定
+          currentNodeKey: item.benTaskNodeKey, //当前节点key
+          cardList: [],
+        };
+        let xmlObj = xmlStr2XmlObj(item.bepTaskProcessXmlContent);
+        console.dir(xmlObj);
+        baseObj.cardList = getNodeSequence(xmlObj);
+        return baseObj;
+      });
+      res = this.setNodeState(res);
+      return res;
+    },
+    // 设置节点完成情况
+    setNodeState(res) {
+      res.forEach((re) => {
+        let nowKey = re.currentNodeKey;
+        let isDone = true;
+        re.cardList.forEach((item) => {
+          if (item.nodeId == nowKey) {
+            isDone = false;
+            item.isDone = isDone;
+            item.isNow = true;
+          } else {
+            item.isDone = isDone;
+            item.isNow = false;
+          }
+        });
+      });
+      return res;
+    },
+  },
+  mounted() {
+    this.getList();
   },
 };
 </script>