MyBatis精确批量删除

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>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值