myBatis传入的集合可能为空的解决方法!

<if test="mwCodeList != null">
			and t.CODE in
			<choose>
				<when test="mwCodeList.size == 0">
					(null)
				</when>
				<when test="mwCodeList.size > 0">
					<foreach collection="mwCodeList" item="item" open="(" close=")"  separator=",">
						'${item}'
					</foreach>
				</when>
			</choose>
		</if>

猜你喜欢

转载自blog.csdn.net/zhaoliubao1/article/details/85273404