bootStrap-table前端表格接收数据格式后台实现

(1)controller

    @RequestMapping("/findData")
    @ResponseBody
    public Object findPhoneList(String startDate,String endDate,String phone,Integer pageIndex,Integer rows){

        System.out.println(startDate+"||"+endDate+"||"+phone+"||"+pageIndex+"||"+rows);
        PageInfo phoneList = cdrVoiceService.findPhoneListService(startDate, endDate, phone, pageIndex, rows);
        return phoneList;
    }

(2)service

public PageInfo findPhoneListService(String startDate,String endDate,String phone,Integer pageIndex,Integer rows){
        Integer min = (pageIndex - 1) * rows;
        Integer max = pageIndex * rows;
        startDate=startDate!=""&&startDate!=null ?startDate+" 00:00:00":startDate;
        endDate=endDate!=""&&endDate!=null?endDate+" 23:59:59":endDate;
        int count = fraudCdrDao.countData(startDate, endDate, phone);

        List phoneInfos=new ArrayList<>();
        if(count>0){
            phoneInfos = fraudCdrDao.listData(startDate, endDate, phone, max, min);
        }
        PageInfo pageInfo = new PageInfo();
        pageInfo.setRows(phoneInfos);
        pageInfo.setTotal(count);

        return pageInfo;
    }

(3)dao

    @Select(" ")
    int countData(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("phone") String phone);

    @Select(" ")
    List listData(@Param("startDate") String startDate,@Param("endDate") String endDate,@Param("phone") String phone,@Param("max") Integer max,@Param("min") Integer min);

(4)PageInfo类:

import java.io.Serializable;
import java.util.List;

public class PageInfo implements Serializable {
    private Integer total;

    private List rows;

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public List getRows() {
        return rows;
    }

    public void setRows(List rows) {
        this.rows = rows;
    }
}

(5)分页sql理论依据:

bootStrap-table前端表格接收数据格式后台实现_第1张图片

你可能感兴趣的:(javaWeb)