使用querywrapper的时候,考虑到要查看自己的条件查询的sql语句是否正确的。可以在application.yml文件中插入下方内容用以在控制台展示内容。
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
展示结果如下文:
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4a570909] was not registered for synchronization because synchronization is not active
JDBC Connection [HikariProxyConnection@1858296022 wrapping com.mysql.cj.jdbc.ConnectionImpl@14745fea] will not be managed by Spring
==> Preparing: SELECT COUNT(*) AS total FROM station_state WHERE (peripheral_id = ?)
==> Parameters: 1(Integer)
<== Columns: total
<== Row: 2
<== Total: 1