idea输出sql语句的几种方法

目录

方法一

1、MyBatis Log Free插件

1.1、添加MyBatis Log栏

1.2、配置文件:

1.2.1 properties版本

1.2.2 .yml版本:

1.2.3 logback.xml

1.3、此时控制台和MyBatis Log栏都可以输出sql语句

方法二

2、springboot+mybatis-plus

2.1 配置xml文件

2.2 配置.yml文件

 2.3、此时控制台和MyBatis Log栏都可以输出sql语句


方法一

1、MyBatis Log Free插件

MyBatis Log Plugin在IDEA 升级到 2020.2 版本之后开始收费了,推荐使用"MyBatis Log Free","MyBatis Log Free"打印的SQL是小写且格式化过的。

1.1、添加MyBatis Log栏

idea底部会出现MyBatis Log栏

1.2、配置文件:


1.2.1 properties版本:

mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

1.2.2 .yml版本:
mybatis:
    configuration:
      log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
 
mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    

1.2.3 logback.xml
    <logger name="com.xx.mapper" level="DEBUG" />

1.3、此时控制台和MyBatis Log栏都可以输出sql语句:

方法二

2、springboot+mybatis-plus

2.1 配置xml文件

  <dependency>
       <groupId>com.baomidou</groupId>
       <artifactId>mybatis-plus-boot-starter</artifactId>
       <version>3.3.1</version>
  </dependency>

2.2 配置.yml文件

mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

 2.3、此时控制台和MyBatis Log栏都可以输出sql语句:

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值