MyBatis数组与集合判断空

数组判断空
参数为数组object[]。在MyBatis判断空时,先判断是否为null,不为null则判断数组长度object.length是否大于0即可。

	<if test="object!=null and object.length>0">
		<yourSql>
	</if>

 

集合判断空
参数为集合List。在MyBatis判断空时,先判断是否为null,不为null则判断集合长度object.size()是否大于0即可。

<if test="object!=null and object.size()>0">
		<yourSql>
	</if>
posted @ 2021-04-10 17:07  甜菜波波  阅读(3867)  评论(0编辑  收藏  举报