瀏覽代碼

动态表格组数据渲染

侯茂昌 1 年之前
父節點
當前提交
a0bfa08de7

+ 12 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/dragForm/DragTableGroupController.java

@@ -72,6 +72,18 @@ public class DragTableGroupController extends BaseController {
         return success(dragTableGroupService.selectDragTableGroupById(id));
     }
 
+    /**
+     * 获取拖拽格组详细信息
+     */
+    //@PreAuthorize("@ss.hasPermi('system:group:query')")
+    //@GetMapping(value = "/{id}")
+    //@ApiOperation(value = "获取拖拽格组详细信息")
+    //public AjaxResult getInfo(@PathVariable("groupKey") Long groupKey)
+    //{
+    //    return success(dragTableGroupService.selectDragTableGroupById(id));
+    //}
+
+
     /**
      * 新增拖拽格组
      */

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

@@ -21,6 +21,11 @@ public class DragTableGroup extends BaseEntity {
     @Excel(name = "表格组名称")
     private String groupName;
 
+
+    /** 表格组key名称 */
+    @Excel(name = "表格组key")
+    private String groupKey;
+
     /** 表格组描述 */
     @Excel(name = "表格组描述")
     private String groupDescription;
@@ -63,6 +68,14 @@ public class DragTableGroup extends BaseEntity {
         this.groupTableInfo = groupTableInfo;
     }
 
+    public String getGroupKey() {
+        return groupKey;
+    }
+
+    public void setGroupKey(String groupKey) {
+        this.groupKey = groupKey;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

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

@@ -21,6 +21,13 @@ public class DragTableGroupVo extends BaseEntity {
     /** 存放表格联动信息 [{tablekey:kh123,顺序:1},{tablekey:kh123,顺序:2}] */
     private String groupTableInfo;
 
+
+
+    /**
+     * 动态表格key
+     */
+    private  String groupKey;
+
     //动态表格实体类集合
     public List<DragTableVo> dragTables;
 
@@ -64,6 +71,14 @@ public class DragTableGroupVo extends BaseEntity {
         this.dragTables = dragTables;
     }
 
+    public String getGroupKey() {
+        return groupKey;
+    }
+
+    public void setGroupKey(String groupKey) {
+        this.groupKey = groupKey;
+    }
+
     @Override
     public String toString() {
         return "DragTableGroupVo{" +

+ 7 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DragTableGroupMapper.java

@@ -59,4 +59,11 @@ public interface DragTableGroupMapper {
      * @return 结果
      */
     public int deleteDragTableGroupByIds(Long[] ids);
+
+    /**
+     * 通过分组key查询分组的表信息
+     * @param groupKey
+     * @return
+     */
+    public String selectDragTableGroupByGroupKey(String groupKey);
 }

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

@@ -59,4 +59,11 @@ public interface IDragTableGroupService {
      * @return 结果
      */
     public int deleteDragTableGroupById(Long id);
+
+    /**
+     * 根据表格组key查询表格组信息
+     * @param groupKey
+     * @return
+     */
+    public String selectDragTableGroup(String groupKey);
 }

+ 23 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DragTableGroupServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.system.service.impl;
 
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.system.entity.DragTable;
 import com.ruoyi.system.entity.DragTableGroup;
@@ -13,7 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.List;
+import java.util.*;
 
 /**
  * @author hmc
@@ -113,4 +114,25 @@ public class DragTableGroupServiceImpl implements IDragTableGroupService {
     {
         return dragTableGroupMapper.deleteDragTableGroupById(id);
     }
+
+    /**
+     * 根据表格组key查询表格组信息
+     * @param groupKey
+     * @return
+     */
+    @Override
+    public String selectDragTableGroup(String groupKey) {
+        String groupTableInfo = dragTableGroupMapper.selectDragTableGroupByGroupKey(groupKey);
+        //HashMap hashMap = JSONObject.parseObject(groupTableInfo, HashMap.class);
+        ////向 hashMap 中添加键值对
+        //ArrayList<Map.Entry<String, Integer>> list = new ArrayList<Map.Entry<String, Integer>>(hashMap.entrySet());
+        //Collections.sort(list, Comparator.comparing(Map.Entry::getValue));
+        //// 遍历排序后的 ArrayList
+        //HashMap<String,String> sortHashMap=new HashMap();
+        //for (Map.Entry<String, Integer> entry : list) {
+        //    System.out.println(entry.getKey() + ":" + entry.getValue());
+        //    sortHashMap.put(entry.getKey(),entry.getValue().toString());
+        //}
+        return groupTableInfo;
+    }
 }

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

@@ -149,7 +149,6 @@ public class DragTableServiceImpl implements IDragTableService {
         dragTableStyle.setTableKey(dragTable.getTableKey());
         List<DragTableStyle> dragTableStyleList = dragTableStyleMapper.selectDragTableStyleList(dragTableStyle);
         resultMap.put("style",dragTableStyleList);
-
         CommonEntity commonEntity = new CommonEntity();
         commonEntity.setResultMap(resultMap);
         return commonEntity;

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

@@ -37,11 +37,17 @@
         where id = #{id}
     </select>
 
+    <select id="selectDragTableGroupByGroupKey" parameterType="String" resultType="string">
+        select group_table_info from drag_table_group
+        where group_key = #{groupKey}
+    </select>
+
     <insert id="insertDragTableGroup" parameterType="com.ruoyi.system.entity.DragTableGroup">
         insert into drag_table_group
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="id != null">id,</if>
             <if test="groupName != null">group_name,</if>
+            <if test="groupKey!=null">group_key,</if>
             <if test="groupDescription != null">group_description,</if>
             <if test="groupTableInfo != null">group_table_info,</if>
             <if test="createById != null">create_by_id,</if>
@@ -54,6 +60,7 @@
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="id != null">#{id},</if>
             <if test="groupName != null">#{groupName},</if>
+            <if test="groupKey != null">#{groupKey},</if>
             <if test="groupDescription != null">#{groupDescription},</if>
             <if test="groupTableInfo != null">#{groupTableInfo},</if>
             <if test="createById != null">#{createById},</if>