优化Feign查询列表接口返回值,返回指定类型,不需要通过map获取列表数据

Signed-off-by: 云飞扬 <15678871232@qq.com>
pull/256/head
云飞扬 3 years ago committed by Gitee
parent e03cebac57
commit ca6e23ef0b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -60,9 +60,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.setRows(list);
rspData.setMsg("查询成功");

@ -8,7 +8,7 @@ import java.util.List;
*
* @author ruoyi
*/
public class TableDataInfo implements Serializable
public class TableDataInfo<T> implements Serializable
{
private static final long serialVersionUID = 1L;
@ -16,7 +16,7 @@ public class TableDataInfo implements Serializable
private long total;
/** 列表数据 */
private List<?> rows;
private List<T> rows;
/** 消息状态码 */
private int code;
@ -37,7 +37,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;
@ -53,12 +53,12 @@ public class TableDataInfo implements Serializable
this.total = total;
}
public List<?> getRows()
public List<T> getRows()
{
return rows;
}
public void setRows(List<?> rows)
public void setRows(List<T> rows)
{
this.rows = rows;
}

Loading…
Cancel
Save