Mybatis分页插件:Mybatis-paging
jopen
11年前
Mybatis-paging一个Mybatis3分页插件,采用Mybatis Plugins机制,结合数据库特有分页语法,为前端分页展示提供数据支持。目前只提供了Oracle、MySQL实现,对于其他数据库,你可以通过实现 com.github.loafer.mybatis.pagination.dialect.Dialect子类的方式来扩展。
package com.github.loafer.mybatis.pagination; import com.github.loafer.mybatis.pagination.model.DataPaging; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Date Created 2014-2-17 * * @author loafer[zjh527@gmail.com] * @version 1.0 */ @Component public class UserService { @Autowired private IRepository repository; public List listing(){ return repository.selectList("com.github.loafer.mybaits.mappers.UserMapper.selectUser", null); } public DataPaging paging(Object parameterObject){ Map<String, Object> parameter = new HashMap<String, Object>(); parameter.put("orgna_id", parameterObject); return repository.selectPaging("com.github.loafer.mybaits.mappers.UserMapper.selectPaging", parameter, 0, 10); } }