mybatis-plus 的流式查询怎么实现呢
mybatis-plus 的流式查询怎么实现呢
mybatis-plus 的流式查询怎么实现呢
2019-11-07
public interface Level1Mapper extends BaseMapper<Level1> {
@Select("select * from a_level1 limit #{limit}")
Cursor<Level1> scan(@Param("limit") int limit);
}@GetMapping("/level1s_cursor/{limit}")
@Transactional(readOnly = true)
public void level1sCursor(@PathVariable("limit") int limit) throws IOException {
try (Cursor<Level1> cursor = level1Mapper.scan(limit)){
cursor.forEach(i->log.debug(JSON.toJSONString(i)));
}
}mybaits 流式查询已经很简洁了
举报