若依批量删除mapper 不传ids
时间: 2024-02-10 07:09:20 浏览: 23
若依批量删除mapper不传ids,可以在mapper.xml中使用动态SQL来处理这种情况。可以使用if标签来判断ids是否为空,如果为空则不执行删除操作。
以下是一个示例代码:
```xml
<update id="fushenPlBmRendingByIds" parameterType="String">
update bm_rending
<set>
<if test="ids ! null and ids.length > 0">
SHENBAO_STATE = '1'
</if>
</set>
<where>
<if test="ids != null and ids.length > 0">
id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</update>
```
在上述代码中,使用了if标签来判断ids是否为空。如果ids不为空,则执行更新操作,并使用foreach标签来遍历ids数组,将每个id作为参数传入SQL语句中。
如果ids为空,则不执行更新操作,即不会删除任何数据。