Sql where in 多个参,操作单条数据有问题?

2019-03-29  本文已影响0人  南岩飞雪

问题

   <delete id="batchDeleteByQueryList">
        delete from xxx where corp_id = #{corpId} and (user_id, active_time) in
        <foreach collection="queryList" item="item" separator="," open="(" close=")">
            (#{item.userId}, #{item.activeTime})
        </foreach>
   </delete>
Where in: Operand should contain 2 column(s)

临时解决,大家可以深挖

   <delete id="deleteByUserIdAndActiveTime">
        delete from xxx
        where corp_id = #{corpId} and user_id = #{userId} and active_time = #{activeTime} 
   </delete>

原因

参考

https://github.com/hiddentao/squel/issues/332

上一篇 下一篇

猜你喜欢

热点阅读