MyBatis will not take effect when passing in a value of 0 when doing a query

In the process of Java development, if you encounter pitfalls, you usually write live SQL by judging whether there are parameters to be passed, so it is inevitable to use mybatis. Recently, when using mybatis, passing 0 is invalid.

There is a requirement, pass 0 to represent type A, pass other numbers to represent type B, pass 1 is valid, pass 0 is invalid, and all data will be found

That's because in mybatis it is automatically judged that Integer is false when it is 0, that is, saleOrgId == ''

So this judgment is invalid

So we just need to remove the later and saleOrgId != ''

Record it to prevent stepping on the pit

Guess you like

Origin blog.csdn.net/xijinno1/article/details/131387631