问题:nested exception is org.apache.ibatis.builder.BuilderException: The expression 'array' evaluated to a null value.
原因:前端传入的数组长度为空或者未0
前端传入:
{
"cityCodes":[],
"areaCodes":["450103","450107"],
"streetCodes":[],
}
xml中sql语句:
<if test="cityCodes != null and cityCodes.size > 0 ">
and e.city_code in
<foreach item="cityCode" collection="cityCodes" open="(" separator="," close=")">
#{cityCode}
</foreach>
</if>
<if test="areaCodes != null and areaCodes.size > 0 ">
and e.area_code in
<foreach item="areaCode" collection="areaCodes" open="(" separator="," close=")">
#{areaCode}
</foreach>
</if>
<if test="streetCodes != null and streetCodes.size > 0 ">
and e.street_code in
<foreach item="streetCode" collection="streetCodes" open="(" separator="," close=")">
#{streetCode}
</foreach>
</if>