MyBaties 提示org.apache.ibatis.builder.BuilderException: The expression ‘’**' evaluated to a null val

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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章