Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of printing sql statements in mybatis-plus

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "how to solve the problem of printing sql statements in mybatis-plus". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

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

Use the above configuration in the configuration file or configuration center.

After using the above configuration, the printed statement will be very detailed, including the sql statement, the dataset of the execution result, the number of data results, etc., which will be easier to use during debugging, but if there are more results after the statement execution, then the number of logs will explode in the console, so I prefer the second way.

The second way: logging: level: com: * *: * *: dao: debug

Note: com.***.***.dao is the mapper scan file of the corresponding project, which may be dao or mapper, depending on the specific situation of the project.

Use the above configuration in the configuration file or configuration center.

After using the above configuration, the sql statement will be printed after the execution of the relevant program. The number of result datasets returned after the statement execution will not return a specific result set. This configuration is usually fine when used.

Add: the mybatisPlus configuration console prints sql statements

1. The configuration file is in application.yml format

# mybatis-plus configuration console prints complete SQL statement with parameters mybatis-plus: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

2. The configuration file is in application.properties format

# mybatis-plus configuration console prints a complete SQL statement with parameters mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl "how to solve the problem of printing sql statements in mybatis-plus". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report