很常见的一个字段存了id以逗号相隔,当查询的时候,入参往往是单个或者集合(单个容易处理 like就可以搞定)而是list是可以采用一下方法

 

select count(*) from engine_temp_variable where del_flag =0 and
<if test="list != null ">
(
<trim prefixOverrides="AND|OR">
<foreach collection="list" item="id">
or (locate(concat(#{id},','),variableFieldIds) > 0 )
</foreach>
</trim>
)
</if>

相关文章:

  • 2021-10-16
  • 2021-06-29
  • 2021-12-31
  • 2022-12-23
  • 2022-03-05
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2021-05-13
  • 2021-08-06
  • 2022-12-23
  • 2021-06-02
相关资源
相似解决方案