有两种方法可以实现
1.第一种将log-impl 配置到原有的mybatis-plus的configuration下(格式为yml的规范),该方法会将sql语句和查询的结果都打印到控制台
mybatis-plus:
configuration:
# 是否将sql打印到控制面板(该配置会将sql语句和查询的结果都打印到控制台)
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
2.第二种为只打印sql语句和入参数据的配置
2.1 yml规范的写法(其中 cn:shangze:boot:modules:oa:mapper为MyBatis接口 interface包的路径)
# 日志
logging:
level:
com:
code:
model:
mapper: debug
file:
name: logs/tail.log
2.2 如果使用application.properties 规范的写法为
loggoing.level.cn.shangze.boot.modules.oa.mapper=debug #其中 cn.shangze.boot.modules.oa.mapper为MyBatis接口interface包的路径