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

posted @ 2019-10-17 14:20  oO星芒蝶翼Oo  阅读(2604)  评论(0编辑  收藏  举报