Преглед на файлове

接口文档分页接口增加响应参数明细

wangwl преди 2 месеца
родител
ревизия
fb985a4d65

+ 2 - 2
ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java

@@ -80,9 +80,9 @@ public class BaseController
      * 响应请求分页数据
      */
     @SuppressWarnings({ "rawtypes", "unchecked" })
-    protected TableDataInfo getDataTable(List<?> list)
+    protected <T> TableDataInfo<T> getDataTable(List<T> list)
     {
-        TableDataInfo rspData = new TableDataInfo();
+        TableDataInfo<T> rspData = new TableDataInfo();
         rspData.setCode(HttpStatus.SUCCESS);
         rspData.setMsg("查询成功");
         rspData.setRows(list);

+ 8 - 23
ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java

@@ -1,5 +1,8 @@
 package com.ruoyi.common.core.page;
 
+import lombok.Data;
+import lombok.Setter;
+
 import java.io.Serializable;
 import java.util.List;
 
@@ -8,7 +11,8 @@ import java.util.List;
  * 
  * @author ruoyi
  */
-public class TableDataInfo implements Serializable
+@Data
+public class TableDataInfo<T> implements Serializable
 {
     private static final long serialVersionUID = 1L;
 
@@ -16,7 +20,7 @@ public class TableDataInfo implements Serializable
     private long total;
 
     /** 列表数据 */
-    private List<?> rows;
+    private List<T> rows;
 
     /** 消息状态码 */
     private int code;
@@ -37,7 +41,7 @@ public class TableDataInfo implements Serializable
      * @param list 列表数据
      * @param total 总记录数
      */
-    public TableDataInfo(List<?> list, int total)
+    public TableDataInfo(List<T> list, int total)
     {
         this.rows = list;
         this.total = total;
@@ -48,38 +52,19 @@ public class TableDataInfo implements Serializable
         return total;
     }
 
-    public void setTotal(long total)
-    {
-        this.total = total;
-    }
-
-    public List<?> getRows()
+    public List<T> getRows()
     {
         return rows;
     }
 
-    public void setRows(List<?> rows)
-    {
-        this.rows = rows;
-    }
-
     public int getCode()
     {
         return code;
     }
 
-    public void setCode(int code)
-    {
-        this.code = code;
-    }
-
     public String getMsg()
     {
         return msg;
     }
 
-    public void setMsg(String msg)
-    {
-        this.msg = msg;
-    }
 }