SpringBoot學習筆記14——MybatisPlus模糊查詢、輸出執行sql
阿新 • • 發佈:2018-11-12
1.MybatisPlus的模糊查詢
MybatisPlus的模糊查詢非常簡單,只需要進行簡單的配置即可。
配置如下:
#預設查詢時進行模糊查詢
mybatis-plus.global-config.db-config.column-like=true
2.在控制檯輸出執行的sql語句
輸出sql有兩種方式
方法一:
首先需要配置一個config的路徑
mybatis-plus.config-location: classpath:mybatis-config.xml
然後再xml檔案中進行如下配置:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!--輸出執行sql--> <settings> <setting name="logImpl" value="STDOUT_LOGGING"/> </settings> </configuration>
方法二:
在properties檔案中新增如下配置。
#顯示sql
logging.level.com.youyou=DEBUG