소스 검색

工艺工序弹窗

侯茂昌 1 년 전
부모
커밋
d0f84c8a45

+ 5 - 4
pom.xml

@@ -59,21 +59,18 @@
                 <artifactId>UserAgentUtils</artifactId>
                 <version>${bitwalker.version}</version>
             </dependency>
-
             <!-- pagehelper 分页插件 -->
             <dependency>
                 <groupId>com.github.pagehelper</groupId>
                 <artifactId>pagehelper-spring-boot-starter</artifactId>
                 <version>${pagehelper.boot.version}</version>
             </dependency>
-
             <!-- 获取系统信息 -->
             <dependency>
                 <groupId>com.github.oshi</groupId>
                 <artifactId>oshi-core</artifactId>
                 <version>${oshi.version}</version>
             </dependency>
-
             <!-- Swagger3依赖 -->
             <dependency>
                 <groupId>io.springfox</groupId>
@@ -190,7 +187,11 @@
 
 
     <dependencies>
-
+        <dependency>
+            <groupId>com.github.jsqlparser</groupId>
+            <artifactId>jsqlparser</artifactId>
+            <version>4.6</version>
+        </dependency>
     </dependencies>
 
     <build>

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

@@ -20,10 +20,7 @@ import com.ruoyi.system.mapper.DragTableBtnRelevanceMapper;
 import com.ruoyi.system.mapper.DragTableGroupMapper;
 import com.ruoyi.system.mapper.DragTableMapper;
 import com.ruoyi.system.service.*;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.*;
@@ -54,14 +51,7 @@ public class CommonBtnController extends BaseController {
     @Resource
     private   IDragTableGroupService dragTableGroupService;
 
-    @Resource
-    private DragTableGroupMapper dragTableGroupMapper;
-
-    @Resource
-    private DragTableBtnRelevanceMapper dragTableBtnRelevanceMapper;
 
-    @Resource
-    private DragTableBtnMapper dragTableBtnMapper;
 
     /**
      * 处理按钮通用接口(新增、修改、删除)
@@ -122,11 +112,9 @@ public class CommonBtnController extends BaseController {
                 if (!dragTableBtn.getBtnProcessKey().isEmpty()) {
                     // 调用发起流程接口
                     fromUtils.runBpmProductionScheduling(commonEntity);
-
 //                    if (dragTableBtn.getBtnFormKey().isEmpty()) {  // 校验当前按钮是否是直接触发流程 或者脚本 (新增按钮类型)
 //                        fromUtils.runBpmProductionScheduling(commonEntity);
 //                    }
-
                 } else if (!dragTableBtn.getBtnScriptKey().isEmpty()) {
                     // 调用执行脚本接口
                     fromUtils.triggerScript(commonEntity);
@@ -134,97 +122,109 @@ public class CommonBtnController extends BaseController {
             }
             return toAjax(commonService.edit(commonEntity));
         } else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
+            Map<String, Object> map = new HashMap<>();
             //单纯是表格还是弹窗里有表格
-            return getAjaxResult(commonEntity);
-        } else {
-            return warn("暂不支持该操作!");
-        }
-    }
-
-    /**
-     * 判断是正常的表单渲染还是配置组三个的渲染
-     * @param commonEntity
-     * @return
-     * @throws JsonProcessingException
-     */
-    private AjaxResult getAjaxResult(CommonEntity commonEntity) throws JsonProcessingException {
-        Map<String, Object> map = new HashMap<>();
-        //先拿到btnKey
-        String btnKey = commonEntity.getBasicMap().get("btnKey").toString();
-        //查询按钮列表
-        DragTableBtn dragTableBtn = iDragTableBtnService.selectDragTableBtnByBtnKey(btnKey);
-        //判断是走原生的表单解析还是、走配置的表单解析
-        if (dragTableBtn.getBtnTableFormGroupKey()!=null&&dragTableBtn.getBtnTableFormGroupKey()!="") {
-            //查询组信息
-            DragTableGroup dragTableGroup = dragTableGroupMapper.selectDragTableGroupOneByGroupKey(dragTableBtn.getBtnTableFormGroupKey());
-            DragTableGroupVo dragTableGroupVo=new DragTableGroupVo();
-            //赋值给vo才好放表格
-            BeanUtils.copyProperties(dragTableGroup, dragTableGroupVo);
-
-            //把[{"tableKey":"a1","sort":0},{"tableKey":"a2","sort":1}]转换成Map对象
-            JSONArray jsonArray = JSON.parseArray( dragTableGroup.getGroupTableInfo());
-            //排序确保表格的顺序
-            JSONArray sortArray = jsonArray.stream().sorted(
-                    Comparator.comparingLong(
-                            // 根据对象中的ID进行排序
-                            e -> JSONObject.parseObject(e.toString()).getIntValue("sort")
-                    )
-            ).collect(Collectors.toCollection(JSONArray::new));
-            //用in查询
-            List<String> tableKeys = new ArrayList<>();
-            sortArray.stream().forEach(item->
-                    tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
-
-            //查询表格信息
-            List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeysOrderby(tableKeys);
-            dragTableVos.forEach(item->{
-                // 动态表格按钮信息
-                //根据tableKey获取根节点信息
-                List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(item.getTableKey());
-                //获取根节点数据
-                if(btnKeys.size() > 0){
-                    List<DragTableBtn> rootNodes = dragTableBtnMapper.selectDragTableBtnListByBtnKey(btnKeys);
-                    //查询子节点
-                    List<Long> ids = rootNodes.stream().map(m -> m.getId()).collect(Collectors.toList());
-                    if (ids.isEmpty()){
-                         item.setDragTableBtnList(rootNodes);
-                    }else {
-                        List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
-                        List<DragTableBtn> btnList = rootNodes.stream().peek(
-                                root -> root.setChildren(getChildrenList(root, childNodes))
-                        ).collect(Collectors.toList());
-                        item.setDragTableBtnList(btnList);
-                    }
-                }
-            });
-            //查询表格按钮
-            dragTableGroupVo.setDragTables(dragTableVos);
-            map.put("template", null);
-            //把groupKey放进去
-            map.put("result",dragTableGroupVo);
-        }else {
             String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
             DragForm dragForm = dragFormService.selectDragFormBySqlKey(sqlKey);
             map.put("template", dragForm);
             //返回结果
             map.put("result", commonService.getInfoById(commonEntity));
+            return success(map);
+        } else {
+            return warn("暂不支持该操作!");
         }
-        return success(map);
     }
 
-    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;
-    }
+
     // 删除类型按钮
     public AjaxResult deleteBtn(CommonEntity commonEntity) {
         return toAjax(commonService.batchDelete(commonEntity));
     }
 
+
+    /**
+     * 弹窗表格结构信息
+     */
+    @GetMapping(value = "/getProcessPopupTableInfo")
+    public AjaxResult getProcessPopupTableInfo(CommonEntity commonEntity) {
+        return AjaxResult.success(dragTableGroupService.getProcessPopupTableInfo(commonEntity));
+    }
+
+    /**
+     * 弹窗表格信息
+     */
+    @GetMapping(value = "/getProcessPopupTableList")
+    public AjaxResult getProcessPopupTableList(CommonEntity commonEntity) {
+        return AjaxResult.success(dragTableGroupService.getProcessPopupTableList(commonEntity));
+    }
+
+    ///**
+    // * 判断是正常的表单渲染还是弹窗表格的渲染
+    // * @param commonEntity
+    // * @return
+    // * @throws JsonProcessingException
+    // */
+    //private AjaxResult getAjaxResult(CommonEntity commonEntity) throws JsonProcessingException {
+    //    Map<String, Object> map = new HashMap<>();
+    //    //先拿到btnKey
+    //    String btnKey = commonEntity.getBasicMap().get("btnKey").toString();
+    //    //查询按钮列表
+    //    DragTableBtn dragTableBtn = iDragTableBtnService.selectDragTableBtnByBtnKey(btnKey);
+    //    //判断是走原生的表单解析还是、走配置的表单解析
+    //    if (dragTableBtn.getBtnTableFormGroupKey()!=null&&dragTableBtn.getBtnTableFormGroupKey()!="") {
+    //        //查询组信息
+    //        DragTableGroup dragTableGroup = dragTableGroupMapper.selectDragTableGroupOneByGroupKey(dragTableBtn.getBtnTableFormGroupKey());
+    //        DragTableGroupVo dragTableGroupVo=new DragTableGroupVo();
+    //        //赋值给vo才好放表格
+    //        BeanUtils.copyProperties(dragTableGroup, dragTableGroupVo);
+    //        //把[{"tableKey":"a1","sort":0},{"tableKey":"a2","sort":1}]转换成Map对象
+    //        JSONArray jsonArray = JSON.parseArray( dragTableGroup.getGroupTableInfo());
+    //        //排序确保表格的顺序
+    //        JSONArray sortArray = jsonArray.stream().sorted(
+    //                Comparator.comparingLong(
+    //                        // 根据对象中的ID进行排序
+    //                        e -> JSONObject.parseObject(e.toString()).getIntValue("sort")
+    //                )
+    //        ).collect(Collectors.toCollection(JSONArray::new));
+    //        //用in查询
+    //        List<String> tableKeys = new ArrayList<>();
+    //        sortArray.stream().forEach(item->
+    //                tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
+    //        //查询表格信息
+    //        List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeysOrderby(tableKeys);
+    //        dragTableVos.forEach(item->{
+    //            // 动态表格按钮信息
+    //            //根据tableKey获取根节点信息
+    //            List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(item.getTableKey());
+    //            //获取根节点数据
+    //            if(btnKeys.size() > 0){
+    //                List<DragTableBtn> rootNodes = dragTableBtnMapper.selectDragTableBtnListByBtnKey(btnKeys);
+    //                //查询子节点
+    //                List<Long> ids = rootNodes.stream().map(m -> m.getId()).collect(Collectors.toList());
+    //                if (ids.isEmpty()){
+    //                     item.setDragTableBtnList(rootNodes);
+    //                }else {
+    //                    List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
+    //                    List<DragTableBtn> btnList = rootNodes.stream().peek(
+    //                            root -> root.setChildren(getChildrenList(root, childNodes))
+    //                    ).collect(Collectors.toList());
+    //                    item.setDragTableBtnList(btnList);
+    //                }
+    //            }
+    //        });
+    //        //查询表格按钮
+    //        dragTableGroupVo.setDragTables(dragTableVos);
+    //        map.put("template", dragTableGroupVo);
+    //        //把groupKey放进去
+    //        map.put("result",null);
+    //    }else {
+    //        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);
+    //}
+
 }

+ 7 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/CommonController.java

@@ -83,9 +83,13 @@ public class CommonController extends BaseController {
      */
     @GetMapping("/getTableList")
     public TableDataInfo queryTableList(CommonEntity commonEntity) throws TenantDataSource {
-        TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(commonEntity.getQueryMap().get("sqlkey").toString());
-        startPage();  // 校验是否sqlserver 否执行 是执行另一种方式的分页
-        return getDataTable(commonService.queryGroupTableList(commonEntity, tableSql));
+        if(commonEntity.getQueryMap().get("sqlkey").toString().equals("")){
+            return  getDataTable(null);
+        }else {
+            TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(commonEntity.getQueryMap().get("sqlkey").toString());
+            startPage();  // 校验是否sqlserver 否执行 是执行另一种方式的分页
+            return getDataTable(commonService.queryGroupTableList(commonEntity, tableSql));
+        }
     }
 
     /**

+ 13 - 3
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableGroupController.java

@@ -16,6 +16,7 @@ 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.HashMap;
 import java.util.List;
 
 /**
@@ -82,6 +83,7 @@ public class DragTableGroupController extends BaseController {
         util.exportExcel(response, list, "拖拽格组数据");
     }
 
+
     /**
      * 获取拖拽格组详细信息
      */
@@ -94,7 +96,6 @@ public class DragTableGroupController extends BaseController {
     }
 
 
-
     /**
      * 新增拖拽格组
      */
@@ -117,8 +118,6 @@ public class DragTableGroupController extends BaseController {
         return toAjax(dragTableGroupService.insertDragTableConfigurationGroup(dragTableGroupVo));
     }
 
-
-
     /**
      * 修改拖拽格组
      */
@@ -156,4 +155,15 @@ public class DragTableGroupController extends BaseController {
         //Boolean aBoolean = dragTableGroupService.selectDragTableGroupTableListSize(ids);
         return toAjax(dragTableGroupService.deleteDragTableGroupByIds(ids));
     }
+
+    ///**
+    // * 下发给BPM工艺工序的弹窗信息
+    // */
+    //@GetMapping("/getProcessPopupResultInfo")
+    //@ApiOperation(value = "下发给BPM工艺工序的弹窗信息")
+    //public CommonEntity get(CommonEntity commonEntity)
+    //{
+    //    CommonEntity commonEntityResult = dragTableGroupService.queryProcessPopupResultInfo(commonEntity);
+    //    return commonEntityResult;
+    //}
 }

+ 6 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableStatisticController.java

@@ -81,6 +81,12 @@ public class DragTableStatisticController extends BaseController
     @ApiOperation(value = "新增动态表格统计")
     public AjaxResult add(@RequestBody DragTableVo vo)
     {
+        if(vo.getDragTableStatisticList()==null||vo.getDragTableStatisticList().size()<0){
+            return  AjaxResult.success("未填写统计信息1");
+        }
+        if(vo.getTableSqlList()==null||vo.getTableSqlList().size()<0){
+            return  AjaxResult.success("未填写统计信息2");
+        }
         return toAjax(dragTableStatisticService.batchInsertDragTableStatistic(vo));
     }
 

+ 0 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/form/FromUtils.java

@@ -21,7 +21,6 @@ public class FromUtils<T> {
     @Autowired  // 共通接口地址
     private FormProperties formProperties;
 
-
     // 创建RestTemplate实例
     RestTemplate restTemplate = new RestTemplate();
 

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/system/entity/DragTableGroup.java

@@ -31,6 +31,11 @@ public class DragTableGroup extends BaseEntity {
     @Excel(name = "表格组key")
     private String groupType;
 
+
+    /**模板类型*/
+    @Excel(name = "表格组key")
+    private String templateType;
+
     /** 表格组描述 */
     @Excel(name = "表格组描述")
     private String groupDescription;
@@ -105,6 +110,14 @@ public class DragTableGroup extends BaseEntity {
         this.delFlag = delFlag;
     }
 
+    public String getTemplateType() {
+        return templateType;
+    }
+
+    public void setTemplateType(String templateType) {
+        this.templateType = templateType;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 13 - 0
ruoyi-system/src/main/java/com/ruoyi/system/entity/vo/DragTableGroupVo.java

@@ -31,6 +31,11 @@ public class DragTableGroupVo extends BaseEntity {
     @Excel(name = "表格组key")
     private String groupType;
 
+
+    /**模板类型*/
+    @Excel(name = "表格组key")
+    private String templateType;
+
     //动态表格实体类集合
     public List<DragTableVo> dragTables;
 
@@ -89,6 +94,14 @@ public class DragTableGroupVo extends BaseEntity {
     public void setGroupType(String groupType) {
         this.groupType = groupType;
     }
+
+    public String getTemplateType() {
+        return templateType;
+    }
+
+    public void setTemplateType(String templateType) {
+        this.templateType = templateType;
+    }
     @Override
     public String toString() {
         return "DragTableGroupVo{" +

+ 18 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IDragTableGroupService.java

@@ -1,8 +1,10 @@
 package com.ruoyi.system.service;
 
+import com.ruoyi.system.entity.CommonEntity;
 import com.ruoyi.system.entity.DragTableGroup;
 import com.ruoyi.system.entity.vo.DragTableGroupVo;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -86,4 +88,20 @@ public interface IDragTableGroupService {
      * 查询当前组下是否包含有表格信息
      */
     Boolean selectDragTableGroupTableListSize(Long[] ids);
+
+
+    /**
+     * 弹窗查询表格结构信息
+     * @param commonEntity
+     * @return
+     */
+    CommonEntity getProcessPopupTableInfo(CommonEntity commonEntity);
+
+
+    /**
+     * 弹窗查询表格数据信息
+     * @param commonEntity
+     * @return
+     */
+    CommonEntity getProcessPopupTableList(CommonEntity commonEntity);
 }

+ 9 - 10
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/CommonServiceImpl.java

@@ -112,6 +112,7 @@ public class CommonServiceImpl implements ICommonService {
     }
 
 
+    @Override
     public List<CommonEntity> queryGroupTableList(CommonEntity commonEntity, TableSql tableSql) {
            //前端传递过来的参数
            Map<String, Object> queryMap = commonEntity.getQueryMap();
@@ -128,7 +129,6 @@ public class CommonServiceImpl implements ICommonService {
                    }
                }
            });
-
            //证明条件不对应不能让他进行查询
            if(!isExist.get()){
                List<CommonEntity> commonEntityList = new ArrayList<>();
@@ -139,18 +139,17 @@ public class CommonServiceImpl implements ICommonService {
                commonEntityList.add(common);
                return  commonEntityList;
            }
-        Map<String, Object> conditions = JSONObject.parseObject(JSON.toJSONString(commonEntity.getQueryMap()));
+           Map<String, Object> conditions = JSONObject.parseObject(JSON.toJSONString(commonEntity.getQueryMap()));
 
-        //正常的查询
-        String queryCriteriaValue =
-                conditions.containsKey("queryCriteriaValue") == true
-                        ? conditions.get("queryCriteriaValue").toString() : "";
-        String endSQL = replaceSql.get().replace("#{val}", queryCriteriaValue);
-        String sqlString = tableSql.getTableSql() + " where " + endSQL;
-        return commonMapper.queryTableList(sqlString);
+           //正常的查询
+           String queryCriteriaValue =
+                    conditions.containsKey("queryCriteriaValue") == true
+                            ? conditions.get("queryCriteriaValue").toString() : "";
+           String endSQL = replaceSql.get().replace("#{val}", queryCriteriaValue);
+           String sqlString = tableSql.getTableSql() + " where " + endSQL;
+           return commonMapper.queryTableList(sqlString);
     }
 
-
     @Override
     public List<CommonEntity> queryTableList(CommonEntity commonEntity, TableSql tableSql) {
         // 根据sqlkey查询得到当前表单对应的sql

+ 4 - 2
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragFormServiceImpl.java

@@ -91,6 +91,8 @@ public class DragFormServiceImpl implements IDragFormService {
         if (dragTableFormMapper.selectDtIdCount(dragForm.getDtId()) > 0) {
             return AjaxResult.warn("该表格已绑定表单!");
         }
+        dragForm.setCreateById(SecurityUtils.getUserId());
+        dragForm.setCreateBy(SecurityUtils.getUsername());
         //新增表单
         dragFormMapper.insertDragForm(dragForm);
         //新增关联表
@@ -111,8 +113,8 @@ public class DragFormServiceImpl implements IDragFormService {
     public int updateDragForm(DragForm dragForm) {
         // 修改的时候删除表单源文件后重新创建
         delFileForm(dragForm.getfId());
-        //dragForm.setUpdateTime(DateUtils.getNowDate());
-        //dragForm.setUpdateById(SecurityUtils.getUserId());
+        dragForm.setUpdateTime(DateUtils.getNowDate());
+        dragForm.setUpdateById(SecurityUtils.getUserId());
         return dragFormMapper.updateDragForm(dragForm);
     }
 

+ 160 - 31
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableGroupServiceImpl.java

@@ -4,25 +4,22 @@ import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.utils.SecurityUtils;
-import com.ruoyi.system.entity.DragTable;
-import com.ruoyi.system.entity.DragTableCondition;
-import com.ruoyi.system.entity.DragTableGroup;
-import com.ruoyi.system.entity.TableSql;
+import com.ruoyi.system.entity.*;
 import com.ruoyi.system.entity.vo.DragTableGroupVo;
 import com.ruoyi.system.entity.vo.DragTableVo;
-import com.ruoyi.system.mapper.DragTableConditionMapper;
-import com.ruoyi.system.mapper.DragTableGroupMapper;
-import com.ruoyi.system.mapper.DragTableMapper;
-import com.ruoyi.system.mapper.TableSqlMapper;
+import com.ruoyi.system.mapper.*;
+import com.ruoyi.system.service.ICommonService;
 import com.ruoyi.system.service.IDragTableBtnRelevanceService;
 import com.ruoyi.system.service.IDragTableGroupService;
+import com.ruoyi.system.service.ITableSqlService;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.core.parameters.P;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.stream.Collectors;
 
 /**
@@ -51,6 +48,19 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
 
     @Autowired
     private IDragTableBtnRelevanceService dragTableBtnRelevanceService;
+
+    @Resource
+    private CommonMapper commonMapper;
+
+    @Resource  // 动态sql
+    private ITableSqlService iTableSqlService;
+
+    @Resource
+    private DragTableBtnRelevanceMapper dragTableBtnRelevanceMapper;
+
+    @Resource
+    private DragTableBtnMapper dragTableBtnMapper;
+
     /**
      * 查询拖拽格组
      *
@@ -124,7 +134,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
     public static final String SQL_END = "LIKE '%#{val}%'";
 
     /**
-     * 修改拖拽格组
+     * 修改联动表格拖拽格组
      *
      * @param dragTableGroupVo 拖拽格组
      * @return 结果
@@ -214,6 +224,12 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         return i;
     }
 
+    /**
+     * 修改表格表单拖拽格组
+     *
+     * @param dragTableGroupVo 拖拽格组
+     * @return 结果
+     */
     @Override
     public int editConfigurationGroup(DragTableGroupVo dragTableGroupVo) {
         //根据id查询表格组信息
@@ -237,7 +253,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
                 //add drag_table
                 DragTable dragTable = new DragTable();
                 BeanUtils.copyProperties(dragTableVo, dragTable);
-                dragTable.setDtColumnName(dragTableVo.getDtColumnName().toString());
+                dragTable.setDtColumnName(JSONObject.toJSONString(dragTableVo.getDtColumnName()));
                 dragTable.setPrimaryKey(dragTableVo.getPrimaryKey());
                 dragTable.setMenuId(dragTableVo.getMenuId());
                 dragTable.setDtType("1");
@@ -245,7 +261,8 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
                 TableSql tableSql = new TableSql();
                 tableSql.setSqlKey(dragTableVo.getSqlKey());
                 tableSql.setTableSql(dragTableVo.getTableSql());
-                dragTableMapper.updateDragTable(dragTable);
+                int i1 = dragTableMapper.updateDragTable(dragTable);
+                System.out.println(i1);
                 //拼接sql查询条件
                 switch (SecurityUtils.getDatabaseType().toUpperCase()) {
                     case "MYSQL":
@@ -346,31 +363,19 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         return groupTableInfo;
     }
 
+    /**
+     * 查询表格组包含的详细信息
+     * @param dragTableGroup
+     * @return
+     */
     @Override
     public DragTableGroupVo selectDragTableGroupListDetail(DragTableGroup dragTableGroup) {
         //根据id查询表格组信息
         DragTableGroup dragTableGroupOne = dragTableGroupMapper.selectDragTableGroupById(dragTableGroup.getId());
         //得到group_table_info
         String groupTableInfo = dragTableGroupOne.getGroupTableInfo();
-        //把他转换成Map对象
-        JSONArray jsonArray = JSON.parseArray(groupTableInfo);
-        //排序确保表格的顺序
-        JSONArray sortArray = jsonArray.stream().sorted(
-                Comparator.comparingLong(
-                        // 根据对象中的ID进行排序
-                        e -> JSONObject.parseObject(e.toString()).getIntValue("sort")
-                )
-        ).collect(Collectors.toCollection(JSONArray::new));
-        //把查询出来的动态表格数据放到一个集合里边
-        List<DragTableVo> dragTableList=new ArrayList<>();
-        sortArray.forEach(e->{
-            JSONObject jsonObject = JSON.parseObject(e.toString());
-            String str = jsonObject.get("tableKey").toString();
-            DragTable dragTable = dragTableMapper.selectDragTableByTableKey(str);
-            DragTableVo dragTableVo=new DragTableVo();
-            BeanUtils.copyProperties(dragTable, dragTableVo);
-            dragTableList.add( dragTableVo);
-        });
+        //抽取的方法(处理排序查表格数据)
+        List<DragTableVo> dragTableList = getDragTableVos(groupTableInfo);
         //查询这个动态表格的 1.条件 2.sql信息
         dragTableList.stream().map(item -> {
             //拿到这个表格的所有条件数据
@@ -401,6 +406,32 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         return    dragTableGroupVo;
     }
 
+    private List<DragTableVo> getDragTableVos(String groupTableInfo) {
+        //把他转换成Map对象
+        JSONArray jsonArray = JSON.parseArray(groupTableInfo);
+        //排序确保表格的顺序
+        JSONArray sortArray = jsonArray.stream().sorted(
+                Comparator.comparingLong(
+                        // 根据对象中的ID进行排序
+                        e -> JSONObject.parseObject(e.toString()).getIntValue("sort")
+                )
+        ).collect(Collectors.toCollection(JSONArray::new));
+        //把查询出来的动态表格数据放到一个集合里边
+        List<DragTableVo> dragTableList=new ArrayList<>();
+        sortArray.forEach(e->{
+            JSONObject jsonObject = JSON.parseObject(e.toString());
+            String str = jsonObject.get("tableKey").toString();
+            DragTable dragTable = dragTableMapper.selectDragTableByTableKey(str);
+            DragTableVo dragTableVo=new DragTableVo();
+            BeanUtils.copyProperties(dragTable, dragTableVo);
+            dragTableList.add( dragTableVo);
+        });
+        return dragTableList;
+    }
+
+    /**
+     * 查询当前组下是否包含有表格信息
+     */
     @Override
     public Boolean selectDragTableGroupTableListSize(Long[] ids) {
         List<DragTableGroup> dragTableGroups = dragTableGroupMapper.selectDragTableGroupByIdIn(ids);
@@ -422,5 +453,103 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         return true;
     }
 
+    /**
+     * 工艺工序弹窗里边的表格结构信息
+     * @param commonEntity
+     * @return
+     */
+    @Override
+    public CommonEntity getProcessPopupTableInfo(CommonEntity commonEntity) {
+        String groupKey = commonEntity.getQueryMap().get("groupKey").toString();
+        //查询组信息
+        DragTableGroup dragTableGroup = dragTableGroupMapper.selectDragTableGroupOneByGroupKey(groupKey);
+        //把[{"tableKey":"a1","sort":0},{"tableKey":"a2","sort":1}]转换成Map对象
+        JSONArray jsonArray = JSON.parseArray( dragTableGroup.getGroupTableInfo());
+        //排序确保表格的顺序
+        JSONArray sortArray = jsonArray.stream().sorted(
+                Comparator.comparingLong(
+                        // 根据对象中的ID进行排序
+                        e -> JSONObject.parseObject(e.toString()).getIntValue("sort")
+                )
+        ).collect(Collectors.toCollection(JSONArray::new));
+        //用in查询
+        List<String> tableKeys = new ArrayList<>();
+        sortArray.stream().forEach(item->tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
+        //查询表格信息
+        List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeysOrderby(tableKeys);
+        //查询表格按钮信息
+        dragTableVos.forEach(item->{
+            // 动态表格按钮信息
+            //根据tableKey获取根节点信息
+            List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(item.getTableKey());
+            //获取根节点数据
+            if(btnKeys.size() > 0){
+                List<DragTableBtn> rootNodes = dragTableBtnMapper.selectDragTableBtnListByBtnKey(btnKeys);
+                //查询子节点
+                List<Long> ids = rootNodes.stream().map(m -> m.getId()).collect(Collectors.toList());
+                if (ids.isEmpty()){
+                    item.setDragTableBtnList(rootNodes);
+                }else {
+                    List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
+                    List<DragTableBtn> btnList = rootNodes.stream().peek(
+                            root -> root.setChildren(getChildrenList(root, childNodes))
+                    ).collect(Collectors.toList());
+                    item.setDragTableBtnList(btnList);
+                }
+            }
+        });
+        CommonEntity common=new CommonEntity();
+        dragTableVos.forEach(item->{
+            //结果Map
+            Map<String, Object> resultMap = new HashMap<>();
+            resultMap.put(item.getTableKey(), item);
+            common.setResultMap(resultMap);
+        });
+        return  common;
+    }
+
+    /**
+     * 工艺工序弹窗里边的表格数据信息
+     * @param commonEntity
+     * @return
+     */
+    @Override
+    public CommonEntity getProcessPopupTableList(CommonEntity commonEntity) {
+        //拿到表格组名称
+        String groupKey = commonEntity.getQueryMap().get("groupKey").toString();
+        //查询表格组信息
+        String groupTableInfo = dragTableGroupMapper.selectDragTableGroupByGroupKey(groupKey);
+        //查询出来的表信息
+        List<DragTableVo> dragTableVos = getDragTableVos(groupTableInfo);
+        //根据sqlKey查询TableSql数据
+        CommonEntity common=new CommonEntity();
+        dragTableVos.forEach(item->{
+            TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(item.getSqlKey());
+            //sql的条件值
+            AtomicReference<String> tableSqlTableCondition= new AtomicReference<>(tableSql.getTableCondition());
+            //循环替换条件占位的值
+            commonEntity.getQueryMap().forEach((k,v)->{
+                tableSqlTableCondition.set(tableSqlTableCondition.get().replace(k, v.toString()));
+            });
+            //sql的执行语句
+            String sqlString = tableSql.getTableSql() + " where " + tableSqlTableCondition;
+            List<CommonEntity> commonEntities = commonMapper.queryTableList(sqlString);
+            common.getResultMap().put(item.getTableKey(),commonEntities);
+        });
+        return common;
+    }
+
+
+    //得到按钮表格的循环
+    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;
+    }
 
 }

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

@@ -319,7 +319,7 @@ public class DragTableServiceImpl implements IDragTableService {
             tableSql.setSortOrder(dragTableVo.getSortOrder());
             tableSqlMapper.insertTableSql(tableSql);
             //add drag_table_condition
-            if (dragTableVo.getSearchFieldList().size() > 0) {
+            if (dragTableVo.getSearchFieldList()!=null&&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()));
@@ -327,7 +327,7 @@ public class DragTableServiceImpl implements IDragTableService {
                     dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
             }
             //给表格增加按钮
-            if(dragTableVo.getDragTableBtnRelevanceList()!=null){
+            if(dragTableVo.getDragTableBtnRelevanceList()!=null&&dragTableVo.getDragTableBtnRelevanceList().size()>0){
                 dragTableBtnRelevanceService.batchInsertDragTableBtnRelevance(dragTableVo.getDragTableBtnRelevanceList());
             }
         }

+ 4 - 0
ruoyi-system/src/main/resources/mapper/common/SysDictDataMapper.xml

@@ -72,6 +72,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	
 	<update id="updateDictData" parameterType="SysDictData">
  		update sys_dict_data
+ 		    <set>
+
+
  			<if test="dictSort != null">dict_sort = #{dictSort},</if>
  			<if test="dictLabel != null and dictLabel != ''">dict_label = #{dictLabel},</if>
  			<if test="dictValue != null and dictValue != ''">dict_value = #{dictValue},</if>
@@ -84,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
 			<if test="updateById != null and updateById != ''">update_by_id = #{updateById},</if>
             update_time = sysdate()
+			</set>
  		where dict_code = #{dictCode}
 	</update>
 	

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

@@ -67,6 +67,7 @@
             <if test="groupName != null">group_name,</if>
             <if test="groupKey!=null">group_key,</if>
             <if test="groupType!=null">group_type,</if>
+            <if test="templateType!=null">template_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>
@@ -81,6 +82,7 @@
             <if test="groupName != null">#{groupName},</if>
             <if test="groupKey != null">#{groupKey},</if>
             <if test="groupType != null">#{groupType},</if>
+            <if test="templateType!=null">#{templateType},</if>
             <if test="groupDescription != null">#{groupDescription},</if>
             <if test="groupTableInfo != null">#{groupTableInfo},</if>
             <if test="createById != null">#{createById},</if>
@@ -98,6 +100,7 @@
             <if test="groupName != null">group_name = #{groupName},</if>
             <if test="groupDescription != null">group_description = #{groupDescription},</if>
             <if test="groupTableInfo != null">group_table_info = #{groupTableInfo},</if>
+            <if test="templateType!=null">template_type =#{templateType},</if>
             <if test="createById != null">create_by_id = #{createById},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>

+ 1 - 0
ruoyi-system/src/main/resources/mapper/dragmapper/DragTableMapper.xml

@@ -183,6 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         WHERE
             dt.t_id = #{tId}
     </select>
+
     <select id="selectDragTableByTableKey" parameterType="String" resultMap="DragTableResult">
         <include refid="selectDragTableVo"/>
         where table_key = #{tableKey}