MyBaties 提示的錯誤信息:org.apache.ibatis.builder.BuilderException: The expression '***' evaluated to a null value.
錯誤的原因:SQL 參數爲List 集合,傳遞的指定參數不是集合
解決的辦法:MyBatis mapper 配置文件添加一層針對錯誤屬性的集合判斷:
<if test="***!= null and ***.size > 0">
<foreach collection="***" item="sts" separator="," open="(" close=")">
and (
(INSTR(TEST.ARCH_TITLE, $sts$) > 0)
OR (INSTR(TEST.MAKE_ORG_NAME, $sts$) > 0)
OR (INSTR(TEST.UNIT_PROJ_NAME, $sts$) > 0)
)
</foreach>
</if>