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

What is the pit where MybatisPlus LambdaQueryWrapper uses int defaults and what is the solution?

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

Share

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

What this article shares with you is about the pit of MybatisPlus LambdaQueryWrapper using int default values and what the solution is. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Problem phenomenon of LambdaQueryWrapper using int default values

After a meal of operation, I felt that there could not be a problem. After debugging, I found that there were no parameters, and there were two parameters in the log.

Enter the object and find

Solution method

Replace the int type with

Integer Typ

The problem disappears

Analysis of problems

1. Get to know int

Int:

The int data type is a 32-bit, signed integer represented by a binary complement

The minimum value is-2147483648 (- 2 ^ 31)

The maximum is 2147483647 (2 ^ 31-1)

Generally speaking, integer variables default to int type.

The default is 0

Example: int a = 100000, int b =-200000.

2. Learn about the constants of the Integer Integer class

The Integer class contains the following four constants.

MAX_VALUE: a constant with a value of 231-1, which represents the maximum value that the int type can represent.

MIN_VALUE: a constant with a value of-231, which represents the minimum value that the int type can represent.

SIZE: the number of bits used to represent the int value in binary complement.

TYPE: represents a Class instance of the base type int.

Make a brief summary

1. Int is the basic data type, and Integer is the reference data type

2. Ingeter is the wrapper class of int. The initial value of int is 0 and the initial value of Ingeter is null.

Lambdaquerywrapper in uses samples to report errors directly using column names

Here's how to ok

The above is the pit in which MybatisPlus LambdaQueryWrapper uses int defaults and what is the solution. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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