Browse Source

feat: 修改动态表格标识sqlkey-》tableKey

韩帛霖 1 year ago
parent
commit
c0fb5573e6

+ 12 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/CommonController.java

@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.exception.tenantdatassource.TenantDataSource;
 import com.ruoyi.system.entity.CommonEntity;
+import com.ruoyi.system.entity.DragTable;
 import com.ruoyi.system.entity.TableSql;
 import com.ruoyi.system.service.ICommonService;
 import com.ruoyi.system.service.IDragTableService;
@@ -13,6 +14,8 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+import java.util.HashMap;
+import java.util.Map;
 
 @RestController
 @RequestMapping("/dragform/common")
@@ -21,10 +24,10 @@ public class CommonController extends BaseController {
     @Resource
     private ICommonService commonService;
 
-    @Resource
+    @Resource  // 动态sql
     private ITableSqlService iTableSqlService;
 
-    @Resource
+    @Resource // 动态表格
     private IDragTableService dragTableService;
 
     /**
@@ -68,15 +71,19 @@ public class CommonController extends BaseController {
      */
     @GetMapping("/getTableList")
     public TableDataInfo queryTableList(CommonEntity commonEntity) throws TenantDataSource {
-
-        TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(commonEntity.getQueryMap().get("sqlkey").toString());
+        DragTable dragTable = new DragTable();
+        dragTable.setTableKey(commonEntity.getQueryMap().get("tableKey").toString());
+        String sqlKey = dragTableService.selectDragTableList(dragTable).get(0).getSqlKey();
+        TableSql tableSql = iTableSqlService.selectTableSqlByTSqlKey(sqlKey);
         startPage();  // 校验是否sqlserver 否执行 是执行另一种方式的分页
+        Map<String, Object> map = new HashMap<>();
+        map.put("sqlkey", sqlKey);
+        commonEntity.setQueryMap(map);
         return getDataTable(commonService.queryTableList(commonEntity, tableSql));
 
     }
 
 
-
     /**
      * 通用动态表单详情
      */

+ 1 - 2
ruoyi-system/src/main/resources/mapper/common/SysDictTypeMapper.xml

@@ -16,8 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</resultMap>
 	
 	<sql id="selectDictTypeVo">
-        select dict_id, dict_name, dict_type, status, create_by, create_time, remark 
-		from sys_dict_type
+        select dict_id, dict_name, dict_type, status, create_by, create_time, remark from sys_dict_type
     </sql>
 
 	<select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">