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