`id`,`tenant_id`,`parent_tenant_id`,`phone`,`user_pwd`,`merchant_id`,`create_date`,`update_date`,`app_id`,`token`,`expire_time`,`name`,`status`,`is_admin`,`other_merchant`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `phone` = #{phone}
and `phone` like concat('%', #{phoneLike},'%')
and `user_pwd` like concat('%', #{userPwd},'%')
and `merchant_id` = #{merchantId}
and `create_date` = #{createDate}
and `update_date` = #{updateDate}
and `app_id` like concat('%', #{appId},'%')
and `token` like concat('%', #{token},'%')
and `expire_time` = #{expireTime}
and `name` = #{name}
and `status` = #{status}
and `is_admin` = #{isAdmin}
and json_search(other_merchant, 'one', #{otherMerchantId}) IS NOT NULL;
and id in
#{idItem}
and merchant_id in
#{merchantIdItem}
order by ${sortColumns}
update wx_merchant_b_user set other_merchant = JSON_REMOVE(other_merchant, replace(json_search(other_merchant, 'one', #{otherId}), '"', ''))
where `tenant_id` = #{tenantId}
and json_search(other_merchant, 'one', #{otherId}) IS NOT NULL;
update wx_merchant_b_user set other_merchant = json_array_append(coalesce(other_merchant,'[]'), '$', #{otherId})
where `tenant_id` = #{tenantId}
and id in
#{idItem}
and json_search(other_merchant, 'one', #{otherId}) IS NULL;