一、Springboot整合mybatisPlus配置日志
#配置mybatisPlus日志 mybatis-plus: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
二、测试demo与效果
这里以分页测试:
/*测试分页插件*/ @Test void page(){ //参数: //current – 当前页 //size – 每页显示条数 Page<UserDO> page = new Page<>(1, 5); Page<UserDO> userDOPage = ud.selectPage(page, null); System.out.println(userDOPage); List<UserDO> records = page.getRecords(); records.forEach(userDO -> System.out.println(userDO)); System.out.println("当前页:"+page.getCurrent()); System.out.println("每页显示的条数:"+page.getSize()); System.out.println("总记录数:"+page.getTotal()); System.out.println("总页数:"+page.getPages()); System.out.println("是否有上一页:"+page.hasPrevious()); System.out.println("是否有下一页:"+page.hasNext()); }
结果如下:
JDBC Connection [com.mysql.jdbc.JDBC4Connection@1d06f16f] will not be managed by Spring ==> Preparing: SELECT COUNT(*) FROM user ==> Parameters: <== Columns: COUNT(*) <== Row: 22 <== Total: 1 ==> Preparing: SELECT id,name,sex,password,status FROM user LIMIT ? ==> Parameters: 5(Long) <== Columns: id, name, sex, password, status <== Row: 1, 小, 男, 123, 1 <== Row: 2, 名, 女, 123, 0 <== Row: 3, 个, 男, 123, 1 <== Row: 4, xiao, 女, 5555, 0 <== Row: 6, 小, 女, 778999897, 0 <== Total: 5
标签:MybatisPlus,配置文件,System,Page,SQL,println,日志,page,out From: https://www.cnblogs.com/Life-QX/p/17208682.html