title: How can I skip query if where_in clause is empty in MyBatis 3?
body: <pre><code>select * from users where id in ()
  </code></pre>
  
  <p>The query is shown above. </p>
  
  <pre><code>&lt;select id="getByIds" resultMap="BaseResultMap"&gt;
      SELECT
      &lt;include refid="BaseColumnList"/&gt;
      FROM users
      WHERE id IN
      &lt;foreach item="id" collection="ids"
               open="(" separator="," close=")"&gt;
          #{id}
      &lt;/foreach&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>If the Param <code>ids</code> is empty, Mybatis will throw BadSqlGrammarException, which generate a query like '<code>select * from users where id in</code>'.</p>
  
  <p>How can I skip query and return empty list if <code>ids</code> is empty?</p>