package com.hfkj.dao;

import com.hfkj.entity.BsOrderMeituan;
import com.hfkj.entity.BsOrderMeituanExample.Criteria;
import com.hfkj.entity.BsOrderMeituanExample.Criterion;
import com.hfkj.entity.BsOrderMeituanExample;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.jdbc.SQL;

public class BsOrderMeituanSqlProvider {

    public String countByExample(BsOrderMeituanExample example) {
        SQL sql = new SQL();
        sql.SELECT("count(*)").FROM("bs_order_meituan");
        applyWhere(sql, example, false);
        return sql.toString();
    }

    public String deleteByExample(BsOrderMeituanExample example) {
        SQL sql = new SQL();
        sql.DELETE_FROM("bs_order_meituan");
        applyWhere(sql, example, false);
        return sql.toString();
    }

    public String insertSelective(BsOrderMeituan record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("bs_order_meituan");
        
        if (record.getOrderNo() != null) {
            sql.VALUES("order_no", "#{orderNo,jdbcType=VARCHAR}");
        }
        
        if (record.getChildOrderNo() != null) {
            sql.VALUES("child_order_no", "#{childOrderNo,jdbcType=VARCHAR}");
        }
        
        if (record.getTradeNo() != null) {
            sql.VALUES("trade_no", "#{tradeNo,jdbcType=VARCHAR}");
        }
        
        if (record.getThirdTradeNo() != null) {
            sql.VALUES("third_trade_no", "#{thirdTradeNo,jdbcType=VARCHAR}");
        }
        
        if (record.getSqtBizOrderId() != null) {
            sql.VALUES("sqt_biz_order_id", "#{sqtBizOrderId,jdbcType=VARCHAR}");
        }
        
        if (record.getMerId() != null) {
            sql.VALUES("mer_id", "#{merId,jdbcType=BIGINT}");
        }
        
        if (record.getMerName() != null) {
            sql.VALUES("mer_name", "#{merName,jdbcType=VARCHAR}");
        }
        
        if (record.getUserId() != null) {
            sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}");
        }
        
        if (record.getUserPhone() != null) {
            sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}");
        }
        
        if (record.getFirstBusinessType() != null) {
            sql.VALUES("first_business_type", "#{firstBusinessType,jdbcType=VARCHAR}");
        }
        
        if (record.getSecondBusinessType() != null) {
            sql.VALUES("second_business_type", "#{secondBusinessType,jdbcType=VARCHAR}");
        }
        
        if (record.getEntId() != null) {
            sql.VALUES("ent_id", "#{entId,jdbcType=BIGINT}");
        }
        
        if (record.getImg() != null) {
            sql.VALUES("img", "#{img,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsName() != null) {
            sql.VALUES("goods_name", "#{goodsName,jdbcType=VARCHAR}");
        }
        
        if (record.getTraceId() != null) {
            sql.VALUES("trace_id", "#{traceId,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsCount() != null) {
            sql.VALUES("goods_count", "#{goodsCount,jdbcType=INTEGER}");
        }
        
        if (record.getTotalPrice() != null) {
            sql.VALUES("total_price", "#{totalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getTotalDeductionPrice() != null) {
            sql.VALUES("total_deduction_price", "#{totalDeductionPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getCouponDiscountPrice() != null) {
            sql.VALUES("coupon_discount_price", "#{couponDiscountPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getIntegralDiscountPrice() != null) {
            sql.VALUES("integral_discount_price", "#{integralDiscountPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPlatformCode() != null) {
            sql.VALUES("platform_code", "#{platformCode,jdbcType=VARCHAR}");
        }
        
        if (record.getNotifyUrl() != null) {
            sql.VALUES("notify_url", "#{notifyUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getReturnUrl() != null) {
            sql.VALUES("return_url", "#{returnUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getPayRealPrice() != null) {
            sql.VALUES("pay_real_price", "#{payRealPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getEntPayAmount() != null) {
            sql.VALUES("ent_pay_amount", "#{entPayAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getTradeAmount() != null) {
            sql.VALUES("trade_amount", "#{tradeAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getBusinessDiscountPayAmount() != null) {
            sql.VALUES("business_discount_pay_amount", "#{businessDiscountPayAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getServiceFeeAmount() != null) {
            sql.VALUES("service_fee_amount", "#{serviceFeeAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getServicePrice() != null) {
            sql.VALUES("service_price", "#{servicePrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPayChannel() != null) {
            sql.VALUES("pay_channel", "#{payChannel,jdbcType=INTEGER}");
        }
        
        if (record.getPaySerialNo() != null) {
            sql.VALUES("pay_serial_no", "#{paySerialNo,jdbcType=VARCHAR}");
        }
        
        if (record.getPayType() != null) {
            sql.VALUES("pay_type", "#{payType,jdbcType=INTEGER}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("`status`", "#{status,jdbcType=INTEGER}");
        }
        
        if (record.getMeituanStatus() != null) {
            sql.VALUES("meituan_status", "#{meituanStatus,jdbcType=INTEGER}");
        }
        
        if (record.getStaffInfo() != null) {
            sql.VALUES("staff_info", "#{staffInfo,jdbcType=VARCHAR}");
        }
        
        if (record.getBusinessInfo() != null) {
            sql.VALUES("business_info", "#{businessInfo,jdbcType=VARCHAR}");
        }
        
        if (record.getTradeExpiringTime() != null) {
            sql.VALUES("trade_expiring_time", "#{tradeExpiringTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getPayTime() != null) {
            sql.VALUES("pay_time", "#{payTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getCancelTime() != null) {
            sql.VALUES("cancel_time", "#{cancelTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRefundTime() != null) {
            sql.VALUES("refund_time", "#{refundTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getFinishTime() != null) {
            sql.VALUES("finish_time", "#{finishTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getExceptionStatus() != null) {
            sql.VALUES("exception_status", "#{exceptionStatus,jdbcType=BIT}");
        }
        
        if (record.getExceptionMsg() != null) {
            sql.VALUES("exception_msg", "#{exceptionMsg,jdbcType=VARCHAR}");
        }
        
        if (record.getExt1() != null) {
            sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
        }
        
        if (record.getExt2() != null) {
            sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}");
        }
        
        if (record.getExt3() != null) {
            sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}");
        }
        
        return sql.toString();
    }

    public String selectByExample(BsOrderMeituanExample example) {
        SQL sql = new SQL();
        if (example != null && example.isDistinct()) {
            sql.SELECT_DISTINCT("id");
        } else {
            sql.SELECT("id");
        }
        sql.SELECT("order_no");
        sql.SELECT("child_order_no");
        sql.SELECT("trade_no");
        sql.SELECT("third_trade_no");
        sql.SELECT("sqt_biz_order_id");
        sql.SELECT("mer_id");
        sql.SELECT("mer_name");
        sql.SELECT("user_id");
        sql.SELECT("user_phone");
        sql.SELECT("first_business_type");
        sql.SELECT("second_business_type");
        sql.SELECT("ent_id");
        sql.SELECT("img");
        sql.SELECT("goods_name");
        sql.SELECT("trace_id");
        sql.SELECT("goods_count");
        sql.SELECT("total_price");
        sql.SELECT("total_deduction_price");
        sql.SELECT("coupon_discount_price");
        sql.SELECT("integral_discount_price");
        sql.SELECT("platform_code");
        sql.SELECT("notify_url");
        sql.SELECT("return_url");
        sql.SELECT("pay_real_price");
        sql.SELECT("ent_pay_amount");
        sql.SELECT("trade_amount");
        sql.SELECT("business_discount_pay_amount");
        sql.SELECT("service_fee_amount");
        sql.SELECT("service_price");
        sql.SELECT("pay_channel");
        sql.SELECT("pay_serial_no");
        sql.SELECT("pay_type");
        sql.SELECT("`status`");
        sql.SELECT("meituan_status");
        sql.SELECT("staff_info");
        sql.SELECT("business_info");
        sql.SELECT("trade_expiring_time");
        sql.SELECT("create_time");
        sql.SELECT("pay_time");
        sql.SELECT("cancel_time");
        sql.SELECT("refund_time");
        sql.SELECT("finish_time");
        sql.SELECT("update_time");
        sql.SELECT("exception_status");
        sql.SELECT("exception_msg");
        sql.SELECT("ext_1");
        sql.SELECT("ext_2");
        sql.SELECT("ext_3");
        sql.FROM("bs_order_meituan");
        applyWhere(sql, example, false);
        
        if (example != null && example.getOrderByClause() != null) {
            sql.ORDER_BY(example.getOrderByClause());
        }
        
        return sql.toString();
    }

    public String updateByExampleSelective(Map<String, Object> parameter) {
        BsOrderMeituan record = (BsOrderMeituan) parameter.get("record");
        BsOrderMeituanExample example = (BsOrderMeituanExample) parameter.get("example");
        
        SQL sql = new SQL();
        sql.UPDATE("bs_order_meituan");
        
        if (record.getId() != null) {
            sql.SET("id = #{record.id,jdbcType=BIGINT}");
        }
        
        if (record.getOrderNo() != null) {
            sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
        }
        
        if (record.getChildOrderNo() != null) {
            sql.SET("child_order_no = #{record.childOrderNo,jdbcType=VARCHAR}");
        }
        
        if (record.getTradeNo() != null) {
            sql.SET("trade_no = #{record.tradeNo,jdbcType=VARCHAR}");
        }
        
        if (record.getThirdTradeNo() != null) {
            sql.SET("third_trade_no = #{record.thirdTradeNo,jdbcType=VARCHAR}");
        }
        
        if (record.getSqtBizOrderId() != null) {
            sql.SET("sqt_biz_order_id = #{record.sqtBizOrderId,jdbcType=VARCHAR}");
        }
        
        if (record.getMerId() != null) {
            sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
        }
        
        if (record.getMerName() != null) {
            sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}");
        }
        
        if (record.getUserId() != null) {
            sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
        }
        
        if (record.getUserPhone() != null) {
            sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
        }
        
        if (record.getFirstBusinessType() != null) {
            sql.SET("first_business_type = #{record.firstBusinessType,jdbcType=VARCHAR}");
        }
        
        if (record.getSecondBusinessType() != null) {
            sql.SET("second_business_type = #{record.secondBusinessType,jdbcType=VARCHAR}");
        }
        
        if (record.getEntId() != null) {
            sql.SET("ent_id = #{record.entId,jdbcType=BIGINT}");
        }
        
        if (record.getImg() != null) {
            sql.SET("img = #{record.img,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsName() != null) {
            sql.SET("goods_name = #{record.goodsName,jdbcType=VARCHAR}");
        }
        
        if (record.getTraceId() != null) {
            sql.SET("trace_id = #{record.traceId,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsCount() != null) {
            sql.SET("goods_count = #{record.goodsCount,jdbcType=INTEGER}");
        }
        
        if (record.getTotalPrice() != null) {
            sql.SET("total_price = #{record.totalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getTotalDeductionPrice() != null) {
            sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getCouponDiscountPrice() != null) {
            sql.SET("coupon_discount_price = #{record.couponDiscountPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getIntegralDiscountPrice() != null) {
            sql.SET("integral_discount_price = #{record.integralDiscountPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPlatformCode() != null) {
            sql.SET("platform_code = #{record.platformCode,jdbcType=VARCHAR}");
        }
        
        if (record.getNotifyUrl() != null) {
            sql.SET("notify_url = #{record.notifyUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getReturnUrl() != null) {
            sql.SET("return_url = #{record.returnUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getPayRealPrice() != null) {
            sql.SET("pay_real_price = #{record.payRealPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getEntPayAmount() != null) {
            sql.SET("ent_pay_amount = #{record.entPayAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getTradeAmount() != null) {
            sql.SET("trade_amount = #{record.tradeAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getBusinessDiscountPayAmount() != null) {
            sql.SET("business_discount_pay_amount = #{record.businessDiscountPayAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getServiceFeeAmount() != null) {
            sql.SET("service_fee_amount = #{record.serviceFeeAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getServicePrice() != null) {
            sql.SET("service_price = #{record.servicePrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPayChannel() != null) {
            sql.SET("pay_channel = #{record.payChannel,jdbcType=INTEGER}");
        }
        
        if (record.getPaySerialNo() != null) {
            sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
        }
        
        if (record.getPayType() != null) {
            sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
        }
        
        if (record.getMeituanStatus() != null) {
            sql.SET("meituan_status = #{record.meituanStatus,jdbcType=INTEGER}");
        }
        
        if (record.getStaffInfo() != null) {
            sql.SET("staff_info = #{record.staffInfo,jdbcType=VARCHAR}");
        }
        
        if (record.getBusinessInfo() != null) {
            sql.SET("business_info = #{record.businessInfo,jdbcType=VARCHAR}");
        }
        
        if (record.getTradeExpiringTime() != null) {
            sql.SET("trade_expiring_time = #{record.tradeExpiringTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getPayTime() != null) {
            sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getCancelTime() != null) {
            sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRefundTime() != null) {
            sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getFinishTime() != null) {
            sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getExceptionStatus() != null) {
            sql.SET("exception_status = #{record.exceptionStatus,jdbcType=BIT}");
        }
        
        if (record.getExceptionMsg() != null) {
            sql.SET("exception_msg = #{record.exceptionMsg,jdbcType=VARCHAR}");
        }
        
        if (record.getExt1() != null) {
            sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
        }
        
        if (record.getExt2() != null) {
            sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
        }
        
        if (record.getExt3() != null) {
            sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
        }
        
        applyWhere(sql, example, true);
        return sql.toString();
    }

    public String updateByExample(Map<String, Object> parameter) {
        SQL sql = new SQL();
        sql.UPDATE("bs_order_meituan");
        
        sql.SET("id = #{record.id,jdbcType=BIGINT}");
        sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
        sql.SET("child_order_no = #{record.childOrderNo,jdbcType=VARCHAR}");
        sql.SET("trade_no = #{record.tradeNo,jdbcType=VARCHAR}");
        sql.SET("third_trade_no = #{record.thirdTradeNo,jdbcType=VARCHAR}");
        sql.SET("sqt_biz_order_id = #{record.sqtBizOrderId,jdbcType=VARCHAR}");
        sql.SET("mer_id = #{record.merId,jdbcType=BIGINT}");
        sql.SET("mer_name = #{record.merName,jdbcType=VARCHAR}");
        sql.SET("user_id = #{record.userId,jdbcType=BIGINT}");
        sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}");
        sql.SET("first_business_type = #{record.firstBusinessType,jdbcType=VARCHAR}");
        sql.SET("second_business_type = #{record.secondBusinessType,jdbcType=VARCHAR}");
        sql.SET("ent_id = #{record.entId,jdbcType=BIGINT}");
        sql.SET("img = #{record.img,jdbcType=VARCHAR}");
        sql.SET("goods_name = #{record.goodsName,jdbcType=VARCHAR}");
        sql.SET("trace_id = #{record.traceId,jdbcType=VARCHAR}");
        sql.SET("goods_count = #{record.goodsCount,jdbcType=INTEGER}");
        sql.SET("total_price = #{record.totalPrice,jdbcType=DECIMAL}");
        sql.SET("total_deduction_price = #{record.totalDeductionPrice,jdbcType=DECIMAL}");
        sql.SET("coupon_discount_price = #{record.couponDiscountPrice,jdbcType=DECIMAL}");
        sql.SET("integral_discount_price = #{record.integralDiscountPrice,jdbcType=DECIMAL}");
        sql.SET("platform_code = #{record.platformCode,jdbcType=VARCHAR}");
        sql.SET("notify_url = #{record.notifyUrl,jdbcType=VARCHAR}");
        sql.SET("return_url = #{record.returnUrl,jdbcType=VARCHAR}");
        sql.SET("pay_real_price = #{record.payRealPrice,jdbcType=DECIMAL}");
        sql.SET("ent_pay_amount = #{record.entPayAmount,jdbcType=DECIMAL}");
        sql.SET("trade_amount = #{record.tradeAmount,jdbcType=DECIMAL}");
        sql.SET("business_discount_pay_amount = #{record.businessDiscountPayAmount,jdbcType=DECIMAL}");
        sql.SET("service_fee_amount = #{record.serviceFeeAmount,jdbcType=DECIMAL}");
        sql.SET("service_price = #{record.servicePrice,jdbcType=DECIMAL}");
        sql.SET("pay_channel = #{record.payChannel,jdbcType=INTEGER}");
        sql.SET("pay_serial_no = #{record.paySerialNo,jdbcType=VARCHAR}");
        sql.SET("pay_type = #{record.payType,jdbcType=INTEGER}");
        sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
        sql.SET("meituan_status = #{record.meituanStatus,jdbcType=INTEGER}");
        sql.SET("staff_info = #{record.staffInfo,jdbcType=VARCHAR}");
        sql.SET("business_info = #{record.businessInfo,jdbcType=VARCHAR}");
        sql.SET("trade_expiring_time = #{record.tradeExpiringTime,jdbcType=TIMESTAMP}");
        sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}");
        sql.SET("pay_time = #{record.payTime,jdbcType=TIMESTAMP}");
        sql.SET("cancel_time = #{record.cancelTime,jdbcType=TIMESTAMP}");
        sql.SET("refund_time = #{record.refundTime,jdbcType=TIMESTAMP}");
        sql.SET("finish_time = #{record.finishTime,jdbcType=TIMESTAMP}");
        sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}");
        sql.SET("exception_status = #{record.exceptionStatus,jdbcType=BIT}");
        sql.SET("exception_msg = #{record.exceptionMsg,jdbcType=VARCHAR}");
        sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
        sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
        sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
        
        BsOrderMeituanExample example = (BsOrderMeituanExample) parameter.get("example");
        applyWhere(sql, example, true);
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(BsOrderMeituan record) {
        SQL sql = new SQL();
        sql.UPDATE("bs_order_meituan");
        
        if (record.getOrderNo() != null) {
            sql.SET("order_no = #{orderNo,jdbcType=VARCHAR}");
        }
        
        if (record.getChildOrderNo() != null) {
            sql.SET("child_order_no = #{childOrderNo,jdbcType=VARCHAR}");
        }
        
        if (record.getTradeNo() != null) {
            sql.SET("trade_no = #{tradeNo,jdbcType=VARCHAR}");
        }
        
        if (record.getThirdTradeNo() != null) {
            sql.SET("third_trade_no = #{thirdTradeNo,jdbcType=VARCHAR}");
        }
        
        if (record.getSqtBizOrderId() != null) {
            sql.SET("sqt_biz_order_id = #{sqtBizOrderId,jdbcType=VARCHAR}");
        }
        
        if (record.getMerId() != null) {
            sql.SET("mer_id = #{merId,jdbcType=BIGINT}");
        }
        
        if (record.getMerName() != null) {
            sql.SET("mer_name = #{merName,jdbcType=VARCHAR}");
        }
        
        if (record.getUserId() != null) {
            sql.SET("user_id = #{userId,jdbcType=BIGINT}");
        }
        
        if (record.getUserPhone() != null) {
            sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}");
        }
        
        if (record.getFirstBusinessType() != null) {
            sql.SET("first_business_type = #{firstBusinessType,jdbcType=VARCHAR}");
        }
        
        if (record.getSecondBusinessType() != null) {
            sql.SET("second_business_type = #{secondBusinessType,jdbcType=VARCHAR}");
        }
        
        if (record.getEntId() != null) {
            sql.SET("ent_id = #{entId,jdbcType=BIGINT}");
        }
        
        if (record.getImg() != null) {
            sql.SET("img = #{img,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsName() != null) {
            sql.SET("goods_name = #{goodsName,jdbcType=VARCHAR}");
        }
        
        if (record.getTraceId() != null) {
            sql.SET("trace_id = #{traceId,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsCount() != null) {
            sql.SET("goods_count = #{goodsCount,jdbcType=INTEGER}");
        }
        
        if (record.getTotalPrice() != null) {
            sql.SET("total_price = #{totalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getTotalDeductionPrice() != null) {
            sql.SET("total_deduction_price = #{totalDeductionPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getCouponDiscountPrice() != null) {
            sql.SET("coupon_discount_price = #{couponDiscountPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getIntegralDiscountPrice() != null) {
            sql.SET("integral_discount_price = #{integralDiscountPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPlatformCode() != null) {
            sql.SET("platform_code = #{platformCode,jdbcType=VARCHAR}");
        }
        
        if (record.getNotifyUrl() != null) {
            sql.SET("notify_url = #{notifyUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getReturnUrl() != null) {
            sql.SET("return_url = #{returnUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getPayRealPrice() != null) {
            sql.SET("pay_real_price = #{payRealPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getEntPayAmount() != null) {
            sql.SET("ent_pay_amount = #{entPayAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getTradeAmount() != null) {
            sql.SET("trade_amount = #{tradeAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getBusinessDiscountPayAmount() != null) {
            sql.SET("business_discount_pay_amount = #{businessDiscountPayAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getServiceFeeAmount() != null) {
            sql.SET("service_fee_amount = #{serviceFeeAmount,jdbcType=DECIMAL}");
        }
        
        if (record.getServicePrice() != null) {
            sql.SET("service_price = #{servicePrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPayChannel() != null) {
            sql.SET("pay_channel = #{payChannel,jdbcType=INTEGER}");
        }
        
        if (record.getPaySerialNo() != null) {
            sql.SET("pay_serial_no = #{paySerialNo,jdbcType=VARCHAR}");
        }
        
        if (record.getPayType() != null) {
            sql.SET("pay_type = #{payType,jdbcType=INTEGER}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("`status` = #{status,jdbcType=INTEGER}");
        }
        
        if (record.getMeituanStatus() != null) {
            sql.SET("meituan_status = #{meituanStatus,jdbcType=INTEGER}");
        }
        
        if (record.getStaffInfo() != null) {
            sql.SET("staff_info = #{staffInfo,jdbcType=VARCHAR}");
        }
        
        if (record.getBusinessInfo() != null) {
            sql.SET("business_info = #{businessInfo,jdbcType=VARCHAR}");
        }
        
        if (record.getTradeExpiringTime() != null) {
            sql.SET("trade_expiring_time = #{tradeExpiringTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getCreateTime() != null) {
            sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getPayTime() != null) {
            sql.SET("pay_time = #{payTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getCancelTime() != null) {
            sql.SET("cancel_time = #{cancelTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getRefundTime() != null) {
            sql.SET("refund_time = #{refundTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getFinishTime() != null) {
            sql.SET("finish_time = #{finishTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getExceptionStatus() != null) {
            sql.SET("exception_status = #{exceptionStatus,jdbcType=BIT}");
        }
        
        if (record.getExceptionMsg() != null) {
            sql.SET("exception_msg = #{exceptionMsg,jdbcType=VARCHAR}");
        }
        
        if (record.getExt1() != null) {
            sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
        }
        
        if (record.getExt2() != null) {
            sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}");
        }
        
        if (record.getExt3() != null) {
            sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }

    protected void applyWhere(SQL sql, BsOrderMeituanExample example, boolean includeExamplePhrase) {
        if (example == null) {
            return;
        }
        
        String parmPhrase1;
        String parmPhrase1_th;
        String parmPhrase2;
        String parmPhrase2_th;
        String parmPhrase3;
        String parmPhrase3_th;
        if (includeExamplePhrase) {
            parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}";
            parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
            parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}";
            parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
            parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}";
            parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
        } else {
            parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}";
            parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}";
            parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}";
            parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}";
            parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}";
            parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}";
        }
        
        StringBuilder sb = new StringBuilder();
        List<Criteria> oredCriteria = example.getOredCriteria();
        boolean firstCriteria = true;
        for (int i = 0; i < oredCriteria.size(); i++) {
            Criteria criteria = oredCriteria.get(i);
            if (criteria.isValid()) {
                if (firstCriteria) {
                    firstCriteria = false;
                } else {
                    sb.append(" or ");
                }
                
                sb.append('(');
                List<Criterion> criterions = criteria.getAllCriteria();
                boolean firstCriterion = true;
                for (int j = 0; j < criterions.size(); j++) {
                    Criterion criterion = criterions.get(j);
                    if (firstCriterion) {
                        firstCriterion = false;
                    } else {
                        sb.append(" and ");
                    }
                    
                    if (criterion.isNoValue()) {
                        sb.append(criterion.getCondition());
                    } else if (criterion.isSingleValue()) {
                        if (criterion.getTypeHandler() == null) {
                            sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j));
                        } else {
                            sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler()));
                        }
                    } else if (criterion.isBetweenValue()) {
                        if (criterion.getTypeHandler() == null) {
                            sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j));
                        } else {
                            sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler()));
                        }
                    } else if (criterion.isListValue()) {
                        sb.append(criterion.getCondition());
                        sb.append(" (");
                        List<?> listItems = (List<?>) criterion.getValue();
                        boolean comma = false;
                        for (int k = 0; k < listItems.size(); k++) {
                            if (comma) {
                                sb.append(", ");
                            } else {
                                comma = true;
                            }
                            if (criterion.getTypeHandler() == null) {
                                sb.append(String.format(parmPhrase3, i, j, k));
                            } else {
                                sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler()));
                            }
                        }
                        sb.append(')');
                    }
                }
                sb.append(')');
            }
        }
        
        if (sb.length() > 0) {
            sql.WHERE(sb.toString());
        }
    }
}