mybatis字符串比较

时间:2021-12-27 16:15:56

mybatis使用if标签进行字符串比较时,单引号放在外面,双引号放在里面,不然当flag="1"时,会判断test为false,无法执行其中的sql语句

<if test='flag != null and flag == "1"'>

AND a.l_code NOT IN
(SELECT b.l_code FROM prodata.pro_package_track_list b where b.pro_package_id = #{proPackageId} and b.del_flag = #{DEL_FLAG_NORMAL})
</if>