`id`,`tenant_id`,`parent_tenant_id`,`receive_pay`,`pay`,`receive_date`,`pay_date`,`createtime`,`expired_day`,`last_owe_call_time`,`last_owe_call_user`,
`status`,`is_del`,`merchant_id`,`user_id`,`shop_id`,`shop_name`,`updatetime`,`name`,`comments`,`apply_status`,`apply_pay_img`,`apply_update_time`,
`rent_shop_type`,`return_price`,`pay_way`,`starttime`,`endtime`,freeze,service_charge_pay,`create_by`,`create_by_name`,`update_by`,`update_by_name`,
`energy_fees_id`,`set_off`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `receive_pay` = #{receivePay}and `pay` = #{pay}and `receive_date` = #{receiveDate}and `pay_date` = #{payDate}and `createtime` = #{createtime}and `expired_day` = #{expiredDay}and `status` = #{status}and `energy_fees_id` = #{energyFeesId}and `apply_status` = #{applyStatus}and `is_del` = #{isDel}and `merchant_id` = #{merchantId}and `user_id` = #{userId}and `starttime` <= #{starttime}and `endtime` >= #{endtime}and `shop_id` = #{shopId}and `updatetime` = #{updatetime}and `name` = #{name}and `rent_shop_type` = #{rentShopType}and `pay_way` = #{payWay}and (`last_owe_call_time` is not null and `receive_pay` - `pay` - `set_off` > 0 and status not in (3,6,7) )
and id in
#{idItem}
and id not in
#{nidItem}
and status in
#{stItem}
order by ${sortColumns}
1 = 1
and br.`id` = #{id} and br.`tenant_id` = #{tenantId}and br.`parent_tenant_id` = #{parentTenantId}and br.`freeze` = #{freeze}and br.`merchant_id` = #{merchantId}and br.`status` = #{status}and br.`apply_status` = #{applyStatus}and br.`is_del` = #{isDel}and br.`energy_fees_id` = #{energyFeesId}and br.`name` = #{name}and br.`rent_shop_type` = #{rentShopType}and br.`pay_way` = #{payWay}and br.`comments` like concat('%',#{comments},'%')and br.`starttime` <= #{starttime}and br.`endtime` >= #{endtime}
and date_format(br.starttime,'%Y-%m') <= #{month} and date_format(br.endtime,'%Y-%m') >= #{month}
and (br.`starttime` <= #{oweBillLastTime} and br.`receive_pay` - br.`pay` - br.`set_off` > 0 and br.status not in (3,6,7))
and (br.`starttime` > #{oweBillLastTime} and br.`starttime` <= #{nearBillLastTime} and br.`receive_pay` - br.`pay` - br.`set_off` > 0 and br.status not in (3,6,7))
and (br.`starttime` <= #{needPayStartDay} and br.`receive_pay` - br.`pay` - br.`set_off` > 0 and br.status not in (3,6,7))
and (br.`last_owe_call_time` is not null and br.`receive_pay` - br.`pay` - br.`set_off` > 0 and br.status not in (3,6,7) )
and br.`merchant_id` in
#{midItem}
and br.id not in
#{nidItem}
and br.status in
#{stItem}
update wx_bill_other_deposit set status=#{notPaid},expired_day=DATEDIFF(now(),receive_date)
where status!=#{paid}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and status!=5 and DATEDIFF(now(),receive_date)>0
update wx_bill_other_deposit set status=#{waitPay}
where 1=1
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and status!=5
and status!=#{paid} and DATEDIFF(now(),receive_date) <=0
delete from wx_bill_other_deposit where id = #{id} and tenant_id = #{tenantId}