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

猜你喜欢

转载自www.cnblogs.com/xingmangdieyi110/p/11691764.html