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() 結合用。
