create_by,
		create_time,
		update_by,
		update_time,
			id,
			c_name,
			offset_amount,
			min_amount,
			begin_time,
			end_time,
			max_quantity,
			get_limit,
			quantity_receive,
			coupon_status,
			is_open,
			is_all,
			product_ids,
			attr_ids,
			tag,
			kind,
			shop_id,
            company_id
    
    
    
        #{item.createBy},
		now(),
        #{item.updateBy},
        now(),
        #{item.id},
        #{item.cName},
        #{item.offsetAmount},
        #{item.minAmount},
        #{item.beginTime},
        #{item.endTime},
        #{item.maxQuantity},
        #{item.getLimit},
        #{item.quantityReceive},
        #{item.couponStatus},
        #{item.isOpen},
        #{item.isAll},
        #{item.productIds},
        #{item.attrIds},
        #{item.tag},
        #{item.kind},
        #{item.shopId},
        #{item.companyId}
    
    
    
        
            
                and id = #{record.id}
            
            
                and c_name = #{record.cName}
            
            
                and offset_amount = #{record.offsetAmount}
            
            
                and min_amount = #{record.minAmount}
            
            
                and begin_time = #{record.beginTime}
            
            
                and end_time = #{record.endTime}
            
            
                and max_quantity = #{record.maxQuantity}
            
            
                and get_limit = #{record.getLimit}
            
            
                and quantity_receive = #{record.quantityReceive}
            
            
                and coupon_status = #{record.couponStatus}
            
            
                and is_open = #{record.isOpen}
            
            
                and is_all = #{record.isAll}
            
            
                and product_ids = #{record.productIds}
            
            
                and attr_ids = #{record.attrIds}
            
            
                and tag = #{record.tag}
            
            
                and kind = #{record.kind}
            
            
                and shop_id = #{record.shopId}
            
            
                and company_id = #{record.companyId}
            
        
    
    
    
        
            
                and id = #{record.id}
            
            
                and instr(c_name, #{record.cName})
            
            
                and offset_amount = #{record.offsetAmount}
            
            
                and min_amount = #{record.minAmount}
            
            
                and #{record.couponBeginTime} >= date_format(begin_time, '%Y-%m-%d')
            
            
                and date_format(end_time, '%Y-%m-%d') >= #{record.couponEndTime}
            
            
                and max_quantity = #{record.maxQuantity}
            
            
                and get_limit = #{record.getLimit}
            
            
                and quantity_receive = #{record.quantityReceive}
            
            
                and coupon_status = #{record.couponStatus}
            
            
                and is_open = #{record.isOpen}
            
            
                and is_all = #{record.isAll}
            
            
                and product_ids = #{record.productIds}
            
            
                and attr_ids = #{record.attrIds}
            
            
                and tag = #{record.tag}
            
            
                and kind = #{record.kind}
            
            
                and shop_id = #{record.shopId}
            
            
                and company_id = #{record.companyId}
            
        
    
    
    
        INSERT INTO shop_coupon (
        
        )
        VALUES (
        
        )
    
    
    
        INSERT INTO shop_coupon (
        
        )
        VALUES
        (
            
            )
        
    
    
    
        UPDATE shop_coupon
        
            
                c_name = #{cName},
            
            
                offset_amount = #{offsetAmount},
            
            
                min_amount = #{minAmount},
            
            
                begin_time = #{beginTime},
            
            
                end_time = #{endTime},
            
            
                max_quantity = #{maxQuantity},
            
            
                get_limit = #{getLimit},
            
            
                quantity_receive = #{quantityReceive},
            
            
                coupon_status = #{couponStatus},
            
            
                is_open = #{isOpen},
            
            
                is_all = #{isAll},
            
            
                product_ids = #{productIds},
            
            
                attr_ids = #{attrIds},
            
            
                tag = #{tag},
            
            
                update_time = now(),
            
            
                kind = #{kind},
            
            
                shop_id = #{shopId},
            
            
                company_id = #{companyId},
            
        
        WHERE id=#{id}
    
    
    
        UPDATE shop_coupon
        
            
                c_name = #{record.cName},
            
            
                offset_amount = #{record.offsetAmount},
            
            
                min_amount = #{record.minAmount},
            
            
                begin_time = #{record.beginTime},
            
            
                end_time = #{record.endTime},
            
            
                max_quantity = #{record.maxQuantity},
            
            
                get_limit = #{record.getLimit},
            
            
                quantity_receive = #{record.quantityReceive},
            
            
                coupon_status = #{record.couponStatus},
            
            
                is_open = #{record.isOpen},
            
            
                is_all = #{record.isAll},
            
            
                product_ids = #{record.productIds},
            
            
                shop_id = #{record.shopId},
            
            
                attr_ids = #{record.attrIds},
            
            
                tag = #{record.tag},
            
            
                kind = #{record.kind},
            
            
                update_time = now()
            
        
        WHERE id=#{record.id}
    
    
    
        delete from shop_coupon where id in
        
            #{item}
        
    
    
    
        DELETE
        FROM shop_coupon
        where id = #{id}
    
    
    
        DELETE FROM shop_coupon
        
            
        
    
    
    
    
    
    
    
    
    
    
    
    
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
    
    
    
    
    
    
    
    
        update shop_coupon
        
            
                is_open = #{state}
            
        
        where id in
        
            #{item}
        
    
    
    
        update shop_coupon
        set coupon_status = if(begin_time > now(), 1, if(now() > end_time, 3, 2))
    
    
    
        update shop_coupon
        set coupon_status = if(begin_time > now(), 1, if(now() > end_time, 3, 2))
        where id = #{id}