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 judging integer by if of mybatis

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

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to solve the mybatis if judgment integer problem", the content is easy to understand, clear, hope to help you solve the doubt, the following let the editor lead you to study and learn "how to solve the mybatis if judgment integer problem" this article.

The problem of if judging integer

Yesterday I encountered a small problem when using mybatis's if to judge integer:

I found that when my colleague called the interface in the previous paragraph, the parameter was always unable to enter the condition.

It turns out that the if of mybatis regards 0 as'', so it is impossible to enter the condition in this way, just change the number to 1 and 2 and so on.

If judges the attention points of integer types

It is judged that the integer type parameter is not empty when writing a mapper file today, as follows

SQL .

When status=0, the if statement is not executed.

The reason is that mybatis defaults to equating the parameter of integer=0 to an empty string.

The above is all the contents of this article entitled "how to solve the if judgment integer problem of mybatis". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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