spring boot打印sql语句-mybatis

spring boot打印sql语句-mybatis

spring boot打印sql语句-mybatis

spring boot打印sql语句-mybatis

转载自:个人有趣住在无趣里java

概述spring

当本身编写的程序出现了BUG等等,找了好久sql

调试运行了几遍到mapper层也进去调试进了源码,很是麻烦springboot

我就想打印出sql语句,好进行解决BUGmybatis

方法:app

能够在你的application.properties文件里添加代码ide

logging.level.com.shop=debug
# logging.level.接着就是你须要打印sql语句的包=debug
# 好比个人包是com.shop

打印出的sql语句是这样的debug

: ==>  Preparing: select id, merchantid, shopName, shopDescription, shopBussinessScope, province, city, businessLicense, createTime, `state` from youfanshop where 1=1 and `state`=? 
     : ==> Parameters: 0(Integer)
     : <==      Total: 2
    /**
      *看的出打印的
      *第一行是咱们的sql语句
      *第二行就是咱们的参数
      *第三行就咱们返回的行数
      */

若是你想得到更多java、Spring、Web应用开发精品文章,请访问:字母哥博客-zimug.com

相关文章
相关标签/搜索