package com.hfkj.dao;

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

public class CyymallGoodsSqlProvider {

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

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

    public String insertSelective(CyymallGoodsWithBLOBs record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("cyymall_goods");
        
        if (record.getStoreId() != null) {
            sql.VALUES("store_id", "#{storeId,jdbcType=INTEGER}");
        }
        
        if (record.getName() != null) {
            sql.VALUES("`name`", "#{name,jdbcType=VARCHAR}");
        }
        
        if (record.getPrice() != null) {
            sql.VALUES("price", "#{price,jdbcType=DECIMAL}");
        }
        
        if (record.getOriginalPrice() != null) {
            sql.VALUES("original_price", "#{originalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getCatId() != null) {
            sql.VALUES("cat_id", "#{catId,jdbcType=INTEGER}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("`status`", "#{status,jdbcType=SMALLINT}");
        }
        
        if (record.getAddtime() != null) {
            sql.VALUES("addtime", "#{addtime,jdbcType=INTEGER}");
        }
        
        if (record.getIsDelete() != null) {
            sql.VALUES("is_delete", "#{isDelete,jdbcType=SMALLINT}");
        }
        
        if (record.getService() != null) {
            sql.VALUES("service", "#{service,jdbcType=VARCHAR}");
        }
        
        if (record.getSort() != null) {
            sql.VALUES("sort", "#{sort,jdbcType=INTEGER}");
        }
        
        if (record.getVirtualSales() != null) {
            sql.VALUES("virtual_sales", "#{virtualSales,jdbcType=INTEGER}");
        }
        
        if (record.getVideoUrl() != null) {
            sql.VALUES("video_url", "#{videoUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getUnit() != null) {
            sql.VALUES("unit", "#{unit,jdbcType=VARCHAR}");
        }
        
        if (record.getIndividualShare() != null) {
            sql.VALUES("individual_share", "#{individualShare,jdbcType=SMALLINT}");
        }
        
        if (record.getShareCommissionFirst() != null) {
            sql.VALUES("share_commission_first", "#{shareCommissionFirst,jdbcType=DECIMAL}");
        }
        
        if (record.getShareCommissionSecond() != null) {
            sql.VALUES("share_commission_second", "#{shareCommissionSecond,jdbcType=DECIMAL}");
        }
        
        if (record.getShareCommissionThird() != null) {
            sql.VALUES("share_commission_third", "#{shareCommissionThird,jdbcType=DECIMAL}");
        }
        
        if (record.getWeight() != null) {
            sql.VALUES("weight", "#{weight,jdbcType=DOUBLE}");
        }
        
        if (record.getFreight() != null) {
            sql.VALUES("freight", "#{freight,jdbcType=INTEGER}");
        }
        
        if (record.getUseAttr() != null) {
            sql.VALUES("use_attr", "#{useAttr,jdbcType=SMALLINT}");
        }
        
        if (record.getShareType() != null) {
            sql.VALUES("share_type", "#{shareType,jdbcType=INTEGER}");
        }
        
        if (record.getQuickPurchase() != null) {
            sql.VALUES("quick_purchase", "#{quickPurchase,jdbcType=SMALLINT}");
        }
        
        if (record.getHotCakes() != null) {
            sql.VALUES("hot_cakes", "#{hotCakes,jdbcType=SMALLINT}");
        }
        
        if (record.getCostPrice() != null) {
            sql.VALUES("cost_price", "#{costPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getMemberDiscount() != null) {
            sql.VALUES("member_discount", "#{memberDiscount,jdbcType=SMALLINT}");
        }
        
        if (record.getRebate() != null) {
            sql.VALUES("rebate", "#{rebate,jdbcType=DECIMAL}");
        }
        
        if (record.getMchId() != null) {
            sql.VALUES("mch_id", "#{mchId,jdbcType=INTEGER}");
        }
        
        if (record.getGoodsNum() != null) {
            sql.VALUES("goods_num", "#{goodsNum,jdbcType=INTEGER}");
        }
        
        if (record.getMchSort() != null) {
            sql.VALUES("mch_sort", "#{mchSort,jdbcType=INTEGER}");
        }
        
        if (record.getConfineCount() != null) {
            sql.VALUES("confine_count", "#{confineCount,jdbcType=INTEGER}");
        }
        
        if (record.getIsLevel() != null) {
            sql.VALUES("is_level", "#{isLevel,jdbcType=SMALLINT}");
        }
        
        if (record.getType() != null) {
            sql.VALUES("`type`", "#{type,jdbcType=SMALLINT}");
        }
        
        if (record.getIsNegotiable() != null) {
            sql.VALUES("is_negotiable", "#{isNegotiable,jdbcType=SMALLINT}");
        }
        
        if (record.getAttrSettingType() != null) {
            sql.VALUES("attr_setting_type", "#{attrSettingType,jdbcType=BIT}");
        }
        
        if (record.getViews() != null) {
            sql.VALUES("views", "#{views,jdbcType=BIGINT}");
        }
        
        if (record.getSupplierPrice() != null) {
            sql.VALUES("supplier_price", "#{supplierPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getSupplierGoodsId() != null) {
            sql.VALUES("supplier_goods_id", "#{supplierGoodsId,jdbcType=INTEGER}");
        }
        
        if (record.getSupplierId() != null) {
            sql.VALUES("supplier_id", "#{supplierId,jdbcType=INTEGER}");
        }
        
        if (record.getGoodsShareTitle() != null) {
            sql.VALUES("goods_share_title", "#{goodsShareTitle,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsShareLogo() != null) {
            sql.VALUES("goods_share_logo", "#{goodsShareLogo,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsShareDesc() != null) {
            sql.VALUES("goods_share_desc", "#{goodsShareDesc,jdbcType=VARCHAR}");
        }
        
        if (record.getIsExamine() != null) {
            sql.VALUES("is_examine", "#{isExamine,jdbcType=INTEGER}");
        }
        
        if (record.getDabaoPrice() != null) {
            sql.VALUES("dabao_price", "#{dabaoPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getBrandId() != null) {
            sql.VALUES("brand_id", "#{brandId,jdbcType=INTEGER}");
        }
        
        if (record.getKeyWord() != null) {
            sql.VALUES("key_word", "#{keyWord,jdbcType=VARCHAR}");
        }
        
        if (record.getBuyingMethod() != null) {
            sql.VALUES("buying_method", "#{buyingMethod,jdbcType=INTEGER}");
        }
        
        if (record.getBuyingMethodLevel() != null) {
            sql.VALUES("buying_method_level", "#{buyingMethodLevel,jdbcType=INTEGER}");
        }
        
        if (record.getHomeBlockId() != null) {
            sql.VALUES("home_block_id", "#{homeBlockId,jdbcType=INTEGER}");
        }
        
        if (record.getNewIndividualShare() != null) {
            sql.VALUES("new_individual_share", "#{newIndividualShare,jdbcType=INTEGER}");
        }
        
        if (record.getNewAttrSettingType() != null) {
            sql.VALUES("new_attr_setting_type", "#{newAttrSettingType,jdbcType=INTEGER}");
        }
        
        if (record.getShareCommissionBase() != null) {
            sql.VALUES("share_commission_base", "#{shareCommissionBase,jdbcType=DECIMAL}");
        }
        
        if (record.getIsSjht() != null) {
            sql.VALUES("is_sjht", "#{isSjht,jdbcType=SMALLINT}");
        }
        
        if (record.getSjhtProident() != null) {
            sql.VALUES("sjht_proIdent", "#{sjhtProident,jdbcType=VARCHAR}");
        }
        
        if (record.getIsOil() != null) {
            sql.VALUES("is_oil", "#{isOil,jdbcType=SMALLINT}");
        }
        
        if (record.getOilCoutypecode() != null) {
            sql.VALUES("oil_couTypeCode", "#{oilCoutypecode,jdbcType=VARCHAR}");
        }
        
        if (record.getIsAbholung() != null) {
            sql.VALUES("is_abholung", "#{isAbholung,jdbcType=SMALLINT}");
        }
        
        if (record.getIsTransnational() != null) {
            sql.VALUES("is_transnational", "#{isTransnational,jdbcType=SMALLINT}");
        }
        
        if (record.getGoodsTransferRate() != null) {
            sql.VALUES("goods_transfer_rate", "#{goodsTransferRate,jdbcType=INTEGER}");
        }
        
        if (record.getOilDiscount() != null) {
            sql.VALUES("oil_discount", "#{oilDiscount,jdbcType=INTEGER}");
        }
        
        if (record.getOilType() != null) {
            sql.VALUES("oil_type", "#{oilType,jdbcType=INTEGER}");
        }
        
        if (record.getDetail() != null) {
            sql.VALUES("detail", "#{detail,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getAttr() != null) {
            sql.VALUES("attr", "#{attr,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getCoverPic() != null) {
            sql.VALUES("cover_pic", "#{coverPic,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getFullCut() != null) {
            sql.VALUES("full_cut", "#{fullCut,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getIntegral() != null) {
            sql.VALUES("integral", "#{integral,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getShopId() != null) {
            sql.VALUES("shop_id", "#{shopId,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getVerifyCardId() != null) {
            sql.VALUES("verify_card_id", "#{verifyCardId,jdbcType=LONGVARCHAR}");
        }
        
        return sql.toString();
    }

    public String selectByExampleWithBLOBs(CyymallGoodsExample example) {
        SQL sql = new SQL();
        if (example != null && example.isDistinct()) {
            sql.SELECT_DISTINCT("id");
        } else {
            sql.SELECT("id");
        }
        sql.SELECT("store_id");
        sql.SELECT("`name`");
        sql.SELECT("price");
        sql.SELECT("original_price");
        sql.SELECT("cat_id");
        sql.SELECT("`status`");
        sql.SELECT("addtime");
        sql.SELECT("is_delete");
        sql.SELECT("service");
        sql.SELECT("sort");
        sql.SELECT("virtual_sales");
        sql.SELECT("video_url");
        sql.SELECT("unit");
        sql.SELECT("individual_share");
        sql.SELECT("share_commission_first");
        sql.SELECT("share_commission_second");
        sql.SELECT("share_commission_third");
        sql.SELECT("weight");
        sql.SELECT("freight");
        sql.SELECT("use_attr");
        sql.SELECT("share_type");
        sql.SELECT("quick_purchase");
        sql.SELECT("hot_cakes");
        sql.SELECT("cost_price");
        sql.SELECT("member_discount");
        sql.SELECT("rebate");
        sql.SELECT("mch_id");
        sql.SELECT("goods_num");
        sql.SELECT("mch_sort");
        sql.SELECT("confine_count");
        sql.SELECT("is_level");
        sql.SELECT("`type`");
        sql.SELECT("is_negotiable");
        sql.SELECT("attr_setting_type");
        sql.SELECT("views");
        sql.SELECT("supplier_price");
        sql.SELECT("supplier_goods_id");
        sql.SELECT("supplier_id");
        sql.SELECT("goods_share_title");
        sql.SELECT("goods_share_logo");
        sql.SELECT("goods_share_desc");
        sql.SELECT("is_examine");
        sql.SELECT("dabao_price");
        sql.SELECT("brand_id");
        sql.SELECT("key_word");
        sql.SELECT("buying_method");
        sql.SELECT("buying_method_level");
        sql.SELECT("home_block_id");
        sql.SELECT("new_individual_share");
        sql.SELECT("new_attr_setting_type");
        sql.SELECT("share_commission_base");
        sql.SELECT("is_sjht");
        sql.SELECT("sjht_proIdent");
        sql.SELECT("is_oil");
        sql.SELECT("oil_couTypeCode");
        sql.SELECT("is_abholung");
        sql.SELECT("is_transnational");
        sql.SELECT("goods_transfer_rate");
        sql.SELECT("oil_discount");
        sql.SELECT("oil_type");
        sql.SELECT("detail");
        sql.SELECT("attr");
        sql.SELECT("cover_pic");
        sql.SELECT("full_cut");
        sql.SELECT("integral");
        sql.SELECT("shop_id");
        sql.SELECT("verify_card_id");
        sql.FROM("cyymall_goods");
        applyWhere(sql, example, false);
        
        if (example != null && example.getOrderByClause() != null) {
            sql.ORDER_BY(example.getOrderByClause());
        }
        
        return sql.toString();
    }

    public String selectByExample(CyymallGoodsExample example) {
        SQL sql = new SQL();
        if (example != null && example.isDistinct()) {
            sql.SELECT_DISTINCT("id");
        } else {
            sql.SELECT("id");
        }
        sql.SELECT("store_id");
        sql.SELECT("`name`");
        sql.SELECT("price");
        sql.SELECT("original_price");
        sql.SELECT("cat_id");
        sql.SELECT("`status`");
        sql.SELECT("addtime");
        sql.SELECT("is_delete");
        sql.SELECT("service");
        sql.SELECT("sort");
        sql.SELECT("virtual_sales");
        sql.SELECT("video_url");
        sql.SELECT("unit");
        sql.SELECT("individual_share");
        sql.SELECT("share_commission_first");
        sql.SELECT("share_commission_second");
        sql.SELECT("share_commission_third");
        sql.SELECT("weight");
        sql.SELECT("freight");
        sql.SELECT("use_attr");
        sql.SELECT("share_type");
        sql.SELECT("quick_purchase");
        sql.SELECT("hot_cakes");
        sql.SELECT("cost_price");
        sql.SELECT("member_discount");
        sql.SELECT("rebate");
        sql.SELECT("mch_id");
        sql.SELECT("goods_num");
        sql.SELECT("mch_sort");
        sql.SELECT("confine_count");
        sql.SELECT("is_level");
        sql.SELECT("`type`");
        sql.SELECT("is_negotiable");
        sql.SELECT("attr_setting_type");
        sql.SELECT("views");
        sql.SELECT("supplier_price");
        sql.SELECT("supplier_goods_id");
        sql.SELECT("supplier_id");
        sql.SELECT("goods_share_title");
        sql.SELECT("goods_share_logo");
        sql.SELECT("goods_share_desc");
        sql.SELECT("is_examine");
        sql.SELECT("dabao_price");
        sql.SELECT("brand_id");
        sql.SELECT("key_word");
        sql.SELECT("buying_method");
        sql.SELECT("buying_method_level");
        sql.SELECT("home_block_id");
        sql.SELECT("new_individual_share");
        sql.SELECT("new_attr_setting_type");
        sql.SELECT("share_commission_base");
        sql.SELECT("is_sjht");
        sql.SELECT("sjht_proIdent");
        sql.SELECT("is_oil");
        sql.SELECT("oil_couTypeCode");
        sql.SELECT("is_abholung");
        sql.SELECT("is_transnational");
        sql.SELECT("goods_transfer_rate");
        sql.SELECT("oil_discount");
        sql.SELECT("oil_type");
        sql.FROM("cyymall_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) {
        CyymallGoodsWithBLOBs record = (CyymallGoodsWithBLOBs) parameter.get("record");
        CyymallGoodsExample example = (CyymallGoodsExample) parameter.get("example");
        
        SQL sql = new SQL();
        sql.UPDATE("cyymall_goods");
        
        if (record.getId() != null) {
            sql.SET("id = #{record.id,jdbcType=INTEGER}");
        }
        
        if (record.getStoreId() != null) {
            sql.SET("store_id = #{record.storeId,jdbcType=INTEGER}");
        }
        
        if (record.getName() != null) {
            sql.SET("`name` = #{record.name,jdbcType=VARCHAR}");
        }
        
        if (record.getPrice() != null) {
            sql.SET("price = #{record.price,jdbcType=DECIMAL}");
        }
        
        if (record.getOriginalPrice() != null) {
            sql.SET("original_price = #{record.originalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getCatId() != null) {
            sql.SET("cat_id = #{record.catId,jdbcType=INTEGER}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("`status` = #{record.status,jdbcType=SMALLINT}");
        }
        
        if (record.getAddtime() != null) {
            sql.SET("addtime = #{record.addtime,jdbcType=INTEGER}");
        }
        
        if (record.getIsDelete() != null) {
            sql.SET("is_delete = #{record.isDelete,jdbcType=SMALLINT}");
        }
        
        if (record.getService() != null) {
            sql.SET("service = #{record.service,jdbcType=VARCHAR}");
        }
        
        if (record.getSort() != null) {
            sql.SET("sort = #{record.sort,jdbcType=INTEGER}");
        }
        
        if (record.getVirtualSales() != null) {
            sql.SET("virtual_sales = #{record.virtualSales,jdbcType=INTEGER}");
        }
        
        if (record.getVideoUrl() != null) {
            sql.SET("video_url = #{record.videoUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getUnit() != null) {
            sql.SET("unit = #{record.unit,jdbcType=VARCHAR}");
        }
        
        if (record.getIndividualShare() != null) {
            sql.SET("individual_share = #{record.individualShare,jdbcType=SMALLINT}");
        }
        
        if (record.getShareCommissionFirst() != null) {
            sql.SET("share_commission_first = #{record.shareCommissionFirst,jdbcType=DECIMAL}");
        }
        
        if (record.getShareCommissionSecond() != null) {
            sql.SET("share_commission_second = #{record.shareCommissionSecond,jdbcType=DECIMAL}");
        }
        
        if (record.getShareCommissionThird() != null) {
            sql.SET("share_commission_third = #{record.shareCommissionThird,jdbcType=DECIMAL}");
        }
        
        if (record.getWeight() != null) {
            sql.SET("weight = #{record.weight,jdbcType=DOUBLE}");
        }
        
        if (record.getFreight() != null) {
            sql.SET("freight = #{record.freight,jdbcType=INTEGER}");
        }
        
        if (record.getUseAttr() != null) {
            sql.SET("use_attr = #{record.useAttr,jdbcType=SMALLINT}");
        }
        
        if (record.getShareType() != null) {
            sql.SET("share_type = #{record.shareType,jdbcType=INTEGER}");
        }
        
        if (record.getQuickPurchase() != null) {
            sql.SET("quick_purchase = #{record.quickPurchase,jdbcType=SMALLINT}");
        }
        
        if (record.getHotCakes() != null) {
            sql.SET("hot_cakes = #{record.hotCakes,jdbcType=SMALLINT}");
        }
        
        if (record.getCostPrice() != null) {
            sql.SET("cost_price = #{record.costPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getMemberDiscount() != null) {
            sql.SET("member_discount = #{record.memberDiscount,jdbcType=SMALLINT}");
        }
        
        if (record.getRebate() != null) {
            sql.SET("rebate = #{record.rebate,jdbcType=DECIMAL}");
        }
        
        if (record.getMchId() != null) {
            sql.SET("mch_id = #{record.mchId,jdbcType=INTEGER}");
        }
        
        if (record.getGoodsNum() != null) {
            sql.SET("goods_num = #{record.goodsNum,jdbcType=INTEGER}");
        }
        
        if (record.getMchSort() != null) {
            sql.SET("mch_sort = #{record.mchSort,jdbcType=INTEGER}");
        }
        
        if (record.getConfineCount() != null) {
            sql.SET("confine_count = #{record.confineCount,jdbcType=INTEGER}");
        }
        
        if (record.getIsLevel() != null) {
            sql.SET("is_level = #{record.isLevel,jdbcType=SMALLINT}");
        }
        
        if (record.getType() != null) {
            sql.SET("`type` = #{record.type,jdbcType=SMALLINT}");
        }
        
        if (record.getIsNegotiable() != null) {
            sql.SET("is_negotiable = #{record.isNegotiable,jdbcType=SMALLINT}");
        }
        
        if (record.getAttrSettingType() != null) {
            sql.SET("attr_setting_type = #{record.attrSettingType,jdbcType=BIT}");
        }
        
        if (record.getViews() != null) {
            sql.SET("views = #{record.views,jdbcType=BIGINT}");
        }
        
        if (record.getSupplierPrice() != null) {
            sql.SET("supplier_price = #{record.supplierPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getSupplierGoodsId() != null) {
            sql.SET("supplier_goods_id = #{record.supplierGoodsId,jdbcType=INTEGER}");
        }
        
        if (record.getSupplierId() != null) {
            sql.SET("supplier_id = #{record.supplierId,jdbcType=INTEGER}");
        }
        
        if (record.getGoodsShareTitle() != null) {
            sql.SET("goods_share_title = #{record.goodsShareTitle,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsShareLogo() != null) {
            sql.SET("goods_share_logo = #{record.goodsShareLogo,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsShareDesc() != null) {
            sql.SET("goods_share_desc = #{record.goodsShareDesc,jdbcType=VARCHAR}");
        }
        
        if (record.getIsExamine() != null) {
            sql.SET("is_examine = #{record.isExamine,jdbcType=INTEGER}");
        }
        
        if (record.getDabaoPrice() != null) {
            sql.SET("dabao_price = #{record.dabaoPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getBrandId() != null) {
            sql.SET("brand_id = #{record.brandId,jdbcType=INTEGER}");
        }
        
        if (record.getKeyWord() != null) {
            sql.SET("key_word = #{record.keyWord,jdbcType=VARCHAR}");
        }
        
        if (record.getBuyingMethod() != null) {
            sql.SET("buying_method = #{record.buyingMethod,jdbcType=INTEGER}");
        }
        
        if (record.getBuyingMethodLevel() != null) {
            sql.SET("buying_method_level = #{record.buyingMethodLevel,jdbcType=INTEGER}");
        }
        
        if (record.getHomeBlockId() != null) {
            sql.SET("home_block_id = #{record.homeBlockId,jdbcType=INTEGER}");
        }
        
        if (record.getNewIndividualShare() != null) {
            sql.SET("new_individual_share = #{record.newIndividualShare,jdbcType=INTEGER}");
        }
        
        if (record.getNewAttrSettingType() != null) {
            sql.SET("new_attr_setting_type = #{record.newAttrSettingType,jdbcType=INTEGER}");
        }
        
        if (record.getShareCommissionBase() != null) {
            sql.SET("share_commission_base = #{record.shareCommissionBase,jdbcType=DECIMAL}");
        }
        
        if (record.getIsSjht() != null) {
            sql.SET("is_sjht = #{record.isSjht,jdbcType=SMALLINT}");
        }
        
        if (record.getSjhtProident() != null) {
            sql.SET("sjht_proIdent = #{record.sjhtProident,jdbcType=VARCHAR}");
        }
        
        if (record.getIsOil() != null) {
            sql.SET("is_oil = #{record.isOil,jdbcType=SMALLINT}");
        }
        
        if (record.getOilCoutypecode() != null) {
            sql.SET("oil_couTypeCode = #{record.oilCoutypecode,jdbcType=VARCHAR}");
        }
        
        if (record.getIsAbholung() != null) {
            sql.SET("is_abholung = #{record.isAbholung,jdbcType=SMALLINT}");
        }
        
        if (record.getIsTransnational() != null) {
            sql.SET("is_transnational = #{record.isTransnational,jdbcType=SMALLINT}");
        }
        
        if (record.getGoodsTransferRate() != null) {
            sql.SET("goods_transfer_rate = #{record.goodsTransferRate,jdbcType=INTEGER}");
        }
        
        if (record.getOilDiscount() != null) {
            sql.SET("oil_discount = #{record.oilDiscount,jdbcType=INTEGER}");
        }
        
        if (record.getOilType() != null) {
            sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}");
        }
        
        if (record.getDetail() != null) {
            sql.SET("detail = #{record.detail,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getAttr() != null) {
            sql.SET("attr = #{record.attr,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getCoverPic() != null) {
            sql.SET("cover_pic = #{record.coverPic,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getFullCut() != null) {
            sql.SET("full_cut = #{record.fullCut,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getIntegral() != null) {
            sql.SET("integral = #{record.integral,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getShopId() != null) {
            sql.SET("shop_id = #{record.shopId,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getVerifyCardId() != null) {
            sql.SET("verify_card_id = #{record.verifyCardId,jdbcType=LONGVARCHAR}");
        }
        
        applyWhere(sql, example, true);
        return sql.toString();
    }

    public String updateByExampleWithBLOBs(Map<String, Object> parameter) {
        SQL sql = new SQL();
        sql.UPDATE("cyymall_goods");
        
        sql.SET("id = #{record.id,jdbcType=INTEGER}");
        sql.SET("store_id = #{record.storeId,jdbcType=INTEGER}");
        sql.SET("`name` = #{record.name,jdbcType=VARCHAR}");
        sql.SET("price = #{record.price,jdbcType=DECIMAL}");
        sql.SET("original_price = #{record.originalPrice,jdbcType=DECIMAL}");
        sql.SET("cat_id = #{record.catId,jdbcType=INTEGER}");
        sql.SET("`status` = #{record.status,jdbcType=SMALLINT}");
        sql.SET("addtime = #{record.addtime,jdbcType=INTEGER}");
        sql.SET("is_delete = #{record.isDelete,jdbcType=SMALLINT}");
        sql.SET("service = #{record.service,jdbcType=VARCHAR}");
        sql.SET("sort = #{record.sort,jdbcType=INTEGER}");
        sql.SET("virtual_sales = #{record.virtualSales,jdbcType=INTEGER}");
        sql.SET("video_url = #{record.videoUrl,jdbcType=VARCHAR}");
        sql.SET("unit = #{record.unit,jdbcType=VARCHAR}");
        sql.SET("individual_share = #{record.individualShare,jdbcType=SMALLINT}");
        sql.SET("share_commission_first = #{record.shareCommissionFirst,jdbcType=DECIMAL}");
        sql.SET("share_commission_second = #{record.shareCommissionSecond,jdbcType=DECIMAL}");
        sql.SET("share_commission_third = #{record.shareCommissionThird,jdbcType=DECIMAL}");
        sql.SET("weight = #{record.weight,jdbcType=DOUBLE}");
        sql.SET("freight = #{record.freight,jdbcType=INTEGER}");
        sql.SET("use_attr = #{record.useAttr,jdbcType=SMALLINT}");
        sql.SET("share_type = #{record.shareType,jdbcType=INTEGER}");
        sql.SET("quick_purchase = #{record.quickPurchase,jdbcType=SMALLINT}");
        sql.SET("hot_cakes = #{record.hotCakes,jdbcType=SMALLINT}");
        sql.SET("cost_price = #{record.costPrice,jdbcType=DECIMAL}");
        sql.SET("member_discount = #{record.memberDiscount,jdbcType=SMALLINT}");
        sql.SET("rebate = #{record.rebate,jdbcType=DECIMAL}");
        sql.SET("mch_id = #{record.mchId,jdbcType=INTEGER}");
        sql.SET("goods_num = #{record.goodsNum,jdbcType=INTEGER}");
        sql.SET("mch_sort = #{record.mchSort,jdbcType=INTEGER}");
        sql.SET("confine_count = #{record.confineCount,jdbcType=INTEGER}");
        sql.SET("is_level = #{record.isLevel,jdbcType=SMALLINT}");
        sql.SET("`type` = #{record.type,jdbcType=SMALLINT}");
        sql.SET("is_negotiable = #{record.isNegotiable,jdbcType=SMALLINT}");
        sql.SET("attr_setting_type = #{record.attrSettingType,jdbcType=BIT}");
        sql.SET("views = #{record.views,jdbcType=BIGINT}");
        sql.SET("supplier_price = #{record.supplierPrice,jdbcType=DECIMAL}");
        sql.SET("supplier_goods_id = #{record.supplierGoodsId,jdbcType=INTEGER}");
        sql.SET("supplier_id = #{record.supplierId,jdbcType=INTEGER}");
        sql.SET("goods_share_title = #{record.goodsShareTitle,jdbcType=VARCHAR}");
        sql.SET("goods_share_logo = #{record.goodsShareLogo,jdbcType=VARCHAR}");
        sql.SET("goods_share_desc = #{record.goodsShareDesc,jdbcType=VARCHAR}");
        sql.SET("is_examine = #{record.isExamine,jdbcType=INTEGER}");
        sql.SET("dabao_price = #{record.dabaoPrice,jdbcType=DECIMAL}");
        sql.SET("brand_id = #{record.brandId,jdbcType=INTEGER}");
        sql.SET("key_word = #{record.keyWord,jdbcType=VARCHAR}");
        sql.SET("buying_method = #{record.buyingMethod,jdbcType=INTEGER}");
        sql.SET("buying_method_level = #{record.buyingMethodLevel,jdbcType=INTEGER}");
        sql.SET("home_block_id = #{record.homeBlockId,jdbcType=INTEGER}");
        sql.SET("new_individual_share = #{record.newIndividualShare,jdbcType=INTEGER}");
        sql.SET("new_attr_setting_type = #{record.newAttrSettingType,jdbcType=INTEGER}");
        sql.SET("share_commission_base = #{record.shareCommissionBase,jdbcType=DECIMAL}");
        sql.SET("is_sjht = #{record.isSjht,jdbcType=SMALLINT}");
        sql.SET("sjht_proIdent = #{record.sjhtProident,jdbcType=VARCHAR}");
        sql.SET("is_oil = #{record.isOil,jdbcType=SMALLINT}");
        sql.SET("oil_couTypeCode = #{record.oilCoutypecode,jdbcType=VARCHAR}");
        sql.SET("is_abholung = #{record.isAbholung,jdbcType=SMALLINT}");
        sql.SET("is_transnational = #{record.isTransnational,jdbcType=SMALLINT}");
        sql.SET("goods_transfer_rate = #{record.goodsTransferRate,jdbcType=INTEGER}");
        sql.SET("oil_discount = #{record.oilDiscount,jdbcType=INTEGER}");
        sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}");
        sql.SET("detail = #{record.detail,jdbcType=LONGVARCHAR}");
        sql.SET("attr = #{record.attr,jdbcType=LONGVARCHAR}");
        sql.SET("cover_pic = #{record.coverPic,jdbcType=LONGVARCHAR}");
        sql.SET("full_cut = #{record.fullCut,jdbcType=LONGVARCHAR}");
        sql.SET("integral = #{record.integral,jdbcType=LONGVARCHAR}");
        sql.SET("shop_id = #{record.shopId,jdbcType=LONGVARCHAR}");
        sql.SET("verify_card_id = #{record.verifyCardId,jdbcType=LONGVARCHAR}");
        
        CyymallGoodsExample example = (CyymallGoodsExample) parameter.get("example");
        applyWhere(sql, example, true);
        return sql.toString();
    }

    public String updateByExample(Map<String, Object> parameter) {
        SQL sql = new SQL();
        sql.UPDATE("cyymall_goods");
        
        sql.SET("id = #{record.id,jdbcType=INTEGER}");
        sql.SET("store_id = #{record.storeId,jdbcType=INTEGER}");
        sql.SET("`name` = #{record.name,jdbcType=VARCHAR}");
        sql.SET("price = #{record.price,jdbcType=DECIMAL}");
        sql.SET("original_price = #{record.originalPrice,jdbcType=DECIMAL}");
        sql.SET("cat_id = #{record.catId,jdbcType=INTEGER}");
        sql.SET("`status` = #{record.status,jdbcType=SMALLINT}");
        sql.SET("addtime = #{record.addtime,jdbcType=INTEGER}");
        sql.SET("is_delete = #{record.isDelete,jdbcType=SMALLINT}");
        sql.SET("service = #{record.service,jdbcType=VARCHAR}");
        sql.SET("sort = #{record.sort,jdbcType=INTEGER}");
        sql.SET("virtual_sales = #{record.virtualSales,jdbcType=INTEGER}");
        sql.SET("video_url = #{record.videoUrl,jdbcType=VARCHAR}");
        sql.SET("unit = #{record.unit,jdbcType=VARCHAR}");
        sql.SET("individual_share = #{record.individualShare,jdbcType=SMALLINT}");
        sql.SET("share_commission_first = #{record.shareCommissionFirst,jdbcType=DECIMAL}");
        sql.SET("share_commission_second = #{record.shareCommissionSecond,jdbcType=DECIMAL}");
        sql.SET("share_commission_third = #{record.shareCommissionThird,jdbcType=DECIMAL}");
        sql.SET("weight = #{record.weight,jdbcType=DOUBLE}");
        sql.SET("freight = #{record.freight,jdbcType=INTEGER}");
        sql.SET("use_attr = #{record.useAttr,jdbcType=SMALLINT}");
        sql.SET("share_type = #{record.shareType,jdbcType=INTEGER}");
        sql.SET("quick_purchase = #{record.quickPurchase,jdbcType=SMALLINT}");
        sql.SET("hot_cakes = #{record.hotCakes,jdbcType=SMALLINT}");
        sql.SET("cost_price = #{record.costPrice,jdbcType=DECIMAL}");
        sql.SET("member_discount = #{record.memberDiscount,jdbcType=SMALLINT}");
        sql.SET("rebate = #{record.rebate,jdbcType=DECIMAL}");
        sql.SET("mch_id = #{record.mchId,jdbcType=INTEGER}");
        sql.SET("goods_num = #{record.goodsNum,jdbcType=INTEGER}");
        sql.SET("mch_sort = #{record.mchSort,jdbcType=INTEGER}");
        sql.SET("confine_count = #{record.confineCount,jdbcType=INTEGER}");
        sql.SET("is_level = #{record.isLevel,jdbcType=SMALLINT}");
        sql.SET("`type` = #{record.type,jdbcType=SMALLINT}");
        sql.SET("is_negotiable = #{record.isNegotiable,jdbcType=SMALLINT}");
        sql.SET("attr_setting_type = #{record.attrSettingType,jdbcType=BIT}");
        sql.SET("views = #{record.views,jdbcType=BIGINT}");
        sql.SET("supplier_price = #{record.supplierPrice,jdbcType=DECIMAL}");
        sql.SET("supplier_goods_id = #{record.supplierGoodsId,jdbcType=INTEGER}");
        sql.SET("supplier_id = #{record.supplierId,jdbcType=INTEGER}");
        sql.SET("goods_share_title = #{record.goodsShareTitle,jdbcType=VARCHAR}");
        sql.SET("goods_share_logo = #{record.goodsShareLogo,jdbcType=VARCHAR}");
        sql.SET("goods_share_desc = #{record.goodsShareDesc,jdbcType=VARCHAR}");
        sql.SET("is_examine = #{record.isExamine,jdbcType=INTEGER}");
        sql.SET("dabao_price = #{record.dabaoPrice,jdbcType=DECIMAL}");
        sql.SET("brand_id = #{record.brandId,jdbcType=INTEGER}");
        sql.SET("key_word = #{record.keyWord,jdbcType=VARCHAR}");
        sql.SET("buying_method = #{record.buyingMethod,jdbcType=INTEGER}");
        sql.SET("buying_method_level = #{record.buyingMethodLevel,jdbcType=INTEGER}");
        sql.SET("home_block_id = #{record.homeBlockId,jdbcType=INTEGER}");
        sql.SET("new_individual_share = #{record.newIndividualShare,jdbcType=INTEGER}");
        sql.SET("new_attr_setting_type = #{record.newAttrSettingType,jdbcType=INTEGER}");
        sql.SET("share_commission_base = #{record.shareCommissionBase,jdbcType=DECIMAL}");
        sql.SET("is_sjht = #{record.isSjht,jdbcType=SMALLINT}");
        sql.SET("sjht_proIdent = #{record.sjhtProident,jdbcType=VARCHAR}");
        sql.SET("is_oil = #{record.isOil,jdbcType=SMALLINT}");
        sql.SET("oil_couTypeCode = #{record.oilCoutypecode,jdbcType=VARCHAR}");
        sql.SET("is_abholung = #{record.isAbholung,jdbcType=SMALLINT}");
        sql.SET("is_transnational = #{record.isTransnational,jdbcType=SMALLINT}");
        sql.SET("goods_transfer_rate = #{record.goodsTransferRate,jdbcType=INTEGER}");
        sql.SET("oil_discount = #{record.oilDiscount,jdbcType=INTEGER}");
        sql.SET("oil_type = #{record.oilType,jdbcType=INTEGER}");
        
        CyymallGoodsExample example = (CyymallGoodsExample) parameter.get("example");
        applyWhere(sql, example, true);
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(CyymallGoodsWithBLOBs record) {
        SQL sql = new SQL();
        sql.UPDATE("cyymall_goods");
        
        if (record.getStoreId() != null) {
            sql.SET("store_id = #{storeId,jdbcType=INTEGER}");
        }
        
        if (record.getName() != null) {
            sql.SET("`name` = #{name,jdbcType=VARCHAR}");
        }
        
        if (record.getPrice() != null) {
            sql.SET("price = #{price,jdbcType=DECIMAL}");
        }
        
        if (record.getOriginalPrice() != null) {
            sql.SET("original_price = #{originalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getCatId() != null) {
            sql.SET("cat_id = #{catId,jdbcType=INTEGER}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("`status` = #{status,jdbcType=SMALLINT}");
        }
        
        if (record.getAddtime() != null) {
            sql.SET("addtime = #{addtime,jdbcType=INTEGER}");
        }
        
        if (record.getIsDelete() != null) {
            sql.SET("is_delete = #{isDelete,jdbcType=SMALLINT}");
        }
        
        if (record.getService() != null) {
            sql.SET("service = #{service,jdbcType=VARCHAR}");
        }
        
        if (record.getSort() != null) {
            sql.SET("sort = #{sort,jdbcType=INTEGER}");
        }
        
        if (record.getVirtualSales() != null) {
            sql.SET("virtual_sales = #{virtualSales,jdbcType=INTEGER}");
        }
        
        if (record.getVideoUrl() != null) {
            sql.SET("video_url = #{videoUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getUnit() != null) {
            sql.SET("unit = #{unit,jdbcType=VARCHAR}");
        }
        
        if (record.getIndividualShare() != null) {
            sql.SET("individual_share = #{individualShare,jdbcType=SMALLINT}");
        }
        
        if (record.getShareCommissionFirst() != null) {
            sql.SET("share_commission_first = #{shareCommissionFirst,jdbcType=DECIMAL}");
        }
        
        if (record.getShareCommissionSecond() != null) {
            sql.SET("share_commission_second = #{shareCommissionSecond,jdbcType=DECIMAL}");
        }
        
        if (record.getShareCommissionThird() != null) {
            sql.SET("share_commission_third = #{shareCommissionThird,jdbcType=DECIMAL}");
        }
        
        if (record.getWeight() != null) {
            sql.SET("weight = #{weight,jdbcType=DOUBLE}");
        }
        
        if (record.getFreight() != null) {
            sql.SET("freight = #{freight,jdbcType=INTEGER}");
        }
        
        if (record.getUseAttr() != null) {
            sql.SET("use_attr = #{useAttr,jdbcType=SMALLINT}");
        }
        
        if (record.getShareType() != null) {
            sql.SET("share_type = #{shareType,jdbcType=INTEGER}");
        }
        
        if (record.getQuickPurchase() != null) {
            sql.SET("quick_purchase = #{quickPurchase,jdbcType=SMALLINT}");
        }
        
        if (record.getHotCakes() != null) {
            sql.SET("hot_cakes = #{hotCakes,jdbcType=SMALLINT}");
        }
        
        if (record.getCostPrice() != null) {
            sql.SET("cost_price = #{costPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getMemberDiscount() != null) {
            sql.SET("member_discount = #{memberDiscount,jdbcType=SMALLINT}");
        }
        
        if (record.getRebate() != null) {
            sql.SET("rebate = #{rebate,jdbcType=DECIMAL}");
        }
        
        if (record.getMchId() != null) {
            sql.SET("mch_id = #{mchId,jdbcType=INTEGER}");
        }
        
        if (record.getGoodsNum() != null) {
            sql.SET("goods_num = #{goodsNum,jdbcType=INTEGER}");
        }
        
        if (record.getMchSort() != null) {
            sql.SET("mch_sort = #{mchSort,jdbcType=INTEGER}");
        }
        
        if (record.getConfineCount() != null) {
            sql.SET("confine_count = #{confineCount,jdbcType=INTEGER}");
        }
        
        if (record.getIsLevel() != null) {
            sql.SET("is_level = #{isLevel,jdbcType=SMALLINT}");
        }
        
        if (record.getType() != null) {
            sql.SET("`type` = #{type,jdbcType=SMALLINT}");
        }
        
        if (record.getIsNegotiable() != null) {
            sql.SET("is_negotiable = #{isNegotiable,jdbcType=SMALLINT}");
        }
        
        if (record.getAttrSettingType() != null) {
            sql.SET("attr_setting_type = #{attrSettingType,jdbcType=BIT}");
        }
        
        if (record.getViews() != null) {
            sql.SET("views = #{views,jdbcType=BIGINT}");
        }
        
        if (record.getSupplierPrice() != null) {
            sql.SET("supplier_price = #{supplierPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getSupplierGoodsId() != null) {
            sql.SET("supplier_goods_id = #{supplierGoodsId,jdbcType=INTEGER}");
        }
        
        if (record.getSupplierId() != null) {
            sql.SET("supplier_id = #{supplierId,jdbcType=INTEGER}");
        }
        
        if (record.getGoodsShareTitle() != null) {
            sql.SET("goods_share_title = #{goodsShareTitle,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsShareLogo() != null) {
            sql.SET("goods_share_logo = #{goodsShareLogo,jdbcType=VARCHAR}");
        }
        
        if (record.getGoodsShareDesc() != null) {
            sql.SET("goods_share_desc = #{goodsShareDesc,jdbcType=VARCHAR}");
        }
        
        if (record.getIsExamine() != null) {
            sql.SET("is_examine = #{isExamine,jdbcType=INTEGER}");
        }
        
        if (record.getDabaoPrice() != null) {
            sql.SET("dabao_price = #{dabaoPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getBrandId() != null) {
            sql.SET("brand_id = #{brandId,jdbcType=INTEGER}");
        }
        
        if (record.getKeyWord() != null) {
            sql.SET("key_word = #{keyWord,jdbcType=VARCHAR}");
        }
        
        if (record.getBuyingMethod() != null) {
            sql.SET("buying_method = #{buyingMethod,jdbcType=INTEGER}");
        }
        
        if (record.getBuyingMethodLevel() != null) {
            sql.SET("buying_method_level = #{buyingMethodLevel,jdbcType=INTEGER}");
        }
        
        if (record.getHomeBlockId() != null) {
            sql.SET("home_block_id = #{homeBlockId,jdbcType=INTEGER}");
        }
        
        if (record.getNewIndividualShare() != null) {
            sql.SET("new_individual_share = #{newIndividualShare,jdbcType=INTEGER}");
        }
        
        if (record.getNewAttrSettingType() != null) {
            sql.SET("new_attr_setting_type = #{newAttrSettingType,jdbcType=INTEGER}");
        }
        
        if (record.getShareCommissionBase() != null) {
            sql.SET("share_commission_base = #{shareCommissionBase,jdbcType=DECIMAL}");
        }
        
        if (record.getIsSjht() != null) {
            sql.SET("is_sjht = #{isSjht,jdbcType=SMALLINT}");
        }
        
        if (record.getSjhtProident() != null) {
            sql.SET("sjht_proIdent = #{sjhtProident,jdbcType=VARCHAR}");
        }
        
        if (record.getIsOil() != null) {
            sql.SET("is_oil = #{isOil,jdbcType=SMALLINT}");
        }
        
        if (record.getOilCoutypecode() != null) {
            sql.SET("oil_couTypeCode = #{oilCoutypecode,jdbcType=VARCHAR}");
        }
        
        if (record.getIsAbholung() != null) {
            sql.SET("is_abholung = #{isAbholung,jdbcType=SMALLINT}");
        }
        
        if (record.getIsTransnational() != null) {
            sql.SET("is_transnational = #{isTransnational,jdbcType=SMALLINT}");
        }
        
        if (record.getGoodsTransferRate() != null) {
            sql.SET("goods_transfer_rate = #{goodsTransferRate,jdbcType=INTEGER}");
        }
        
        if (record.getOilDiscount() != null) {
            sql.SET("oil_discount = #{oilDiscount,jdbcType=INTEGER}");
        }
        
        if (record.getOilType() != null) {
            sql.SET("oil_type = #{oilType,jdbcType=INTEGER}");
        }
        
        if (record.getDetail() != null) {
            sql.SET("detail = #{detail,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getAttr() != null) {
            sql.SET("attr = #{attr,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getCoverPic() != null) {
            sql.SET("cover_pic = #{coverPic,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getFullCut() != null) {
            sql.SET("full_cut = #{fullCut,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getIntegral() != null) {
            sql.SET("integral = #{integral,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getShopId() != null) {
            sql.SET("shop_id = #{shopId,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getVerifyCardId() != null) {
            sql.SET("verify_card_id = #{verifyCardId,jdbcType=LONGVARCHAR}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }

    protected void applyWhere(SQL sql, CyymallGoodsExample 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());
        }
    }
}