Get the App
SLTechnology News&Howtos  ›  Development  › 

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

Shulou Source: shulou.com Published: 2022-06-02 02:53:39 09月16日 Update

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.

Tags: Types problems constants methods data maximum minimum binary initial parameters more maximum knowledge articles complements utility two digits examples variables Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Microsoft Docker Apple MariaDB