`id`,`tenant_id`,`merchant_id`,`type`,`cover_img`,`title`,`sub_title`,`sale_price`,`use_price`,`use_limit_quantity`,`target_ad`,`send_type`,`valid_type`,`valid_start_date`,`valid_end_date`,`valid_days`,`detail`,`price`,`unit`,`remain_inventory`,`inventory`,`remark`,`status`,`create_date`,`update_date`,`business` where 1 = 1 and `id` = #{id} and `tenant_id` like concat('%', #{tenantId},'%') and `merchant_id` = #{merchantId} and `type` = #{type} and `cover_img` like concat('%', #{coverImg},'%') and `title` like concat('%', #{title},'%') and `sub_title` like concat('%', #{subTitle},'%') and `sale_price` = #{salePrice} and `use_price` = #{usePrice} and `use_limit_quantity` = #{useLimitQuantity} and `target_ad` = #{targetAd} and `send_type` = #{sendType} and `valid_type` = #{validType} and `valid_start_date` = #{validStartDate} and `valid_end_date` = #{validEndDate} and `valid_days` = #{validDays} and `detail` like concat('%', #{detail},'%') and `price` = #{price} and `unit` = #{unit} and `remain_inventory` = #{remainInventory} and `inventory` = #{inventory} and `remark` like concat('%', #{remark},'%') and `status` = #{status} and `create_date` = #{createDate} and `update_date` = #{updateDate} and `business` like concat('%', #{business},'%') and id in #{idItem} order by ${sortColumns} c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, m.img_url,m.name,m.link_phone,m.status, s.addr,s.shop_number,s.baidu_poi, mb.building_name,mf.floor_name, cc.id,cc.coupon_id,cc.begin_time,cc.end_time c.tenant_id,c.merchant_id,c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.use_limit_quantity,c.target_ad,c.send_type,c.valid_type,c.valid_start_date,c.valid_end_date,c.valid_days,c.detail,c.price,c.unit,c.remain_inventory,c.inventory,c.remark,c.status,c.create_date,c.update_date,c.business, m.img_url,m.name,m.link_phone,m.status, s.addr,s.shop_number,s.baidu_poi, mb.building_name,mf.floor_name update wx_coupon SET remain_inventory = remain_inventory - #{number} where id = #{id} and remain_inventory>= #{number}