欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

mybatis中根据多条件list查询

程序员文章站 2024-03-02 09:02:04
...

mapper文件

<select id="selectWhere" resultMap="BaseResultMap">
    select 
     <include refid="Base_Column_List" />
    from table
     <where>
      table.a = a  and table.b in 
    <foreach collection="list" item="item" index="index" open="(" separator="," close=")">
      '${item}'
    </foreach>
    </where>
  </select>

DAO片段

List<T> selectWhere(@Param("list")List<String> list ,@Param("a") String a);
相关标签: mybatis