mybatis分页查询

来源:互联网 发布:js删除指定class的div 编辑:程序博客网 时间:2024/06/07 05:49

页面:   

<div class="zxf_pagediv"></div>

<span id="total" style="color: red;">{{total}}</span>

function initPage(){
    $(".zxf_pagediv").createPage({
        pageNum :Math.ceil(parseInt($("#total").text())/parseInt($("#size option:selected").val())) ,//总页码initPage//"#size option:selected"每页显示条数
        current :1,//当前页
        shownum :20,//每页显示个数
        //            activepage: "",//当前页选中样式S
        //            activepaf: "",//下一页选中样式
        backfun : function(e) {
            query["pageNum"] = e.current;
            fun(query);
        }
    });   
}

在查询之后调用一下函数就好了
function FindQuarys(){
    query = {};
    query["pageSize"] = 15;
    query["pageNum"] = 1;
    
    FindDatumcus(query)
    initPage()//分页
}

    @CrossOrigin
    @ResponseBody
    @RequestMapping("/list2/{pageNum}/{pageSize}")
    public PageInfo<FyCustomerAndIntentionaddr> getAllFyCustomer(@PathVariable Integer pageNum,@PathVariable Integer pageSize) throws Exception{
        return fyCustomerService.getAllFyCustomerAndIntentionaddr(pageNum, pageSize);
    }
    
   
    @Override
    public PageInfo<FyCustomerAndIntentionaddr> getAllFyCustomerAndIntentionaddr(int pageNum, int PageSize)
            throws Exception {
        PageHelper.startPage(pageNum, PageSize);
        List<FyCustomerAndIntentionaddr> list = fyCustomerMapper.FindFycustomerandintentionaddr();
        PageInfo<FyCustomerAndIntentionaddr> page = new PageInfo<FyCustomerAndIntentionaddr>(list);
        return page;
    }