知识点:
1.将前端easyui -datagrid展示所需要数据的进行封装.
mybaitis分页插件+springmvc+eazyuidatagrid 分页功能实现
package com.example.demo.service; import com.example.demo.bean.EUDataGridResult; import com.example.demo.FilterBean.FilterConditions; import com.example.demo.bean.MetShopv2Order; import com.example.demo.bean.OrderInfo; import com.example.demo.mapper.MetShopv2OrderMapper; import com.example.demo.mapper.OrderInfoMapper; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class GoodsService { @Autowired MetShopv2OrderMapper metShopv2OrderMapper; @Autowired OrderInfoMapper orderInfoMapper; /** * * @param mr * @return */ public Integer change_orderid(MetShopv2Order mr){ System.out.println("GoodsService.change_orderid is start.."); return metShopv2OrderMapper.updateByPrimaryKeySelective(mr); } /** * 根据筛选条件获取数据库中数据 * @param page 当前页 * @param rows 每页展示数量 * @param filterConditions 筛选条件 * @return 包含了总条目数和数据集合 */ public EUDataGridResult getList(Integer page,Integer rows,FilterConditions filterConditions){ System.out.println("筛选条件:"+filterConditions); System.out.println("筛选数据:"+orderInfoMapper.getListByCondition(filterConditions)); System.out.println("GoodsService getList is start"); EUDataGridResult euDataGridResult = new EUDataGridResult(); System.out.println("翻页前"); PageHelper.startPage(page,rows);//设置翻页 System.out.println("翻页后"); List<OrderInfo> orders = orderInfoMapper.getListByCondition(filterConditions); System.out.println("数据:"+orders); euDataGridResult.setRows(orders); PageInfo<OrderInfo> p=new PageInfo<>(orders); System.out.println("PageInfo:"+p); euDataGridResult.setTotal(p.getTotal()); System.out.println(euDataGridResult.toString()); return euDataGridResult; } }