`id`,`tenant_id`,`img_url`,`name`,`link_phone`,`create_date`,`update_date`,`car_vendor_type`,`car_params`,`status`,`link_person`,
`business_id`,`sub_business_id`,`shop_type`,`brand`,`type`,`is_public`,email,`title`,`cover_picture`,`is_admin`,`bill_setting`,`qr_code`,
`introduction`,`action_desc`,`is_del`,`talk_user_main`,`talk_user_aux`,link_line_phone,credit_locked
m.`id`,m.`tenant_id`,m.`img_url`,m.`name`,m.`link_phone`,m.`create_date`,m.`update_date`,m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`,
m.`business_id`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,
m.`introduction`,m.`action_desc`,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,r.rental_start_date,r.rental_end_date
where is_del = 0
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `img_url` like concat('%', #{imgUrl},'%')
and `name` like concat('%', #{name},'%')
and `link_phone` like concat('%', #{linkPhone},'%')
and `create_date` = #{createDate}
and `update_date` = #{updateDate}
and `car_vendor_type` = #{carVendorType}
and `business_id` = #{businessId}
and `sub_business_id` = #{subBusinessId}
and `car_params` like concat('%', #{carParams},'%')
and `status` = #{status}
and `link_person` = #{linkPerson}
and `type` = #{type}
and `is_public` = #{isPublic}
and `email` = #{email}
and `is_admin` = #{isAdmin}
and `is_del` = #{isDel}
and `brand` = #{brand}
and `credit_locked` = #{creditLocked}
and id not in(
select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is
not null and status in(1,2,3,4)
)
and id in
#{idItem}
and id in(
select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms
inner join wx_merchant m on ms.merchant_id = m.id
inner join wx_shop s on s.id=ms.shop_id
where m.tenant_id=#{tenantId} and s.is_del=0
and m.business_id in (${businessForRule})
and s.`floor` in (${floorForRule})
)
order by ${sortColumns}
and m.id in(
select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms
inner join wx_merchant m on ms.merchant_id = m.id
inner join wx_shop s on s.id=ms.shop_id
where m.tenant_id=#{tenantId} and s.is_del=0
and m.business_id in (${businessForRule})
and s.`floor` in (${floorForRule})
)
where m.is_del = 0
and m.`id` = #{id}
and m.`tenant_id` = #{tenantId}
and m.`img_url` like concat('%', #{imgUrl},'%')
and m.`name` like concat('%', #{name},'%')
and m.`link_phone` like concat('%', #{linkPhone},'%')
and m.`create_date` = #{createDate}
and m.`update_date` = #{updateDate}
and m.`car_vendor_type` = #{carVendorType}
and m.`business_id` = #{businessId}
and m.`sub_business_id` = #{subBusinessId}
and m.`car_params` like concat('%', #{carParams},'%')
and m.`status` = #{status}
and m.`link_person` = #{linkPerson}
and m.`type` = #{type}
and m.`is_public` = #{isPublic}
and m.`email` = #{email}
and m.`is_admin` = #{isAdmin}
and m.`is_del` = #{isDel}
and m.`brand` = #{brand}
and m.id not in(
select merchant_id from wx_rent_contract where tenant_id=#{tenantId} and rent_shop_type=1 and merchant_id is
not null and status in(1,2,3,4)
)
and m.id in
#{idItem}
order by ${sortColumns}
distinct m.id,m.img_url,m.name,m.link_phone,m.status,m.business_id,
m.is_public,m.email,m.title,m.cover_picture,m.sub_business_id,
m.shop_type,m.introduction,m.action_desc,bu.title as business_name,m.link_line_phone
update wx_merchant set credit_locked = #{creditLocked} where tenant_id = #{tenantId}