瀏覽代碼

feat:修改动态表格、表单组新增修改处理逻辑。添加共通动态表格配置按钮筛选条件

韩帛霖 1 年之前
父節點
當前提交
4a8220d6a0

+ 8 - 0
zkqy-system/src/main/java/com/zkqy/system/entity/DragTableCondition.java

@@ -137,6 +137,14 @@ public class DragTableCondition extends BaseEntity  implements Serializable {
         this.conditionDefaultValue = conditionDefaultValue;
     }
 
+    public DragTableCondition(Long tId, String conditionName, String conditionField, String conditionType, String conditionDefaultValue) {
+        this.tId = tId;
+        this.conditionName = conditionName;
+        this.conditionField = conditionField;
+        this.conditionType = conditionType;
+        this.conditionDefaultValue = conditionDefaultValue;
+    }
+
     public DragTableCondition(Long tcId, Long tId, String conditionName, String conditionField, String conditionNotes, String conditionType, String conditionDefaultValue, Long sort, String conditionTableName, String conditionTableFieldName, String conditionTableFieldKey, String conditionDatasource, String componentType, String componentSize, String componentIcon, String isHidden, String delFlag, List<Map<String, Object>> dropDownList) {
         this.tcId = tcId;
         this.tId = tId;

+ 5 - 5
zkqy-system/src/main/java/com/zkqy/system/entity/vo/DragTableVo.java

@@ -66,7 +66,7 @@ public class DragTableVo {
     /**
      * 搜索字段数组
      */
-    private List<String> searchFieldList;
+    private List<DragTableCondition> searchFieldList;
 
     /**
      * sql语句默认值
@@ -229,11 +229,11 @@ public class DragTableVo {
         this.isSelection = isSelection;
     }
 
-    public List<String> getSearchFieldList() {
+    public List<DragTableCondition> getSearchFieldList() {
         return searchFieldList;
     }
 
-    public void setSearchFieldList(List<String> searchFieldList) {
+    public void setSearchFieldList(List<DragTableCondition> searchFieldList) {
         this.searchFieldList = searchFieldList;
     }
 
@@ -353,7 +353,7 @@ public class DragTableVo {
         this.conditionDefaultValueMap = new HashMap<>();
     }
 
-    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) {
+    public DragTableVo(Long tId, String dtName, String dtNickname, String tableKey, String sqlKey, String dtTableName, Object dtColumnName, String dtColumnNameEcho, String timeFormat, String isSelection, List<DragTableCondition> 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;
@@ -381,7 +381,7 @@ public class DragTableVo {
         this.dragTableBtnRelevanceList = dragTableBtnRelevanceList;
     }
 
-    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, String spare, Long menuId, String primaryKey, String orderByColumn, String sortOrder, List<DragTableStatistic> dragTableStatisticList, List<TableSql> tableSqlList, List<DragTableStyle> dragTableStyleList, List<DragTableBtn> dragTableBtnList, List<DragTableBtnRelevance> dragTableBtnRelevanceList) {
+    public DragTableVo(Long tId, String dtName, String dtNickname, String tableKey, String sqlKey, String dtTableName, Object dtColumnName, String dtColumnNameEcho, String timeFormat, String isSelection, List<DragTableCondition> searchFieldList, Map<String, Object> conditionDefaultValueMap, String tableSql, Object tableExportField, String tableExportFieldEcho, String echoData, String spare, 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;

+ 12 - 5
zkqy-system/src/main/java/com/zkqy/system/mapper/DragTableConditionMapper.java

@@ -10,12 +10,11 @@ import java.util.Set;
 
 /**
  * 动态表格条件Mapper接口
- * 
+ *
  * @author zkqy
  * @date 2023-07-31
  */
-public interface DragTableConditionMapper 
-{
+public interface DragTableConditionMapper {
     /**
      * 查询动态表格条件列表
      */
@@ -24,13 +23,20 @@ public interface DragTableConditionMapper
     /**
      * 新增动态表格条件
      */
-    int insertDragTableCondition(@Param("fieldNames") Set<String> fieldNames,@Param("fieldValues") List<Map<String, Object>> fieldValues);
+    int insertDragTableCondition(@Param("fieldNames") Set<String> fieldNames, @Param("fieldValues") List<Map<String, Object>> fieldValues);
 
     /**
      * 新增动态表格条件
      */
     int insertDragTableConditionByList(List<DragTableCondition> conditionList);
 
+    /**
+     * 新增动态表格查询条件
+     *
+     * @return
+     */
+    int insertDragTableConditionOne(DragTableCondition dragTableCondition);
+
     /**
      * 修改动态表格条件
      */
@@ -38,7 +44,7 @@ public interface DragTableConditionMapper
 
     /**
      * 批量删除动态表格条件
-     * 
+     *
      * @param conditions 需要删除的数据主键集合
      * @return 结果
      */
@@ -59,6 +65,7 @@ public interface DragTableConditionMapper
 
     /**
      * 删除动态表格条件
+     *
      * @param tIds 动态表格编号
      * @return
      */

+ 110 - 86
zkqy-system/src/main/java/com/zkqy/system/service/impl/DragTableGroupServiceImpl.java

@@ -67,8 +67,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
      * @return 拖拽格组
      */
     @Override
-    public DragTableGroup selectDragTableGroupById(Long id)
-    {
+    public DragTableGroup selectDragTableGroupById(Long id) {
         return dragTableGroupMapper.selectDragTableGroupById(id);
     }
 
@@ -79,8 +78,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
      * @return 拖拽格组
      */
     @Override
-    public List<DragTableGroup> selectDragTableGroupList(DragTableGroup dragTableGroup)
-    {
+    public List<DragTableGroup> selectDragTableGroupList(DragTableGroup dragTableGroup) {
         return dragTableGroupMapper.selectDragTableGroupList(dragTableGroup);
     }
 
@@ -93,11 +91,10 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int insertDragTableGroup(DragTableGroupVo dragTableGroupVo)
-    {
+    public int insertDragTableGroup(DragTableGroupVo dragTableGroupVo) {
         //表格组实体类拷贝数据
-        DragTableGroup dragTableGroup=new DragTableGroup();
-        BeanUtils.copyProperties(dragTableGroupVo,dragTableGroup);
+        DragTableGroup dragTableGroup = new DragTableGroup();
+        BeanUtils.copyProperties(dragTableGroupVo, dragTableGroup);
         //添加动态表格列表
         dragTableService.addDragTable(dragTableGroupVo);
         //默认添加的是联动表格
@@ -108,11 +105,10 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public int insertDragTableConfigurationGroup(DragTableGroupVo dragTableGroupVo)
-    {
+    public int insertDragTableConfigurationGroup(DragTableGroupVo dragTableGroupVo) {
         //表格组实体类拷贝数据
-        DragTableGroup dragTableGroup=new DragTableGroup();
-        BeanUtils.copyProperties(dragTableGroupVo,dragTableGroup);
+        DragTableGroup dragTableGroup = new DragTableGroup();
+        BeanUtils.copyProperties(dragTableGroupVo, dragTableGroup);
         //添加动态表格列表
         dragTableService.addDragTable(dragTableGroupVo);
         dragTableGroup.setGroupType("1");
@@ -162,9 +158,9 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
 
         //优化逻辑 1、表格组信息 2、表格信息、条件信息、sql信息
         List<DragTableVo> dragTables = dragTableGroupVo.getDragTables();
-        if (dragTables.size()>0) {
-            dragTables.stream().forEach(dragTableVo->{
-                String SQL="";
+        if (dragTables.size() > 0) {
+            dragTables.stream().forEach(dragTableVo -> {
+                String SQL = "";
                 //update drag_table
                 DragTable dragTable = new DragTable();
                 BeanUtils.copyProperties(dragTableVo, dragTable);
@@ -175,26 +171,33 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
                 dragTableMapper.updateDragTable(dragTable);
                 //update table_sql
                 TableSql tableSql = new TableSql();
+
+                List<String> searchFieldList = new ArrayList<>();
+                dragTableVo.getSearchFieldList().forEach(item -> {
+                    if (item.getConditionType().equals("SuperQuery")) {  // 当前表格的查询条件是超级查询
+                        searchFieldList.add(item.getConditionField());
+                    }
+                });
                 //拼接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));
+                        for (int i = 0; searchFieldList.size() > i; i++) {
+                            SQL += " AND " + searchFieldList.get(i) + "=" + dragTableVo.getConditionDefaultValueMap().get(searchFieldList.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";
+                        for (int i = 0; searchFieldList.size() > i; i++) {
+                            SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                            SQL += searchFieldList.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 ? " " : "||");
+                        for (int i = 0; searchFieldList.size() > i; i++) {
+                            SQL += searchFieldList.get(i);
+                            SQL += (searchFieldList.size() - 1 == i ? " " : "||");
                         }
                         break;
                 }
@@ -208,14 +211,19 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
                 System.out.println(i);
                 //add drag_table_condition
                 if (dragTableVo.getSearchFieldList().size() > 0) {
-                    List<DragTableCondition> dragTableConditionList = new ArrayList<>();
-                    dragTableVo.getSearchFieldList().forEach(item -> {
-                        if(dragTableVo.getConditionDefaultValueMap().size()>0){
-                            dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item,dragTableVo.getConditionDefaultValueMap().get(item).toString()));
-                        }
+                    // delete
+                    dragTableConditionMapper.deleteDragTableConditionBytIds(Collections.singletonList(dragTableVo.gettId()));
+                    dragTableVo.getConditionDefaultValueMap().keySet().forEach(item -> {
+                        dragTableVo.getSearchFieldList().add(
+                                new DragTableCondition(
+                                        dragTable.gettId(), "默认查询", item, "DefaultQuery", dragTableVo.getConditionDefaultValueMap().get(item).toString()));
                     });
-                    dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
-                }
+                    // 批量更新
+                    dragTableVo.getSearchFieldList().forEach(item -> {
+                item.settId(dragTable.gettId());
+                dragTableConditionMapper.insertDragTableConditionOne(item);
+            });
+                }                //修改按钮信息
             });
         }
         //修改表格组列表信息
@@ -248,9 +256,9 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         dragTableConditionMapper.deleteDragTableConditionBytIds(dragTableIds);
         //优化逻辑 1、表格组信息 2、表格信息、条件信息、sql信息
         List<DragTableVo> dragTables = dragTableGroupVo.getDragTables();
-        if (dragTables.size()>0) {
-            dragTables.stream().forEach(dragTableVo->{
-                String SQL="";
+        if (dragTables.size() > 0) {
+            dragTables.stream().forEach(dragTableVo -> {
+                String SQL = "";
                 //add drag_table
                 DragTable dragTable = new DragTable();
                 BeanUtils.copyProperties(dragTableVo, dragTable);
@@ -264,27 +272,32 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
                 tableSql.setSqlKey(dragTableVo.getSqlKey());
                 tableSql.setTableSql(dragTableVo.getTableSql());
                 int i1 = dragTableMapper.updateDragTable(dragTable);
-                System.out.println(i1);
+                List<String> searchFieldList = new ArrayList<>();
+                dragTableVo.getSearchFieldList().forEach(item -> {
+                    if (item.getConditionType().equals("SuperQuery")) {  // 当前表格的查询条件是超级查询
+                        searchFieldList.add(item.getConditionField());
+                    }
+                });
                 //拼接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));
+                        for (int i = 0; searchFieldList.size() > i; i++) {
+                            SQL += " AND " + dragTableVo.getSearchFieldList().get(i) + "=" + dragTableVo.getConditionDefaultValueMap().get(searchFieldList.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";
+                        for (int i = 0; searchFieldList.size() > i; i++) {
+                            SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                            SQL += searchFieldList.size() - 1 == i ? ",'')" : ",\n";
                         }
                         break;
                     case "ORACLE":
                         //SQL_START = "";
-                        for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
+                        for (int i = 0; searchFieldList.size() > i; i++) {
                             SQL += dragTableVo.getSearchFieldList().get(i);
-                            SQL += (dragTableVo.getSearchFieldList().size() - 1 == i ? " " : "||");
+                            SQL += (searchFieldList.size() - 1 == i ? " " : "||");
                         }
                         break;
                 }
@@ -297,13 +310,19 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
                 tableSqlMapper.updateTableSqlBySqlKey(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()));
+                    // delete
+                    dragTableConditionMapper.deleteDragTableConditionBytIds(Collections.singletonList(dragTableVo.gettId()));
+                    dragTableVo.getConditionDefaultValueMap().keySet().forEach(item -> {
+                        dragTableVo.getSearchFieldList().add(
+                                new DragTableCondition(
+                                        dragTable.gettId(), "默认查询", item, "DefaultQuery", dragTableVo.getConditionDefaultValueMap().get(item).toString()));
                     });
-                    dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
-                }
-                //修改按钮信息
+                    // 批量更新
+                    dragTableVo.getSearchFieldList().forEach(item -> {
+                item.settId(dragTable.gettId());
+                dragTableConditionMapper.insertDragTableConditionOne(item);
+            });
+                }                //修改按钮信息
                 dragTableBtnRelevanceService.updateDragTableBtnRelevance(dragTableVo);
             });
         }
@@ -322,12 +341,11 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
      */
     @Override
     @Transactional
-    public int deleteDragTableGroupByIds(Long[] ids)
-    {
+    public int deleteDragTableGroupByIds(Long[] ids) {
         //表格数据
         List<String> tableKeys = new ArrayList<>();
         //删除条件数据
-        List<Long> dragTableIds =new ArrayList<>();
+        List<Long> dragTableIds = new ArrayList<>();
         for (Long id : ids) {
             //根据id查询表格组信息
             DragTableGroup dragTableGroupOne = dragTableGroupMapper.selectDragTableGroupById(id);
@@ -336,11 +354,11 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
             //把他转换成Map对象
             JSONArray jsonArray = JSON.parseArray(groupTableInfo);
             //收集tableKey
-            jsonArray.stream().forEach(item->
+            jsonArray.stream().forEach(item ->
                     tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
             //删除条件数据
             dragTableMapper.selectDragTableTableKeys(tableKeys)
-                    .stream().forEach(item ->dragTableIds.add(item.gettId()));
+                    .stream().forEach(item -> dragTableIds.add(item.gettId()));
         }
         //删除表格数据
         dragTableMapper.deleteDragTableByTableKeys(tableKeys);
@@ -356,6 +374,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
 
     /**
      * 根据表格组key查询表格组信息
+     *
      * @param groupKey
      * @return
      */
@@ -367,6 +386,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
 
     /**
      * 查询表格组包含的详细信息
+     *
      * @param dragTableGroup
      * @return
      */
@@ -382,8 +402,10 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         dragTableList.stream().map(item -> {
             //拿到这个表格的所有条件数据
             List<DragTableCondition> dragTableConditions = dragTableConditionMapper.selectDragTableConditionByTid(item.gettId());
+//            // 得到所有的查询条件
+//            List<DragTableCondition> SearchFieldList = dragTableConditions.stream().map(it -> it.getConditionField()).collect(Collectors.toList());
             //条件
-            item.setSearchFieldList(dragTableConditions.stream().map(it->it.getConditionField()).collect(Collectors.toList()));
+            item.setSearchFieldList(dragTableConditions);
             //绑定的默认值map
             HashMap<String, Object> conditionDefaultValueMap = new HashMap<>();
             //关联条件
@@ -396,17 +418,17 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
             });
             //排序字段
             TableSql tableSql = tableSqlMapper.selectTableSqlByTSqlKey(item.getSqlKey());
-            if(tableSql!=null){
+            if (tableSql != null) {
                 item.setOrderByColumn(tableSql.getOrderByColumn());
                 item.setSortOrder(tableSql.getSortOrder());
             }
             return item;
         }).collect(Collectors.toList());
-        DragTableGroupVo dragTableGroupVo=new DragTableGroupVo();
+        DragTableGroupVo dragTableGroupVo = new DragTableGroupVo();
         BeanUtils.copyProperties(dragTableGroupOne, dragTableGroupVo);
         dragTableGroupVo.setDragTables(dragTableList);
         //查询表格的关联数据
-        return    dragTableGroupVo;
+        return dragTableGroupVo;
     }
 
     private List<DragTableVo> getDragTableVos(String groupTableInfo) {
@@ -420,14 +442,14 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
                 )
         ).collect(Collectors.toCollection(JSONArray::new));
         //把查询出来的动态表格数据放到一个集合里边
-        List<DragTableVo> dragTableList=new ArrayList<>();
-        sortArray.forEach(e->{
+        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();
+            DragTableVo dragTableVo = new DragTableVo();
             BeanUtils.copyProperties(dragTable, dragTableVo);
-            dragTableList.add( dragTableVo);
+            dragTableList.add(dragTableVo);
         });
         return dragTableList;
     }
@@ -438,26 +460,27 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
     @Override
     public Boolean selectDragTableGroupTableListSize(Long[] ids) {
         List<DragTableGroup> dragTableGroups = dragTableGroupMapper.selectDragTableGroupByIdIn(ids);
-        List<String> tableKeys=new ArrayList<>();
+        List<String> tableKeys = new ArrayList<>();
         //收集这个组下的所有tableKey
-        dragTableGroups.stream().forEach(item->{
+        dragTableGroups.stream().forEach(item -> {
             JSONArray jsonArray = JSON.parseArray(item.getGroupTableInfo());
             jsonArray.stream().forEach(
-                    it ->{
-                        tableKeys.add( JSONObject.parseObject(it.toString()).get("tableKey").toString());
+                    it -> {
+                        tableKeys.add(JSONObject.parseObject(it.toString()).get("tableKey").toString());
                     }
             );
         });
         //判断tableKey在表格表中出现了吗
         List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeys(tableKeys);
-        if(dragTableVos.size()>0){
-            return  false;
+        if (dragTableVos.size() > 0) {
+            return false;
         }
         return true;
     }
 
     /**
      * 工艺工序弹窗里边的表格结构信息
+     *
      * @param commonEntity
      * @return
      */
@@ -467,7 +490,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         //查询组信息
         DragTableGroup dragTableGroup = dragTableGroupMapper.selectDragTableGroupOneByGroupKey(groupKey);
         //把[{"tableKey":"a1","sort":0},{"tableKey":"a2","sort":1}]转换成Map对象
-        JSONArray jsonArray = JSON.parseArray( dragTableGroup.getGroupTableInfo());
+        JSONArray jsonArray = JSON.parseArray(dragTableGroup.getGroupTableInfo());
         //排序确保表格的顺序
         JSONArray sortArray = jsonArray.stream().sorted(
                 Comparator.comparingLong(
@@ -477,24 +500,24 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         ).collect(Collectors.toCollection(JSONArray::new));
         //用in查询
         List<String> tableKeys = new ArrayList<>();
-        sortArray.stream().forEach(item->tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
+        sortArray.stream().forEach(item -> tableKeys.add(JSONObject.parseObject(item.toString()).get("tableKey").toString()));
         //查询表格信息
         List<DragTableVo> dragTableVos = dragTableMapper.selectDragTableTableKeysOrderby(tableKeys);
         //存条件的数组
-        List<String> conditionCollectString=new ArrayList<>();
+        List<String> conditionCollectString = new ArrayList<>();
         //查询表格按钮信息
-        dragTableVos.forEach(item->{
+        dragTableVos.forEach(item -> {
             // 动态表格按钮信息
             //根据tableKey获取根节点信息
             List<String> btnKeys = dragTableBtnRelevanceMapper.selectBtnKeyByTableKey(item.getTableKey());
             //获取根节点数据
-            if(btnKeys.size() > 0){
+            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()){
+                if (ids.isEmpty()) {
                     item.setDragTableBtnList(rootNodes);
-                }else {
+                } else {
                     List<DragTableBtn> childNodes = dragTableBtnMapper.selectChildNodeById(ids);
                     List<DragTableBtn> btnList = rootNodes.stream().peek(
                             root -> root.setChildren(getChildrenList(root, childNodes))
@@ -505,23 +528,24 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
             //根据动态表格查询条件信息
             List<DragTableCondition> dragTableConditions = dragTableConditionMapper.selectDragTableConditionByTid(item.gettId());
             //拿到条件
-            List<String> conditionCollect= dragTableConditions.stream().map(condition -> condition.getConditionDefaultValue()).collect(Collectors.toList());
+            List<String> conditionCollect = dragTableConditions.stream().map(condition -> condition.getConditionDefaultValue()).collect(Collectors.toList());
             //添加所有集合到大条件中
             conditionCollectString.addAll(conditionCollect);
         });
         //数组集合去重
-        List<String>  distinctCondition = conditionCollectString.stream().distinct().collect(Collectors.toList());
-        CommonEntity common=new CommonEntity();
+        List<String> distinctCondition = conditionCollectString.stream().distinct().collect(Collectors.toList());
+        CommonEntity common = new CommonEntity();
         //模版结果Map
         Map<String, Object> resultMap = new HashMap<>();
-        resultMap.put("template",dragTableVos);
-        resultMap.put("condition",distinctCondition);
+        resultMap.put("template", dragTableVos);
+        resultMap.put("condition", distinctCondition);
         common.setResultMap(resultMap);
-        return  common;
+        return common;
     }
 
     /**
      * 工艺工序弹窗里边的表格数据信息
+     *
      * @param commonEntity
      * @return
      */
@@ -534,15 +558,15 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         //查询出来的表信息
         List<DragTableVo> dragTableVos = getDragTableVos(groupTableInfo);
         //根据sqlKey查询TableSql数据
-        CommonEntity common=new CommonEntity();
-        List<List<CommonEntity>> commonEntityList=new ArrayList<>();
-        dragTableVos.forEach(item->{
+        CommonEntity common = new CommonEntity();
+        List<List<CommonEntity>> commonEntityList = new ArrayList<>();
+        dragTableVos.forEach(item -> {
             TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(item.getSqlKey());
             //sql的条件值
-            AtomicReference<String> tableSqlTableCondition= new AtomicReference<>(tableSql.getTableCondition());
+            AtomicReference<String> tableSqlTableCondition = new AtomicReference<>(tableSql.getTableCondition());
             //循环替换条件占位的值
-            commonEntity.getQueryMap().forEach((k,v)->{
-                tableSqlTableCondition.set(tableSqlTableCondition.get().replace(k, "'"+v.toString()+"'"));
+            commonEntity.getQueryMap().forEach((k, v) -> {
+                tableSqlTableCondition.set(tableSqlTableCondition.get().replace(k, "'" + v.toString() + "'"));
             });
             //sql的执行语句
             String sqlString = tableSql.getTableSql() + " where " + tableSqlTableCondition.get();
@@ -552,7 +576,7 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
         });
         //结果Map
         HashMap hashMap = new HashMap();
-        hashMap.put("result",commonEntityList);
+        hashMap.put("result", commonEntityList);
         common.setResultMap(hashMap);
         return common;
     }

+ 74 - 57
zkqy-system/src/main/java/com/zkqy/system/service/impl/DragTableServiceImpl.java

@@ -216,35 +216,40 @@ public class DragTableServiceImpl implements IDragTableService {
         TableSql tableSql = new TableSql();
         tableSql.setTableSql(dragTableVo.getTableSql());
         dragTableMapper.insertDragTable(dragTable);
+        List<String> searchFieldList = new ArrayList<>();
+        dragTableVo.getSearchFieldList().forEach(item -> {
+            if (item.getConditionType().equals("SuperQuery")) {  // 当前表格的查询条件是超级查询
+                searchFieldList.add(item.getConditionField());
+            }
+        });
         // 拼接sql查询条件
         switch (SecurityUtils.getDatabaseType().toUpperCase()) {
             case "MYSQL":
                 SQL += SQL_START;
-                for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
-                    SQL += SQL_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
-                    SQL += dragTableVo.getSearchFieldList().size() - 1 == i ? ")" : ",\n";
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += SQL_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                    SQL += searchFieldList.size() - 1 == i ? ")" : ",\n";
                 }
                 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";
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                    SQL += searchFieldList.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 ? " " : "||");
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += searchFieldList.get(i);
+                    SQL += (searchFieldList.size() - 1 == i ? " " : "||");
                 }
                 break;
         }
 
         StringBuffer where = new StringBuffer();
         // dragTableVo.getDtTableName() + ".del_flag = '0' AND ";
-
         dragTableVo.getConditionDefaultValueMap().keySet().forEach(item -> {
             try {
                 where.append(item +
@@ -254,7 +259,6 @@ public class DragTableServiceImpl implements IDragTableService {
                 throw new RuntimeException(e);
             }
         });
-
         tableSql.setTableCondition(where + SQL + SQL_END);
         tableSql.setTableAlias(dragTableVo.getDtTableName());
         tableSql.setTableExportField(JSON.toJSONString(dragTableVo.getTableExportField()));
@@ -262,20 +266,18 @@ public class DragTableServiceImpl implements IDragTableService {
         tableSql.setOrderByColumn(dragTableVo.getOrderByColumn());
         tableSql.setSortOrder(dragTableVo.getSortOrder());
         tableSqlMapper.insertTableSql(tableSql);
-        //add drag_table_condition
+        // 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().keySet().forEach(item -> {
-                dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item, dragTableVo.getConditionDefaultValueMap().get(item).toString()));
+                dragTableVo.getSearchFieldList().add(
+                        new DragTableCondition(
+                                dragTable.gettId(), "默认查询", item, "DefaultQuery", dragTableVo.getConditionDefaultValueMap().get(item).toString()));
             });
-
-            dragTableConditionList.forEach(e -> {
-                e.setCreateById(SecurityUtils.getUserId());
+            // 批量更新
+            dragTableVo.getSearchFieldList().forEach(item -> {
+                item.settId(dragTable.gettId());
+                dragTableConditionMapper.insertDragTableConditionOne(item);
             });
-            dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
         }
     }
 
@@ -297,26 +299,33 @@ public class DragTableServiceImpl implements IDragTableService {
             TableSql tableSql = new TableSql();
             tableSql.setTableSql(dragTableVo.getTableSql());
             dragTableMapper.insertDragTable(dragTable);
+
+            List<String> searchFieldList = new ArrayList<>();
+            dragTableVo.getSearchFieldList().forEach(item -> {
+                if (item.getConditionType().equals("SuperQuery")) {  // 当前表格的查询条件是超级查询
+                    searchFieldList.add(item.getConditionField());
+                }
+            });
             //拼接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));
+                    for (int i = 0; searchFieldList.size() > i; i++) {
+                        SQL += " AND " + searchFieldList.get(i) + "=" + dragTableVo.getConditionDefaultValueMap().get(searchFieldList.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";
+                    for (int i = 0; searchFieldList.size() > i; i++) {
+                        SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                        SQL += searchFieldList.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 ? " " : "||");
+                    for (int i = 0; searchFieldList.size() > i; i++) {
+                        SQL += searchFieldList.get(i);
+                        SQL += (searchFieldList.size() - 1 == i ? " " : "||");
                     }
                     break;
             }
@@ -329,12 +338,17 @@ public class DragTableServiceImpl implements IDragTableService {
             tableSql.setSortOrder(dragTableVo.getSortOrder());
             tableSqlMapper.insertTableSql(tableSql);
             //add drag_table_condition
-            if (dragTableVo.getSearchFieldList() != null && dragTableVo.getSearchFieldList().size() > 0) {
-                List<DragTableCondition> dragTableConditionList = new ArrayList<>();
+            if (dragTableVo.getSearchFieldList() != null && searchFieldList.size() > 0) {
+                dragTableVo.getConditionDefaultValueMap().keySet().forEach(item -> {
+                    dragTableVo.getSearchFieldList().add(
+                            new DragTableCondition(
+                                    dragTable.gettId(), "默认查询", item, "DefaultQuery", dragTableVo.getConditionDefaultValueMap().get(item).toString()));
+                });
+                // 批量更新
                 dragTableVo.getSearchFieldList().forEach(item -> {
-                    dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item, dragTableVo.getConditionDefaultValueMap().get(item).toString()));
+                    item.settId(dragTable.gettId());
+                    dragTableConditionMapper.insertDragTableConditionOne(item);
                 });
-                dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
             }
             //给表格增加按钮
             if (dragTableVo.getDragTableBtnRelevanceList() != null && dragTableVo.getDragTableBtnRelevanceList().size() > 0) {
@@ -346,7 +360,8 @@ public class DragTableServiceImpl implements IDragTableService {
     @Override
     public DragTableVo selectDragTableVoByTId(Long tId) {
         DragTableVo vo = dragTableMapper.selectDragTableVoByTId(tId);
-        vo.setSearchFieldList(dragTableConditionMapper.selectDragTableSearchField(tId));
+        // vo.setSearchFieldList(dragTableConditionMapper.selectDragTableSearchField(tId));
+        vo.setSearchFieldList(dragTableConditionMapper.selectDragTableConditionByTid(tId));
         //查询动态表格数据统计
         DragTableStatistic dragTableStatistic = new DragTableStatistic();
         dragTableStatistic.setTableKey(vo.getTableKey());
@@ -365,10 +380,6 @@ public class DragTableServiceImpl implements IDragTableService {
     @Transactional
     @Override
     public void updateDragTable(DragTableVo dragTableVo) {
-        /*
-        tablename:"labe1:val1,labe2:val3,"
-        tablename1:"labe1:val1,labe2:val3,"
-         */
         String SQL = "";
         //update drag_table
         DragTable dragTable = new DragTable();
@@ -378,28 +389,34 @@ public class DragTableServiceImpl implements IDragTableService {
         //update table_sql
         TableSql tableSql = new TableSql();
         tableSql.setTableSql(dragTableVo.getTableSql());
+        List<String> searchFieldList = new ArrayList<>();
+        dragTableVo.getSearchFieldList().forEach(item -> {
+            if (item.getConditionType().equals("SuperQuery")) {  // 当前表格的查询条件是超级查询
+                searchFieldList.add(item.getConditionField());
+            }
+        });
         // 拼接sql查询条件(超级查询)
         switch (SecurityUtils.getDatabaseType().toUpperCase()) {
             case "MYSQL":
                 SQL += SQL_START;
-                for (int i = 0; dragTableVo.getSearchFieldList().size() > i; i++) {
-                    SQL += SQL_MIDDLE.replace("#{VAL}", dragTableVo.getSearchFieldList().get(i));
-                    SQL += dragTableVo.getSearchFieldList().size() - 1 == i ? ")" : ",\n";
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += SQL_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                    SQL += searchFieldList.size() - 1 == i ? ")" : ",\n";
                 }
                 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";
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                    SQL += searchFieldList.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 ? " " : "||");
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += searchFieldList.get(i);
+                    SQL += (searchFieldList.size() - 1 == i ? " " : "||");
                 }
                 break;
         }
@@ -421,20 +438,20 @@ public class DragTableServiceImpl implements IDragTableService {
         tableSql.setOrderByColumn(dragTableVo.getOrderByColumn());
         tableSql.setSortOrder(dragTableVo.getSortOrder());
         tableSqlMapper.updateTableSqlBySqlKey(tableSql);
-        //update drag_table_condition
+        // update drag_table_condition
         if (dragTableVo.getSearchFieldList().size() > 0) {
-            //delete
+            // delete
             dragTableConditionMapper.deleteDragTableConditionBytIds(Collections.singletonList(dragTableVo.gettId()));
-            //insert
-            List<DragTableCondition> dragTableConditionList = new ArrayList<>();
-            dragTableVo.getSearchFieldList().forEach(item -> {
-                dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item));
-            });
             dragTableVo.getConditionDefaultValueMap().keySet().forEach(item -> {
-                dragTableConditionList.add(new DragTableCondition(dragTable.gettId(), item, dragTableVo.getConditionDefaultValueMap().get(item).toString()));
+                dragTableVo.getSearchFieldList().add(
+                        new DragTableCondition(
+                                dragTable.gettId(), "默认查询", item, "DefaultQuery", dragTableVo.getConditionDefaultValueMap().get(item).toString()));
+            });
+            // 批量更新
+            dragTableVo.getSearchFieldList().forEach(item -> {
+                item.settId(dragTable.gettId());
+                dragTableConditionMapper.insertDragTableConditionOne(item);
             });
-
-            dragTableConditionMapper.insertDragTableConditionByList(dragTableConditionList);
         }
     }
 

+ 31 - 18
zkqy-system/src/main/java/com/zkqy/system/service/impl/DragTableStatisticServiceImpl.java

@@ -68,28 +68,35 @@ public class DragTableStatisticServiceImpl implements IDragTableStatisticService
         vo.getDragTableStatisticList().forEach(s -> {
             s.setCreateBy(SecurityUtils.getUserId().toString());
         });
+        List<String> searchFieldList = new ArrayList<>();
+        vo.getSearchFieldList().forEach(item -> {
+            if (item.getConditionType().equals("SuperQuery")) {  // 当前表格的查询条件是超级查询
+                searchFieldList.add(item.getConditionField());
+            }
+        });
+
         // 拼接sql查询条件
         String SQL = "";
         switch (SecurityUtils.getDatabaseType().toUpperCase()) {
             case "MYSQL":
                 SQL += SQL_START;
-                for (int i = 0; vo.getSearchFieldList().size() > i; i++) {
-                    SQL += SQL_MIDDLE.replace("#{VAL}", vo.getSearchFieldList().get(i));
-                    SQL += vo.getSearchFieldList().size() - 1 == i ? ")" : ",\n";
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += SQL_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                    SQL += searchFieldList.size() - 1 == i ? ")" : ",\n";
                 }
                 break;
             case "DM":
             case "SQLSERVER":
                 SQL += SQL_START;
-                for (int i = 0; vo.getSearchFieldList().size() > i; i++) {
-                    SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", vo.getSearchFieldList().get(i));
-                    SQL += vo.getSearchFieldList().size() - 1 == i ? ",'')" : ",\n";
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                    SQL += searchFieldList.size() - 1 == i ? ",'')" : ",\n";
                 }
                 break;
             case "ORACLE":
-                for (int i = 0; vo.getSearchFieldList().size() > i; i++) {
-                    SQL += vo.getSearchFieldList().get(i);
-                    SQL += (vo.getSearchFieldList().size() - 1 == i ? " " : "||");
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += searchFieldList.get(i);
+                    SQL += (searchFieldList.size() - 1 == i ? " " : "||");
                 }
                 break;
         }
@@ -144,27 +151,33 @@ public class DragTableStatisticServiceImpl implements IDragTableStatisticService
     @Transactional
     public void updateDragTableStatistic(DragTableVo vo) {
         // 拼接sql查询条件
+        List<String> searchFieldList = new ArrayList<>();
+        vo.getSearchFieldList().forEach(item -> {
+            if (item.getConditionType().equals("SuperQuery")) {  // 当前表格的查询条件是超级查询
+                searchFieldList.add(item.getConditionField());
+            }
+        });
         String SQL = "";
         switch (SecurityUtils.getDatabaseType().toUpperCase()) {
             case "MYSQL":
                 SQL += SQL_START;
-                for (int i = 0; vo.getSearchFieldList().size() > i; i++) {
-                    SQL += SQL_MIDDLE.replace("#{VAL}", vo.getSearchFieldList().get(i));
-                    SQL += vo.getSearchFieldList().size() - 1 == i ? ")" : ",\n";
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += SQL_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                    SQL += searchFieldList.size() - 1 == i ? ")" : ",\n";
                 }
                 break;
             case "DM":
             case "SQLSERVER":
                 SQL += SQL_START;
-                for (int i = 0; vo.getSearchFieldList().size() > i; i++) {
-                    SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", vo.getSearchFieldList().get(i));
-                    SQL += vo.getSearchFieldList().size() - 1 == i ? ",'')" : ",\n";
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += SQL_DM_SERVER_MIDDLE.replace("#{VAL}", searchFieldList.get(i));
+                    SQL += searchFieldList.size() - 1 == i ? ",'')" : ",\n";
                 }
                 break;
             case "ORACLE":
-                for (int i = 0; vo.getSearchFieldList().size() > i; i++) {
-                    SQL += vo.getSearchFieldList().get(i);
-                    SQL += (vo.getSearchFieldList().size() - 1 == i ? " " : "||");
+                for (int i = 0; searchFieldList.size() > i; i++) {
+                    SQL += searchFieldList.get(i);
+                    SQL += (searchFieldList.size() - 1 == i ? " " : "||");
                 }
                 break;
         }

+ 54 - 2
zkqy-system/src/main/resources/mapper/dragmapper/DragTableConditionMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zkqy.system.mapper.DragTableConditionMapper">
-    
+
     <resultMap type="com.zkqy.system.entity.DragTableCondition" id="DragTableConditionResult">
         <result property="tcId"    column="tc_id"    />
         <result property="tId"    column="t_id"    />
@@ -15,15 +15,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="sort"    column="sort"    />
         <result property="conditionTableName"    column="condition_table_name"    />
         <result property="conditionTableFieldName"    column="condition_table_field_name"    />
-        <result property="conditionTableFieldKey" column="condition_table_field_key"/>
+        <result property="conditionTableFieldKey"    column="condition_table_field_key"    />
         <result property="conditionDatasource"    column="condition_datasource"    />
         <result property="componentType"    column="component_type"    />
         <result property="componentSize"    column="component_size"    />
         <result property="componentIcon"    column="component_icon"    />
         <result property="isHidden"    column="is_hidden"    />
         <result property="delFlag"    column="del_flag"    />
+        <result property="createById"    column="create_by_id"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
+        <result property="updateById"    column="update_by_id"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
     </resultMap>
@@ -48,6 +50,56 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
         </where>
     </select>
+
+    <insert id="insertDragTableConditionOne" parameterType="com.zkqy.system.entity.DragTableCondition" useGeneratedKeys="true" keyProperty="tcId">insert into drag_table_condition
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="tId != null">t_id,</if>
+            <if test="conditionName != null">condition_name,</if>
+            <if test="conditionField != null">condition_field,</if>
+            <if test="conditionNotes != null">condition_notes,</if>
+            <if test="conditionType != null">condition_type,</if>
+            <if test="conditionDefaultValue != null">condition_default_value,</if>
+            <if test="sort != null">sort,</if>
+            <if test="conditionTableName != null">condition_table_name,</if>
+            <if test="conditionTableFieldName != null">condition_table_field_name,</if>
+            <if test="conditionTableFieldKey != null">condition_table_field_key,</if>
+            <if test="conditionDatasource != null">condition_datasource,</if>
+            <if test="componentType != null">component_type,</if>
+            <if test="componentSize != null">component_size,</if>
+            <if test="componentIcon != null">component_icon,</if>
+            <if test="isHidden != null">is_hidden,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="createById != null">create_by_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateById != null">update_by_id,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="tId != null">#{tId},</if>
+            <if test="conditionName != null">#{conditionName},</if>
+            <if test="conditionField != null">#{conditionField},</if>
+            <if test="conditionNotes != null">#{conditionNotes},</if>
+            <if test="conditionType != null">#{conditionType},</if>
+            <if test="conditionDefaultValue != null">#{conditionDefaultValue},</if>
+            <if test="sort != null">#{sort},</if>
+            <if test="conditionTableName != null">#{conditionTableName},</if>
+            <if test="conditionTableFieldName != null">#{conditionTableFieldName},</if>
+            <if test="conditionTableFieldKey != null">#{conditionTableFieldKey},</if>
+            <if test="conditionDatasource != null">#{conditionDatasource},</if>
+            <if test="componentType != null">#{componentType},</if>
+            <if test="componentSize != null">#{componentSize},</if>
+            <if test="componentIcon != null">#{componentIcon},</if>
+            <if test="isHidden != null">#{isHidden},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createById != null">#{createById},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateById != null">#{updateById},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim></insert>
         
     <insert id="insertDragTableCondition">
         insert into drag_table_condition