MyBatis数组与集合判断空

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

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

 

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

<if test="object!=null and object.size()>0">
		<yourSql>
</if>
posted @ 2022-07-27 09:04  松松敲代码  阅读(1838)  评论(0编辑  收藏  举报