如图:要实现车辆数不同区间查询条件
思路:a.前端传数组,数组里面放"1-5"String类型值
b.后端mybatis用双foreach循环解析
后端代码如下:
<!--图例车辆数区间-->
<if test="countCargoList != null and countCargoList.size>0" > and ( <foreach item="item" index="index" collection="countCargoList"> ( <foreach item="item2" index="index2" collection="item.split('-')"> <if test="index2%2==0"> sfi.count_cargo >= #{item2} </if> <if test="index2%2==1"> and sfi.count_cargo <= #{item2} </if> </foreach> ) <!--最后一次不用加or--> <if test="index != countCargoList.size-1" > or </if> </foreach> ) </if>