xuezizhuo пре 2 година
родитељ
комит
7955aced38

+ 14 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/CommonController.java

@@ -13,6 +13,7 @@ import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.system.entity.CommonEntity;
 import com.ruoyi.system.entity.TableSql;
 import com.ruoyi.system.service.ICommonService;
+import com.ruoyi.system.service.IDragTableService;
 import com.ruoyi.system.service.ITableSqlService;
 import dm.jdbc.filter.stat.util.JSONUtils;
 import org.springframework.web.bind.annotation.*;
@@ -35,6 +36,9 @@ public class CommonController extends BaseController {
     @Resource
     private ITableSqlService iTableSqlService;
 
+    @Resource
+    private IDragTableService dragTableService;
+
     /**
      * 共通查询
      */
@@ -107,4 +111,14 @@ public class CommonController extends BaseController {
         commonService.exportTemplate(response, tableName, sqlKey);
     }
 
+    /**
+     * 通用动态表单详情
+     * @param sqlKey
+     * @return
+     */
+    @GetMapping("/dragTableInfo")
+    public AjaxResult dragTableInfo(@RequestParam String sqlKey){
+        return AjaxResult.success(dragTableService.dragTableInfo(sqlKey));
+    }
+
 }

+ 14 - 6
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableConditionMapper.java

@@ -18,7 +18,7 @@ public interface DragTableConditionMapper
      * @param tcId 动态格条件主键
      * @return 动态格条件
      */
-    public DragTableCondition selectDragTableConditionByTcId(Long tcId);
+    DragTableCondition selectDragTableConditionByTcId(Long tcId);
 
     /**
      * 查询动态格条件列表
@@ -26,7 +26,7 @@ public interface DragTableConditionMapper
      * @param dragTableCondition 动态格条件
      * @return 动态格条件集合
      */
-    public List<DragTableCondition> selectDragTableConditionList(DragTableCondition dragTableCondition);
+    List<DragTableCondition> selectDragTableConditionList(DragTableCondition dragTableCondition);
 
     /**
      * 新增动态格条件
@@ -34,7 +34,7 @@ public interface DragTableConditionMapper
      * @param dragTableCondition 动态格条件
      * @return 结果
      */
-    public int insertDragTableCondition(DragTableCondition dragTableCondition);
+    int insertDragTableCondition(DragTableCondition dragTableCondition);
 
     /**
      * 修改动态格条件
@@ -42,7 +42,7 @@ public interface DragTableConditionMapper
      * @param dragTableCondition 动态格条件
      * @return 结果
      */
-    public int updateDragTableCondition(DragTableCondition dragTableCondition);
+    int updateDragTableCondition(DragTableCondition dragTableCondition);
 
     /**
      * 删除动态格条件
@@ -50,7 +50,7 @@ public interface DragTableConditionMapper
      * @param tcId 动态格条件主键
      * @return 结果
      */
-    public int deleteDragTableConditionByTcId(Long tcId);
+    int deleteDragTableConditionByTcId(Long tcId);
 
     /**
      * 批量删除动态格条件
@@ -58,5 +58,13 @@ public interface DragTableConditionMapper
      * @param tcIds 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteDragTableConditionByTcIds(Long[] tcIds);
+    int deleteDragTableConditionByTcIds(Long[] tcIds);
+
+    /**
+     * 查询动态格条件
+     *
+     * @param tId 动态格条件主键
+     * @return 动态格条件
+     */
+    List<DragTableCondition> selectDragTableConditionByTid(Long tId);
 }

+ 14 - 6
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableMapper.java

@@ -18,7 +18,7 @@ public interface DragTableMapper
      * @param tId 动态格主键
      * @return 动态格
      */
-    public DragTable selectDragTableByTId(Long tId);
+    DragTable selectDragTableByTId(Long tId);
 
     /**
      * 查询动态格列表
@@ -26,7 +26,7 @@ public interface DragTableMapper
      * @param dragTable 动态格
      * @return 动态格集合
      */
-    public List<DragTable> selectDragTableList(DragTable dragTable);
+    List<DragTable> selectDragTableList(DragTable dragTable);
 
     /**
      * 新增动态格
@@ -34,7 +34,7 @@ public interface DragTableMapper
      * @param dragTable 动态格
      * @return 结果
      */
-    public int insertDragTable(DragTable dragTable);
+    int insertDragTable(DragTable dragTable);
 
     /**
      * 修改动态格
@@ -42,7 +42,7 @@ public interface DragTableMapper
      * @param dragTable 动态格
      * @return 结果
      */
-    public int updateDragTable(DragTable dragTable);
+    int updateDragTable(DragTable dragTable);
 
     /**
      * 删除动态格
@@ -50,7 +50,7 @@ public interface DragTableMapper
      * @param tId 动态格主键
      * @return 结果
      */
-    public int deleteDragTableByTId(Long tId);
+    int deleteDragTableByTId(Long tId);
 
     /**
      * 批量删除动态格
@@ -58,5 +58,13 @@ public interface DragTableMapper
      * @param tIds 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteDragTableByTIds(Long[] tIds);
+    int deleteDragTableByTIds(Long[] tIds);
+
+    /**
+     * 查询动态格
+     *
+     * @param sqlKey 唯一标识
+     * @return 动态格
+     */
+    DragTable selectDragTableBySqlKey(String sqlKey);
 }

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

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service;
 
+import com.ruoyi.system.entity.CommonEntity;
 import com.ruoyi.system.entity.DragTable;
 
 import java.util.List;
@@ -59,4 +60,12 @@ public interface IDragTableService
      * @return 结果
      */
     public int deleteDragTableByTId(Long tId);
+
+    /**
+     * 查询动态格
+     *
+     * @param sqlKey 唯一标识
+     * @return 动态格
+     */
+    CommonEntity dragTableInfo(String sqlKey);
 }

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

@@ -1,13 +1,23 @@
 package com.ruoyi.system.service.impl;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.entity.CommonEntity;
 import com.ruoyi.system.entity.DragTable;
+import com.ruoyi.system.entity.DragTableCondition;
+import com.ruoyi.system.entity.TableSql;
+import com.ruoyi.system.mapper.DragTableConditionMapper;
+import com.ruoyi.system.mapper.TableSqlMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ruoyi.system.mapper.DragTableMapper;
 import com.ruoyi.system.service.IDragTableService;
 
+import javax.annotation.Resource;
+
 /**
  * 动态格Service业务层处理
  * 
@@ -20,6 +30,12 @@ public class DragTableServiceImpl implements IDragTableService
     @Autowired
     private DragTableMapper dragTableMapper;
 
+    @Resource
+    private DragTableConditionMapper dragTableConditionMapper;
+
+    @Resource
+    private TableSqlMapper tableSqlMapper;
+
     /**
      * 查询动态格
      * 
@@ -93,4 +109,16 @@ public class DragTableServiceImpl implements IDragTableService
     {
         return dragTableMapper.deleteDragTableByTId(tId);
     }
+
+    @Override
+    public CommonEntity dragTableInfo(String sqlKey) {
+        DragTable dragTable = dragTableMapper.selectDragTableBySqlKey(sqlKey);
+        Map<String,Object> resultMap = new HashMap<>();
+        resultMap.put("template",dragTable);
+        resultMap.put("where",dragTableConditionMapper.selectDragTableConditionByTid(dragTable.gettId()));
+        resultMap.put("querySql",tableSqlMapper.selectTableSqlByTSqlKey(sqlKey));
+        CommonEntity commonEntity = new CommonEntity();
+        commonEntity.setResultMap(resultMap);
+        return commonEntity;
+    }
 }

+ 5 - 0
ruoyi-system/src/main/resources/mapper/dragmapper/DragTableConditionMapper.xml

@@ -108,4 +108,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{tcId}
         </foreach>
     </delete>
+
+    <select id="selectDragTableConditionByTid" resultMap="DragTableConditionResult">
+        <include refid="selectDragTableConditionVo"/>
+        where t_id = #{tId}
+    </select>
 </mapper>

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

@@ -113,4 +113,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{tId}
         </foreach>
     </delete>
+
+    <select id="selectDragTableBySqlKey" parameterType="String" resultMap="DragTableResult">
+        <include refid="selectDragTableVo"/>
+        where sql_key = #{sqlKey}
+    </select>
 </mapper>