<select >
      SELECT sum(download_times) as downloadNum ,sum(click_times) as browseNum
      FROM  file_property 
    <if test="_parameter != null">
      WHERE id in 
         <foreach item="item" index="index" collection="list" open="(" separator="," close=")">  
             #{item}  
           </foreach>  
      </if>
  </select>

如上方法使用in,

  注意,传入的参数是List<Long> ,如果传入的是array 则需要修改红色部分定义为 collection="array" 

相关文章:

  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
猜你喜欢
  • 2021-11-30
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
相关资源
相似解决方案