Skip to content

Commit d70f35d

Browse files
committed
ExampleWrapper 添加分页方法
1 parent 7171f41 commit d70f35d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

mapper/src/main/java/io/mybatis/mapper/example/ExampleWrapper.java

+13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.mybatis.common.util.Assert;
2020
import io.mybatis.mapper.BaseMapper;
2121
import io.mybatis.mapper.fn.Fn;
22+
import org.apache.ibatis.cursor.Cursor;
2223
import org.apache.ibatis.exceptions.TooManyResultsException;
2324
import org.apache.ibatis.session.RowBounds;
2425

@@ -901,6 +902,18 @@ public List<T> list() {
901902
return baseMapper.selectByExample(example);
902903
}
903904

905+
public List<T> page(int pageNum, int pageSize) {
906+
return baseMapper.selectByExample(example, new RowBounds((pageNum - 1) * pageSize, pageSize));
907+
}
908+
909+
public List<T> offset(int offset, int limit) {
910+
return baseMapper.selectByExample(example, new RowBounds(offset, limit));
911+
}
912+
913+
public Cursor<T> cursor() {
914+
return baseMapper.selectCursorByExample(example);
915+
}
916+
904917
/**
905918
* 根据当前查询条件查询,返回 Stream
906919
*/

0 commit comments

Comments
 (0)