方法一:推荐推荐
<if test="delFlag == '2'.toString()">
a.del_flag = #{delFlag}
</if>
方法二:
<if test=' delFlag == "2" '>
a.del_flag = #{delFlag}
</if>
注意test 后面跟的是双引号( " " )还是单引号( ' ' )
ps:用equals()亲测也可以
方法三:
<if test=' delFlag.equals("2") '>
a.del_flag = #{delFlag}
</if>
注意:使用如下方式是错的
1 <if test=" delFlag == '2' ">
2 a.del_flag = #{delFlag}
3 </if>
转载文章
关联查询删除表中指定的数据
delete a from basic_main a
left join basic_two b on a.unit_id = b.id
where b.id is null;