Pre Merge pull request !518 from 长草颜团子/feature/page-feature

pull/518/MERGE
长草颜团子 2025-02-27 02:57:26 +00:00 committed by Gitee
commit d619775a64
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 23 additions and 10 deletions

View File

@ -3,6 +3,7 @@ package com.ruoyi.common.core.controller;
import java.beans.PropertyEditorSupport; import java.beans.PropertyEditorSupport;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.function.Supplier;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
@ -27,7 +28,7 @@ import com.ruoyi.common.utils.sql.SqlUtil;
/** /**
* web * web
* *
* @author ruoyi * @author ruoyi
*/ */
public class BaseController public class BaseController
@ -117,9 +118,21 @@ public class BaseController
return rspData; return rspData;
} }
/**
*
*
* @param supplier
* @return
*/
protected TableDataInfo getDataTableByFunction(Supplier<List<?>> supplier)
{
startPage();
return getDataTable(supplier.get());
}
/** /**
* *
* *
* @param rows * @param rows
* @return * @return
*/ */
@ -130,7 +143,7 @@ public class BaseController
/** /**
* *
* *
* @param result * @param result
* @return * @return
*/ */

View File

@ -5,10 +5,10 @@ import java.util.List;
/** /**
* *
* *
* @author ruoyi * @author ruoyi
*/ */
public class TableDataInfo implements Serializable public class TableDataInfo<T> implements Serializable
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -16,7 +16,7 @@ public class TableDataInfo implements Serializable
private long total; private long total;
/** 列表数据 */ /** 列表数据 */
private List<?> rows; private List<T> rows;
/** 消息状态码 */ /** 消息状态码 */
private int code; private int code;
@ -33,11 +33,11 @@ public class TableDataInfo implements Serializable
/** /**
* *
* *
* @param list * @param list
* @param total * @param total
*/ */
public TableDataInfo(List<?> list, int total) public TableDataInfo(List<T> list, int total)
{ {
this.rows = list; this.rows = list;
this.total = total; this.total = total;
@ -58,7 +58,7 @@ public class TableDataInfo implements Serializable
return rows; return rows;
} }
public void setRows(List<?> rows) public void setRows(List<T> rows)
{ {
this.rows = rows; this.rows = rows;
} }
@ -82,4 +82,4 @@ public class TableDataInfo implements Serializable
{ {
this.msg = msg; this.msg = msg;
} }
} }