mybatis的XML配置文件sql查詢中,傳入對象參中某個字段為list時,sql編寫方式。


mybatis的XML配置文件sql查詢中,傳入對象參中某個字段為list時,sql編寫方式。

<if test="chartQueryListDto.educations!=null and chartQueryListDto.educations.size() > 0">
		<foreach collection="chartQueryListDto.educations" item="education" open="and a08001a in  (" close=")" separator=",">
			#{education}
		</foreach>
	</if>

異常統計:
target is null for method size
原因:
|目標為方法大小的null:總體來說,是在xml文件中使用了錯誤的方法,chartQueryListDto.educations.size() 方法需要 判空 和 size() 結合用。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM