多个参数进行查询
- List<Integer> select(@Param("list")List<Map> maps);
- <select id="select" resultType="java.lang.Integer">
- <foreach collection="list" index="index" item="map" separator="union">
- select i from t
- where r = #{map.r,jdbcType=INTEGER} and
- p = #{map.p,jdbcType=INTEGER}
- </foreach>
- </select>
这种方式比使用 or 进行分类快很多, 因为这种属于单一查, 最后总结在一起, 使用 or 时, 则会每次查询时都进行很多次判断
来源: http://www.bubuko.com/infodetail-3526444.html