Mybatis in查询多个参数 ---- 传入List集合

  |   0 评论   |   0 浏览

1.Dao接口

	/**
	 * 通过oralce 用户名 和 多个 表 的id,查询集合
	 * @param id
	 * @param tableUser
	 * @return
	 */
	public List<DbTableInfo> findListByUserAndTableIds(@Param("ids") List<String> ids,@Param("tableUser") String tableUser);

2.mybatis 方法

	<!-- 通过oralce 用户名 和 多个 表 的id,查询集合 -->
	<select id="findListByUserAndTableIds" resultType="DbTableInfo">
		SELECT 
			*
		FROM db_table_info
		where
			del_flag = '0'
			AND table_user = #{tableUser}
			AND id in
			<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">  
    				#{item}  
  			</foreach>  
	</select>