package com.hfkj.dao;

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

public class BsOrderGoodsSqlProvider {

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

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

    public String insertSelective(BsOrderGoods record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("bs_order_goods");
        
        if (record.getLogisticsNo() != null) {
            sql.VALUES("logistics_no", "#{logisticsNo,jdbcType=VARCHAR}");
        }
        
        if (record.getFreightPrice() != null) {
            sql.VALUES("freight_price", "#{freightPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getDeliveryAddressId() != null) {
            sql.VALUES("delivery_address_id", "#{deliveryAddressId,jdbcType=BIGINT}");
        }
        
        if (record.getDeliveryAddress() != null) {
            sql.VALUES("delivery_address", "#{deliveryAddress,jdbcType=VARCHAR}");
        }
        
        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.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.getGoodsId() != null) {
            sql.VALUES("goods_id", "#{goodsId,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.getGoodsTypeId() != null) {
            sql.VALUES("goods_type_id", "#{goodsTypeId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsTypeName() != null) {
            sql.VALUES("goods_type_name", "#{goodsTypeName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsBrandId() != null) {
            sql.VALUES("goods_brand_id", "#{goodsBrandId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsBrandName() != null) {
            sql.VALUES("goods_brand_name", "#{goodsBrandName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsSpecsId() != null) {
            sql.VALUES("goods_specs_id", "#{goodsSpecsId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsSpecsName() != null) {
            sql.VALUES("goods_specs_name", "#{goodsSpecsName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsSpecsOriginalPrice() != null) {
            sql.VALUES("goods_specs_original_price", "#{goodsSpecsOriginalPrice,jdbcType=DECIMAL}");
        }
        
        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.getPayRealPrice() != null) {
            sql.VALUES("pay_real_price", "#{payRealPrice,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.getLogisticsStatusDesc() != null) {
            sql.VALUES("logistics_status_desc", "#{logisticsStatusDesc,jdbcType=VARCHAR}");
        }
        
        if (record.getLogisticsStatus() != null) {
            sql.VALUES("logistics_status", "#{logisticsStatus,jdbcType=VARCHAR}");
        }
        
        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(BsOrderGoodsExample example) {
        SQL sql = new SQL();
        if (example != null && example.isDistinct()) {
            sql.SELECT_DISTINCT("id");
        } else {
            sql.SELECT("id");
        }
        sql.SELECT("logistics_no");
        sql.SELECT("freight_price");
        sql.SELECT("delivery_address_id");
        sql.SELECT("delivery_address");
        sql.SELECT("order_no");
        sql.SELECT("child_order_no");
        sql.SELECT("mer_id");
        sql.SELECT("mer_name");
        sql.SELECT("user_id");
        sql.SELECT("user_phone");
        sql.SELECT("goods_id");
        sql.SELECT("img");
        sql.SELECT("goods_name");
        sql.SELECT("goods_type_id");
        sql.SELECT("goods_type_name");
        sql.SELECT("goods_brand_id");
        sql.SELECT("goods_brand_name");
        sql.SELECT("goods_specs_id");
        sql.SELECT("goods_specs_name");
        sql.SELECT("goods_specs_original_price");
        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("pay_real_price");
        sql.SELECT("pay_channel");
        sql.SELECT("pay_serial_no");
        sql.SELECT("pay_type");
        sql.SELECT("`status`");
        sql.SELECT("logistics_status_desc");
        sql.SELECT("logistics_status");
        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_goods");
        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) {
        BsOrderGoods record = (BsOrderGoods) parameter.get("record");
        BsOrderGoodsExample example = (BsOrderGoodsExample) parameter.get("example");
        
        SQL sql = new SQL();
        sql.UPDATE("bs_order_goods");
        
        if (record.getId() != null) {
            sql.SET("id = #{record.id,jdbcType=BIGINT}");
        }
        
        if (record.getLogisticsNo() != null) {
            sql.SET("logistics_no = #{record.logisticsNo,jdbcType=VARCHAR}");
        }
        
        if (record.getFreightPrice() != null) {
            sql.SET("freight_price = #{record.freightPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getDeliveryAddressId() != null) {
            sql.SET("delivery_address_id = #{record.deliveryAddressId,jdbcType=BIGINT}");
        }
        
        if (record.getDeliveryAddress() != null) {
            sql.SET("delivery_address = #{record.deliveryAddress,jdbcType=VARCHAR}");
        }
        
        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.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.getGoodsId() != null) {
            sql.SET("goods_id = #{record.goodsId,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.getGoodsTypeId() != null) {
            sql.SET("goods_type_id = #{record.goodsTypeId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsTypeName() != null) {
            sql.SET("goods_type_name = #{record.goodsTypeName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsBrandId() != null) {
            sql.SET("goods_brand_id = #{record.goodsBrandId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsBrandName() != null) {
            sql.SET("goods_brand_name = #{record.goodsBrandName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsSpecsId() != null) {
            sql.SET("goods_specs_id = #{record.goodsSpecsId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsSpecsName() != null) {
            sql.SET("goods_specs_name = #{record.goodsSpecsName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsSpecsOriginalPrice() != null) {
            sql.SET("goods_specs_original_price = #{record.goodsSpecsOriginalPrice,jdbcType=DECIMAL}");
        }
        
        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.getPayRealPrice() != null) {
            sql.SET("pay_real_price = #{record.payRealPrice,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.getLogisticsStatusDesc() != null) {
            sql.SET("logistics_status_desc = #{record.logisticsStatusDesc,jdbcType=VARCHAR}");
        }
        
        if (record.getLogisticsStatus() != null) {
            sql.SET("logistics_status = #{record.logisticsStatus,jdbcType=VARCHAR}");
        }
        
        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_goods");
        
        sql.SET("id = #{record.id,jdbcType=BIGINT}");
        sql.SET("logistics_no = #{record.logisticsNo,jdbcType=VARCHAR}");
        sql.SET("freight_price = #{record.freightPrice,jdbcType=DECIMAL}");
        sql.SET("delivery_address_id = #{record.deliveryAddressId,jdbcType=BIGINT}");
        sql.SET("delivery_address = #{record.deliveryAddress,jdbcType=VARCHAR}");
        sql.SET("order_no = #{record.orderNo,jdbcType=VARCHAR}");
        sql.SET("child_order_no = #{record.childOrderNo,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("goods_id = #{record.goodsId,jdbcType=BIGINT}");
        sql.SET("img = #{record.img,jdbcType=VARCHAR}");
        sql.SET("goods_name = #{record.goodsName,jdbcType=VARCHAR}");
        sql.SET("goods_type_id = #{record.goodsTypeId,jdbcType=BIGINT}");
        sql.SET("goods_type_name = #{record.goodsTypeName,jdbcType=VARCHAR}");
        sql.SET("goods_brand_id = #{record.goodsBrandId,jdbcType=BIGINT}");
        sql.SET("goods_brand_name = #{record.goodsBrandName,jdbcType=VARCHAR}");
        sql.SET("goods_specs_id = #{record.goodsSpecsId,jdbcType=BIGINT}");
        sql.SET("goods_specs_name = #{record.goodsSpecsName,jdbcType=VARCHAR}");
        sql.SET("goods_specs_original_price = #{record.goodsSpecsOriginalPrice,jdbcType=DECIMAL}");
        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("pay_real_price = #{record.payRealPrice,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("logistics_status_desc = #{record.logisticsStatusDesc,jdbcType=VARCHAR}");
        sql.SET("logistics_status = #{record.logisticsStatus,jdbcType=VARCHAR}");
        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}");
        
        BsOrderGoodsExample example = (BsOrderGoodsExample) parameter.get("example");
        applyWhere(sql, example, true);
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(BsOrderGoods record) {
        SQL sql = new SQL();
        sql.UPDATE("bs_order_goods");
        
        if (record.getLogisticsNo() != null) {
            sql.SET("logistics_no = #{logisticsNo,jdbcType=VARCHAR}");
        }
        
        if (record.getFreightPrice() != null) {
            sql.SET("freight_price = #{freightPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getDeliveryAddressId() != null) {
            sql.SET("delivery_address_id = #{deliveryAddressId,jdbcType=BIGINT}");
        }
        
        if (record.getDeliveryAddress() != null) {
            sql.SET("delivery_address = #{deliveryAddress,jdbcType=VARCHAR}");
        }
        
        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.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.getGoodsId() != null) {
            sql.SET("goods_id = #{goodsId,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.getGoodsTypeId() != null) {
            sql.SET("goods_type_id = #{goodsTypeId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsTypeName() != null) {
            sql.SET("goods_type_name = #{goodsTypeName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsBrandId() != null) {
            sql.SET("goods_brand_id = #{goodsBrandId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsBrandName() != null) {
            sql.SET("goods_brand_name = #{goodsBrandName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsSpecsId() != null) {
            sql.SET("goods_specs_id = #{goodsSpecsId,jdbcType=BIGINT}");
        }
        
        if (record.getGoodsSpecsName() != null) {
            sql.SET("goods_specs_name = #{goodsSpecsName,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsSpecsOriginalPrice() != null) {
            sql.SET("goods_specs_original_price = #{goodsSpecsOriginalPrice,jdbcType=DECIMAL}");
        }
        
        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.getPayRealPrice() != null) {
            sql.SET("pay_real_price = #{payRealPrice,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.getLogisticsStatusDesc() != null) {
            sql.SET("logistics_status_desc = #{logisticsStatusDesc,jdbcType=VARCHAR}");
        }
        
        if (record.getLogisticsStatus() != null) {
            sql.SET("logistics_status = #{logisticsStatus,jdbcType=VARCHAR}");
        }
        
        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, BsOrderGoodsExample 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());
        }
    }
}