问题描述:
mybatis Integer值或Long值传0问题
mybatis将传入的Integer类型或Long类型的0识别成空字符串的问题
传0无效
例子:
and role=${pd.role}
当把role为integer类型 role=0 时没进条件。
因此可以理解为
and role=${pd.role}
解决方法
1:把integer类型改为int类型或String类型
2:值判断不为空就行
and role=${pd.role}
3:使用增强版的判断
<if test=“pd.role != null and pd.role!=”" or pd.role == 0>
and role=${pd.role}
4.不使用0,从1开始