mybatis 参数判断报错的问题
<!-- 是否品牌客户 品牌字段不为空 --> <if test="brandCustomer != null"> <if test="brandCustomer == '是'"> and (c.brand is not null and c.brand !='') </if> <if test="brandCustomer == '否'"> and (c.brand is null or c.brand ='') </if> </if>
执行报错
<!-- 是否品牌客户 品牌字段不为空 --> <if test="brandCustomer != null"> <if test="brandCustomer == '是'.toString()"> and (c.brand is not null and c.brand !='') </if> <if test="brandCustomer == '否'.toString()"> and (c.brand is null or c.brand ='') </if> </if>
因为'' 会转为char
参考文档
if 判断等于一个字符串_mybatis if等于字符串-CSDN博客