mirror of https://gitee.com/y_project/RuoYi.git
Pre Merge pull request !518 from 长草颜团子/feature/page-feature
commit
d619775a64
|
@ -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 操作结果
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue