
mybatis动态sql导致badsql问题
使用mybatis的动态sql条件判断时,需要使用
错误示例:
select * from table a where a.project_id=#{projectid} and a.id != #{id} and a.status=3 and a.id_card = #{code} or a.unit_code = #{code}原因:
在
优化后的代码:
select * from table aa.project_id=#{projectId} and a.id != #{id} and a.status=3 and a.id_card = #{code} and a.unit_code = #{code}
解释:
优化后的代码使用










