MyBatis精确批量删除
代码如下:
<delete id="mulDeleteTenantInfo" parameterType="java.util.List">
delete from ptl_tenant_info where
<foreach collection="list" item="item" index="index" separator=" or " >
( 1=1
<if test="item.tenant_id != null and item.tenant_id !=''">
and tenant_id=#{item.tenant_id}
</if>
<if test="item.tenant_code != null and item.tenant_code !=''">
and tenant_code=#{item.tenant_code}
</if>
<if test="item.tenant_name != null and item.tenant_name !=''">
and tenant_name=#{item.tenant_name}
</if>
<if test="item.tenant_responsibler != null and item.tenant_responsibler !=''">
and tenant_responsibler=#{item.tenant_responsibler}
</if>
<if test="item.tenant_owner != null and item.tenant_owner !=''">
and tenant_owner=#{item.tenant_owner}
</if>
<if test="item.valid_users_total != null and item.valid_users_total !=''">
and valid_users_total=#{item.valid_users_total}
</if>
<if test="item.valid_start_time != null ">
and valid_start_time=#{item.valid_start_time}
</if>
<if test="item.valid_end_time != null ">
and valid_end_time=#{item.valid_end_time}
</if>
<if test="item.tenant_roles != null and item.tenant_roles !=''">
and tenant_roles=#{item.tenant_roles}
</if>
<if test="item.remark != null and item.remark !=''">
and remark=#{item.remark}
</if>
<if test="item.status != null and item.status !=''">
and status=#{item.status}
</if>
<if test="item.create_time != null ">
and create_time=#{item.create_time}
</if>
<if test="item.update_time != null ">
and update_time=#{item.update_time}
</if>
<if test="item.create_by != null and item.create_by !=''">
and create_by=#{item.create_by}
</if>
<if test="item.update_by != null and item.update_by !=''">
and update_by=#{item.update_by}
</if>
)
</foreach>
</delete>