一 、java
Integer userId; 类型数据 在mybatis <if test = "userId != null "></if> ,这样写可以;
Int userId; 类型数据 在mybatis <if test = "userId != null "></if> ,这样写就不行了,查不出数据。
应改为 <if test = "userId != 0 "></if>
本文探讨了在MyBatis中使用Integer与int类型数据进行条件判断的差异,指出Integer类型的判空方式更为灵活,而int类型则需直接比较数值。
一 、java
Integer userId; 类型数据 在mybatis <if test = "userId != null "></if> ,这样写可以;
Int userId; 类型数据 在mybatis <if test = "userId != null "></if> ,这样写就不行了,查不出数据。
应改为 <if test = "userId != 0 "></if>

被折叠的 条评论
为什么被折叠?