package com.hfkj.dao;

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

public class CyymallUserSqlProvider {

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

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

    public String insertSelective(CyymallUser record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("cyymall_user");
        
        if (record.getType() != null) {
            sql.VALUES("`type`", "#{type,jdbcType=SMALLINT}");
        }
        
        if (record.getUsername() != null) {
            sql.VALUES("username", "#{username,jdbcType=VARCHAR}");
        }
        
        if (record.getPassword() != null) {
            sql.VALUES("`password`", "#{password,jdbcType=VARCHAR}");
        }
        
        if (record.getAuthKey() != null) {
            sql.VALUES("auth_key", "#{authKey,jdbcType=VARCHAR}");
        }
        
        if (record.getAccessToken() != null) {
            sql.VALUES("access_token", "#{accessToken,jdbcType=VARCHAR}");
        }
        
        if (record.getAddtime() != null) {
            sql.VALUES("addtime", "#{addtime,jdbcType=INTEGER}");
        }
        
        if (record.getIsDelete() != null) {
            sql.VALUES("is_delete", "#{isDelete,jdbcType=SMALLINT}");
        }
        
        if (record.getWechatOpenId() != null) {
            sql.VALUES("wechat_open_id", "#{wechatOpenId,jdbcType=VARCHAR}");
        }
        
        if (record.getWechatUnionId() != null) {
            sql.VALUES("wechat_union_id", "#{wechatUnionId,jdbcType=VARCHAR}");
        }
        
        if (record.getNickname() != null) {
            sql.VALUES("nickname", "#{nickname,jdbcType=VARCHAR}");
        }
        
        if (record.getAvatarUrl() != null) {
            sql.VALUES("avatar_url", "#{avatarUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getStoreId() != null) {
            sql.VALUES("store_id", "#{storeId,jdbcType=INTEGER}");
        }
        
        if (record.getIsDistributor() != null) {
            sql.VALUES("is_distributor", "#{isDistributor,jdbcType=INTEGER}");
        }
        
        if (record.getParentId() != null) {
            sql.VALUES("parent_id", "#{parentId,jdbcType=INTEGER}");
        }
        
        if (record.getTime() != null) {
            sql.VALUES("`time`", "#{time,jdbcType=INTEGER}");
        }
        
        if (record.getTotalPrice() != null) {
            sql.VALUES("total_price", "#{totalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPrice() != null) {
            sql.VALUES("price", "#{price,jdbcType=DECIMAL}");
        }
        
        if (record.getIsClerk() != null) {
            sql.VALUES("is_clerk", "#{isClerk,jdbcType=INTEGER}");
        }
        
        if (record.getWe7Uid() != null) {
            sql.VALUES("we7_uid", "#{we7Uid,jdbcType=INTEGER}");
        }
        
        if (record.getShopId() != null) {
            sql.VALUES("shop_id", "#{shopId,jdbcType=INTEGER}");
        }
        
        if (record.getLevel() != null) {
            sql.VALUES("`level`", "#{level,jdbcType=INTEGER}");
        }
        
        if (record.getIntegral() != null) {
            sql.VALUES("integral", "#{integral,jdbcType=INTEGER}");
        }
        
        if (record.getTotalIntegral() != null) {
            sql.VALUES("total_integral", "#{totalIntegral,jdbcType=INTEGER}");
        }
        
        if (record.getMoney() != null) {
            sql.VALUES("money", "#{money,jdbcType=DECIMAL}");
        }
        
        if (record.getContactWay() != null) {
            sql.VALUES("contact_way", "#{contactWay,jdbcType=VARCHAR}");
        }
        
        if (record.getComments() != null) {
            sql.VALUES("comments", "#{comments,jdbcType=VARCHAR}");
        }
        
        if (record.getBinding() != null) {
            sql.VALUES("binding", "#{binding,jdbcType=CHAR}");
        }
        
        if (record.getWechatPlatformOpenId() != null) {
            sql.VALUES("wechat_platform_open_id", "#{wechatPlatformOpenId,jdbcType=VARCHAR}");
        }
        
        if (record.getPlatform() != null) {
            sql.VALUES("platform", "#{platform,jdbcType=TINYINT}");
        }
        
        if (record.getBlacklist() != null) {
            sql.VALUES("blacklist", "#{blacklist,jdbcType=BIT}");
        }
        
        if (record.getParentUserId() != null) {
            sql.VALUES("parent_user_id", "#{parentUserId,jdbcType=INTEGER}");
        }
        
        if (record.getAppcid() != null) {
            sql.VALUES("appcid", "#{appcid,jdbcType=VARCHAR}");
        }
        
        if (record.getIsAdmin() != null) {
            sql.VALUES("is_admin", "#{isAdmin,jdbcType=BIT}");
        }
        
        if (record.getTuanPrice() != null) {
            sql.VALUES("tuan_price", "#{tuanPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getIsDelivery() != null) {
            sql.VALUES("is_delivery", "#{isDelivery,jdbcType=BIT}");
        }
        
        if (record.getMchId() != null) {
            sql.VALUES("mch_id", "#{mchId,jdbcType=INTEGER}");
        }
        
        if (record.getRealName() != null) {
            sql.VALUES("real_name", "#{realName,jdbcType=VARCHAR}");
        }
        
        if (record.getRealCode() != null) {
            sql.VALUES("real_code", "#{realCode,jdbcType=VARCHAR}");
        }
        
        if (record.getRealJustPic() != null) {
            sql.VALUES("real_just_pic", "#{realJustPic,jdbcType=VARCHAR}");
        }
        
        if (record.getRealBackPic() != null) {
            sql.VALUES("real_back_pic", "#{realBackPic,jdbcType=VARCHAR}");
        }
        
        if (record.getIsReal() != null) {
            sql.VALUES("is_real", "#{isReal,jdbcType=BIT}");
        }
        
        if (record.getLivePrice() != null) {
            sql.VALUES("live_price", "#{livePrice,jdbcType=DECIMAL}");
        }
        
        if (record.getFyjine() != null) {
            sql.VALUES("fyjine", "#{fyjine,jdbcType=VARCHAR}");
        }
        
        if (record.getYifan() != null) {
            sql.VALUES("yifan", "#{yifan,jdbcType=VARCHAR}");
        }
        
        if (record.getDeliveryOffice() != null) {
            sql.VALUES("delivery_office", "#{deliveryOffice,jdbcType=BIT}");
        }
        
        if (record.getSubsidyPrice() != null) {
            sql.VALUES("subsidy_price", "#{subsidyPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getDeliveryMchId() != null) {
            sql.VALUES("delivery_mch_id", "#{deliveryMchId,jdbcType=INTEGER}");
        }
        
        if (record.getClerkMchId() != null) {
            sql.VALUES("clerk_mch_id", "#{clerkMchId,jdbcType=INTEGER}");
        }
        
        if (record.getIsGroupCentre() != null) {
            sql.VALUES("is_group_centre", "#{isGroupCentre,jdbcType=INTEGER}");
        }
        
        if (record.getSex() != null) {
            sql.VALUES("sex", "#{sex,jdbcType=INTEGER}");
        }
        
        if (record.getBirthDate() != null) {
            sql.VALUES("birth_date", "#{birthDate,jdbcType=VARCHAR}");
        }
        
        if (record.getIsVgoods() != null) {
            sql.VALUES("is_vgoods", "#{isVgoods,jdbcType=INTEGER}");
        }
        
        if (record.getShareCatId() != null) {
            sql.VALUES("share_cat_id", "#{shareCatId,jdbcType=INTEGER}");
        }
        
        if (record.getUserLabel() != null) {
            sql.VALUES("user_label", "#{userLabel,jdbcType=INTEGER}");
        }
        
        if (record.getGhCardNo() != null) {
            sql.VALUES("gh_card_no", "#{ghCardNo,jdbcType=VARCHAR}");
        }
        
        if (record.getGhCardPwd() != null) {
            sql.VALUES("gh_card_pwd", "#{ghCardPwd,jdbcType=INTEGER}");
        }
        
        if (record.getChannelPhone() != null) {
            sql.VALUES("channel_phone", "#{channelPhone,jdbcType=CHAR}");
        }
        
        if (record.getChannelSign() != null) {
            sql.VALUES("channel_sign", "#{channelSign,jdbcType=VARCHAR}");
        }
        
        if (record.getEmail() != null) {
            sql.VALUES("email", "#{email,jdbcType=VARCHAR}");
        }
        
        if (record.getApplyTime() != null) {
            sql.VALUES("apply_time", "#{applyTime,jdbcType=INTEGER}");
        }
        
        if (record.getApplyStatus() != null) {
            sql.VALUES("apply_status", "#{applyStatus,jdbcType=SMALLINT}");
        }
        
        return sql.toString();
    }

    public String selectByExample(CyymallUserExample example) {
        SQL sql = new SQL();
        if (example != null && example.isDistinct()) {
            sql.SELECT_DISTINCT("id");
        } else {
            sql.SELECT("id");
        }
        sql.SELECT("`type`");
        sql.SELECT("username");
        sql.SELECT("`password`");
        sql.SELECT("auth_key");
        sql.SELECT("access_token");
        sql.SELECT("addtime");
        sql.SELECT("is_delete");
        sql.SELECT("wechat_open_id");
        sql.SELECT("wechat_union_id");
        sql.SELECT("nickname");
        sql.SELECT("avatar_url");
        sql.SELECT("store_id");
        sql.SELECT("is_distributor");
        sql.SELECT("parent_id");
        sql.SELECT("`time`");
        sql.SELECT("total_price");
        sql.SELECT("price");
        sql.SELECT("is_clerk");
        sql.SELECT("we7_uid");
        sql.SELECT("shop_id");
        sql.SELECT("`level`");
        sql.SELECT("integral");
        sql.SELECT("total_integral");
        sql.SELECT("money");
        sql.SELECT("contact_way");
        sql.SELECT("comments");
        sql.SELECT("binding");
        sql.SELECT("wechat_platform_open_id");
        sql.SELECT("platform");
        sql.SELECT("blacklist");
        sql.SELECT("parent_user_id");
        sql.SELECT("appcid");
        sql.SELECT("is_admin");
        sql.SELECT("tuan_price");
        sql.SELECT("is_delivery");
        sql.SELECT("mch_id");
        sql.SELECT("real_name");
        sql.SELECT("real_code");
        sql.SELECT("real_just_pic");
        sql.SELECT("real_back_pic");
        sql.SELECT("is_real");
        sql.SELECT("live_price");
        sql.SELECT("fyjine");
        sql.SELECT("yifan");
        sql.SELECT("delivery_office");
        sql.SELECT("subsidy_price");
        sql.SELECT("delivery_mch_id");
        sql.SELECT("clerk_mch_id");
        sql.SELECT("is_group_centre");
        sql.SELECT("sex");
        sql.SELECT("birth_date");
        sql.SELECT("is_vgoods");
        sql.SELECT("share_cat_id");
        sql.SELECT("user_label");
        sql.SELECT("gh_card_no");
        sql.SELECT("gh_card_pwd");
        sql.SELECT("channel_phone");
        sql.SELECT("channel_sign");
        sql.SELECT("email");
        sql.SELECT("apply_time");
        sql.SELECT("apply_status");
        sql.FROM("cyymall_user");
        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) {
        CyymallUser record = (CyymallUser) parameter.get("record");
        CyymallUserExample example = (CyymallUserExample) parameter.get("example");
        
        SQL sql = new SQL();
        sql.UPDATE("cyymall_user");
        
        if (record.getId() != null) {
            sql.SET("id = #{record.id,jdbcType=INTEGER}");
        }
        
        if (record.getType() != null) {
            sql.SET("`type` = #{record.type,jdbcType=SMALLINT}");
        }
        
        if (record.getUsername() != null) {
            sql.SET("username = #{record.username,jdbcType=VARCHAR}");
        }
        
        if (record.getPassword() != null) {
            sql.SET("`password` = #{record.password,jdbcType=VARCHAR}");
        }
        
        if (record.getAuthKey() != null) {
            sql.SET("auth_key = #{record.authKey,jdbcType=VARCHAR}");
        }
        
        if (record.getAccessToken() != null) {
            sql.SET("access_token = #{record.accessToken,jdbcType=VARCHAR}");
        }
        
        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.getWechatOpenId() != null) {
            sql.SET("wechat_open_id = #{record.wechatOpenId,jdbcType=VARCHAR}");
        }
        
        if (record.getWechatUnionId() != null) {
            sql.SET("wechat_union_id = #{record.wechatUnionId,jdbcType=VARCHAR}");
        }
        
        if (record.getNickname() != null) {
            sql.SET("nickname = #{record.nickname,jdbcType=VARCHAR}");
        }
        
        if (record.getAvatarUrl() != null) {
            sql.SET("avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getStoreId() != null) {
            sql.SET("store_id = #{record.storeId,jdbcType=INTEGER}");
        }
        
        if (record.getIsDistributor() != null) {
            sql.SET("is_distributor = #{record.isDistributor,jdbcType=INTEGER}");
        }
        
        if (record.getParentId() != null) {
            sql.SET("parent_id = #{record.parentId,jdbcType=INTEGER}");
        }
        
        if (record.getTime() != null) {
            sql.SET("`time` = #{record.time,jdbcType=INTEGER}");
        }
        
        if (record.getTotalPrice() != null) {
            sql.SET("total_price = #{record.totalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPrice() != null) {
            sql.SET("price = #{record.price,jdbcType=DECIMAL}");
        }
        
        if (record.getIsClerk() != null) {
            sql.SET("is_clerk = #{record.isClerk,jdbcType=INTEGER}");
        }
        
        if (record.getWe7Uid() != null) {
            sql.SET("we7_uid = #{record.we7Uid,jdbcType=INTEGER}");
        }
        
        if (record.getShopId() != null) {
            sql.SET("shop_id = #{record.shopId,jdbcType=INTEGER}");
        }
        
        if (record.getLevel() != null) {
            sql.SET("`level` = #{record.level,jdbcType=INTEGER}");
        }
        
        if (record.getIntegral() != null) {
            sql.SET("integral = #{record.integral,jdbcType=INTEGER}");
        }
        
        if (record.getTotalIntegral() != null) {
            sql.SET("total_integral = #{record.totalIntegral,jdbcType=INTEGER}");
        }
        
        if (record.getMoney() != null) {
            sql.SET("money = #{record.money,jdbcType=DECIMAL}");
        }
        
        if (record.getContactWay() != null) {
            sql.SET("contact_way = #{record.contactWay,jdbcType=VARCHAR}");
        }
        
        if (record.getComments() != null) {
            sql.SET("comments = #{record.comments,jdbcType=VARCHAR}");
        }
        
        if (record.getBinding() != null) {
            sql.SET("binding = #{record.binding,jdbcType=CHAR}");
        }
        
        if (record.getWechatPlatformOpenId() != null) {
            sql.SET("wechat_platform_open_id = #{record.wechatPlatformOpenId,jdbcType=VARCHAR}");
        }
        
        if (record.getPlatform() != null) {
            sql.SET("platform = #{record.platform,jdbcType=TINYINT}");
        }
        
        if (record.getBlacklist() != null) {
            sql.SET("blacklist = #{record.blacklist,jdbcType=BIT}");
        }
        
        if (record.getParentUserId() != null) {
            sql.SET("parent_user_id = #{record.parentUserId,jdbcType=INTEGER}");
        }
        
        if (record.getAppcid() != null) {
            sql.SET("appcid = #{record.appcid,jdbcType=VARCHAR}");
        }
        
        if (record.getIsAdmin() != null) {
            sql.SET("is_admin = #{record.isAdmin,jdbcType=BIT}");
        }
        
        if (record.getTuanPrice() != null) {
            sql.SET("tuan_price = #{record.tuanPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getIsDelivery() != null) {
            sql.SET("is_delivery = #{record.isDelivery,jdbcType=BIT}");
        }
        
        if (record.getMchId() != null) {
            sql.SET("mch_id = #{record.mchId,jdbcType=INTEGER}");
        }
        
        if (record.getRealName() != null) {
            sql.SET("real_name = #{record.realName,jdbcType=VARCHAR}");
        }
        
        if (record.getRealCode() != null) {
            sql.SET("real_code = #{record.realCode,jdbcType=VARCHAR}");
        }
        
        if (record.getRealJustPic() != null) {
            sql.SET("real_just_pic = #{record.realJustPic,jdbcType=VARCHAR}");
        }
        
        if (record.getRealBackPic() != null) {
            sql.SET("real_back_pic = #{record.realBackPic,jdbcType=VARCHAR}");
        }
        
        if (record.getIsReal() != null) {
            sql.SET("is_real = #{record.isReal,jdbcType=BIT}");
        }
        
        if (record.getLivePrice() != null) {
            sql.SET("live_price = #{record.livePrice,jdbcType=DECIMAL}");
        }
        
        if (record.getFyjine() != null) {
            sql.SET("fyjine = #{record.fyjine,jdbcType=VARCHAR}");
        }
        
        if (record.getYifan() != null) {
            sql.SET("yifan = #{record.yifan,jdbcType=VARCHAR}");
        }
        
        if (record.getDeliveryOffice() != null) {
            sql.SET("delivery_office = #{record.deliveryOffice,jdbcType=BIT}");
        }
        
        if (record.getSubsidyPrice() != null) {
            sql.SET("subsidy_price = #{record.subsidyPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getDeliveryMchId() != null) {
            sql.SET("delivery_mch_id = #{record.deliveryMchId,jdbcType=INTEGER}");
        }
        
        if (record.getClerkMchId() != null) {
            sql.SET("clerk_mch_id = #{record.clerkMchId,jdbcType=INTEGER}");
        }
        
        if (record.getIsGroupCentre() != null) {
            sql.SET("is_group_centre = #{record.isGroupCentre,jdbcType=INTEGER}");
        }
        
        if (record.getSex() != null) {
            sql.SET("sex = #{record.sex,jdbcType=INTEGER}");
        }
        
        if (record.getBirthDate() != null) {
            sql.SET("birth_date = #{record.birthDate,jdbcType=VARCHAR}");
        }
        
        if (record.getIsVgoods() != null) {
            sql.SET("is_vgoods = #{record.isVgoods,jdbcType=INTEGER}");
        }
        
        if (record.getShareCatId() != null) {
            sql.SET("share_cat_id = #{record.shareCatId,jdbcType=INTEGER}");
        }
        
        if (record.getUserLabel() != null) {
            sql.SET("user_label = #{record.userLabel,jdbcType=INTEGER}");
        }
        
        if (record.getGhCardNo() != null) {
            sql.SET("gh_card_no = #{record.ghCardNo,jdbcType=VARCHAR}");
        }
        
        if (record.getGhCardPwd() != null) {
            sql.SET("gh_card_pwd = #{record.ghCardPwd,jdbcType=INTEGER}");
        }
        
        if (record.getChannelPhone() != null) {
            sql.SET("channel_phone = #{record.channelPhone,jdbcType=CHAR}");
        }
        
        if (record.getChannelSign() != null) {
            sql.SET("channel_sign = #{record.channelSign,jdbcType=VARCHAR}");
        }
        
        if (record.getEmail() != null) {
            sql.SET("email = #{record.email,jdbcType=VARCHAR}");
        }
        
        if (record.getApplyTime() != null) {
            sql.SET("apply_time = #{record.applyTime,jdbcType=INTEGER}");
        }
        
        if (record.getApplyStatus() != null) {
            sql.SET("apply_status = #{record.applyStatus,jdbcType=SMALLINT}");
        }
        
        applyWhere(sql, example, true);
        return sql.toString();
    }

    public String updateByExample(Map<String, Object> parameter) {
        SQL sql = new SQL();
        sql.UPDATE("cyymall_user");
        
        sql.SET("id = #{record.id,jdbcType=INTEGER}");
        sql.SET("`type` = #{record.type,jdbcType=SMALLINT}");
        sql.SET("username = #{record.username,jdbcType=VARCHAR}");
        sql.SET("`password` = #{record.password,jdbcType=VARCHAR}");
        sql.SET("auth_key = #{record.authKey,jdbcType=VARCHAR}");
        sql.SET("access_token = #{record.accessToken,jdbcType=VARCHAR}");
        sql.SET("addtime = #{record.addtime,jdbcType=INTEGER}");
        sql.SET("is_delete = #{record.isDelete,jdbcType=SMALLINT}");
        sql.SET("wechat_open_id = #{record.wechatOpenId,jdbcType=VARCHAR}");
        sql.SET("wechat_union_id = #{record.wechatUnionId,jdbcType=VARCHAR}");
        sql.SET("nickname = #{record.nickname,jdbcType=VARCHAR}");
        sql.SET("avatar_url = #{record.avatarUrl,jdbcType=VARCHAR}");
        sql.SET("store_id = #{record.storeId,jdbcType=INTEGER}");
        sql.SET("is_distributor = #{record.isDistributor,jdbcType=INTEGER}");
        sql.SET("parent_id = #{record.parentId,jdbcType=INTEGER}");
        sql.SET("`time` = #{record.time,jdbcType=INTEGER}");
        sql.SET("total_price = #{record.totalPrice,jdbcType=DECIMAL}");
        sql.SET("price = #{record.price,jdbcType=DECIMAL}");
        sql.SET("is_clerk = #{record.isClerk,jdbcType=INTEGER}");
        sql.SET("we7_uid = #{record.we7Uid,jdbcType=INTEGER}");
        sql.SET("shop_id = #{record.shopId,jdbcType=INTEGER}");
        sql.SET("`level` = #{record.level,jdbcType=INTEGER}");
        sql.SET("integral = #{record.integral,jdbcType=INTEGER}");
        sql.SET("total_integral = #{record.totalIntegral,jdbcType=INTEGER}");
        sql.SET("money = #{record.money,jdbcType=DECIMAL}");
        sql.SET("contact_way = #{record.contactWay,jdbcType=VARCHAR}");
        sql.SET("comments = #{record.comments,jdbcType=VARCHAR}");
        sql.SET("binding = #{record.binding,jdbcType=CHAR}");
        sql.SET("wechat_platform_open_id = #{record.wechatPlatformOpenId,jdbcType=VARCHAR}");
        sql.SET("platform = #{record.platform,jdbcType=TINYINT}");
        sql.SET("blacklist = #{record.blacklist,jdbcType=BIT}");
        sql.SET("parent_user_id = #{record.parentUserId,jdbcType=INTEGER}");
        sql.SET("appcid = #{record.appcid,jdbcType=VARCHAR}");
        sql.SET("is_admin = #{record.isAdmin,jdbcType=BIT}");
        sql.SET("tuan_price = #{record.tuanPrice,jdbcType=DECIMAL}");
        sql.SET("is_delivery = #{record.isDelivery,jdbcType=BIT}");
        sql.SET("mch_id = #{record.mchId,jdbcType=INTEGER}");
        sql.SET("real_name = #{record.realName,jdbcType=VARCHAR}");
        sql.SET("real_code = #{record.realCode,jdbcType=VARCHAR}");
        sql.SET("real_just_pic = #{record.realJustPic,jdbcType=VARCHAR}");
        sql.SET("real_back_pic = #{record.realBackPic,jdbcType=VARCHAR}");
        sql.SET("is_real = #{record.isReal,jdbcType=BIT}");
        sql.SET("live_price = #{record.livePrice,jdbcType=DECIMAL}");
        sql.SET("fyjine = #{record.fyjine,jdbcType=VARCHAR}");
        sql.SET("yifan = #{record.yifan,jdbcType=VARCHAR}");
        sql.SET("delivery_office = #{record.deliveryOffice,jdbcType=BIT}");
        sql.SET("subsidy_price = #{record.subsidyPrice,jdbcType=DECIMAL}");
        sql.SET("delivery_mch_id = #{record.deliveryMchId,jdbcType=INTEGER}");
        sql.SET("clerk_mch_id = #{record.clerkMchId,jdbcType=INTEGER}");
        sql.SET("is_group_centre = #{record.isGroupCentre,jdbcType=INTEGER}");
        sql.SET("sex = #{record.sex,jdbcType=INTEGER}");
        sql.SET("birth_date = #{record.birthDate,jdbcType=VARCHAR}");
        sql.SET("is_vgoods = #{record.isVgoods,jdbcType=INTEGER}");
        sql.SET("share_cat_id = #{record.shareCatId,jdbcType=INTEGER}");
        sql.SET("user_label = #{record.userLabel,jdbcType=INTEGER}");
        sql.SET("gh_card_no = #{record.ghCardNo,jdbcType=VARCHAR}");
        sql.SET("gh_card_pwd = #{record.ghCardPwd,jdbcType=INTEGER}");
        sql.SET("channel_phone = #{record.channelPhone,jdbcType=CHAR}");
        sql.SET("channel_sign = #{record.channelSign,jdbcType=VARCHAR}");
        sql.SET("email = #{record.email,jdbcType=VARCHAR}");
        sql.SET("apply_time = #{record.applyTime,jdbcType=INTEGER}");
        sql.SET("apply_status = #{record.applyStatus,jdbcType=SMALLINT}");
        
        CyymallUserExample example = (CyymallUserExample) parameter.get("example");
        applyWhere(sql, example, true);
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(CyymallUser record) {
        SQL sql = new SQL();
        sql.UPDATE("cyymall_user");
        
        if (record.getType() != null) {
            sql.SET("`type` = #{type,jdbcType=SMALLINT}");
        }
        
        if (record.getUsername() != null) {
            sql.SET("username = #{username,jdbcType=VARCHAR}");
        }
        
        if (record.getPassword() != null) {
            sql.SET("`password` = #{password,jdbcType=VARCHAR}");
        }
        
        if (record.getAuthKey() != null) {
            sql.SET("auth_key = #{authKey,jdbcType=VARCHAR}");
        }
        
        if (record.getAccessToken() != null) {
            sql.SET("access_token = #{accessToken,jdbcType=VARCHAR}");
        }
        
        if (record.getAddtime() != null) {
            sql.SET("addtime = #{addtime,jdbcType=INTEGER}");
        }
        
        if (record.getIsDelete() != null) {
            sql.SET("is_delete = #{isDelete,jdbcType=SMALLINT}");
        }
        
        if (record.getWechatOpenId() != null) {
            sql.SET("wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR}");
        }
        
        if (record.getWechatUnionId() != null) {
            sql.SET("wechat_union_id = #{wechatUnionId,jdbcType=VARCHAR}");
        }
        
        if (record.getNickname() != null) {
            sql.SET("nickname = #{nickname,jdbcType=VARCHAR}");
        }
        
        if (record.getAvatarUrl() != null) {
            sql.SET("avatar_url = #{avatarUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getStoreId() != null) {
            sql.SET("store_id = #{storeId,jdbcType=INTEGER}");
        }
        
        if (record.getIsDistributor() != null) {
            sql.SET("is_distributor = #{isDistributor,jdbcType=INTEGER}");
        }
        
        if (record.getParentId() != null) {
            sql.SET("parent_id = #{parentId,jdbcType=INTEGER}");
        }
        
        if (record.getTime() != null) {
            sql.SET("`time` = #{time,jdbcType=INTEGER}");
        }
        
        if (record.getTotalPrice() != null) {
            sql.SET("total_price = #{totalPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getPrice() != null) {
            sql.SET("price = #{price,jdbcType=DECIMAL}");
        }
        
        if (record.getIsClerk() != null) {
            sql.SET("is_clerk = #{isClerk,jdbcType=INTEGER}");
        }
        
        if (record.getWe7Uid() != null) {
            sql.SET("we7_uid = #{we7Uid,jdbcType=INTEGER}");
        }
        
        if (record.getShopId() != null) {
            sql.SET("shop_id = #{shopId,jdbcType=INTEGER}");
        }
        
        if (record.getLevel() != null) {
            sql.SET("`level` = #{level,jdbcType=INTEGER}");
        }
        
        if (record.getIntegral() != null) {
            sql.SET("integral = #{integral,jdbcType=INTEGER}");
        }
        
        if (record.getTotalIntegral() != null) {
            sql.SET("total_integral = #{totalIntegral,jdbcType=INTEGER}");
        }
        
        if (record.getMoney() != null) {
            sql.SET("money = #{money,jdbcType=DECIMAL}");
        }
        
        if (record.getContactWay() != null) {
            sql.SET("contact_way = #{contactWay,jdbcType=VARCHAR}");
        }
        
        if (record.getComments() != null) {
            sql.SET("comments = #{comments,jdbcType=VARCHAR}");
        }
        
        if (record.getBinding() != null) {
            sql.SET("binding = #{binding,jdbcType=CHAR}");
        }
        
        if (record.getWechatPlatformOpenId() != null) {
            sql.SET("wechat_platform_open_id = #{wechatPlatformOpenId,jdbcType=VARCHAR}");
        }
        
        if (record.getPlatform() != null) {
            sql.SET("platform = #{platform,jdbcType=TINYINT}");
        }
        
        if (record.getBlacklist() != null) {
            sql.SET("blacklist = #{blacklist,jdbcType=BIT}");
        }
        
        if (record.getParentUserId() != null) {
            sql.SET("parent_user_id = #{parentUserId,jdbcType=INTEGER}");
        }
        
        if (record.getAppcid() != null) {
            sql.SET("appcid = #{appcid,jdbcType=VARCHAR}");
        }
        
        if (record.getIsAdmin() != null) {
            sql.SET("is_admin = #{isAdmin,jdbcType=BIT}");
        }
        
        if (record.getTuanPrice() != null) {
            sql.SET("tuan_price = #{tuanPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getIsDelivery() != null) {
            sql.SET("is_delivery = #{isDelivery,jdbcType=BIT}");
        }
        
        if (record.getMchId() != null) {
            sql.SET("mch_id = #{mchId,jdbcType=INTEGER}");
        }
        
        if (record.getRealName() != null) {
            sql.SET("real_name = #{realName,jdbcType=VARCHAR}");
        }
        
        if (record.getRealCode() != null) {
            sql.SET("real_code = #{realCode,jdbcType=VARCHAR}");
        }
        
        if (record.getRealJustPic() != null) {
            sql.SET("real_just_pic = #{realJustPic,jdbcType=VARCHAR}");
        }
        
        if (record.getRealBackPic() != null) {
            sql.SET("real_back_pic = #{realBackPic,jdbcType=VARCHAR}");
        }
        
        if (record.getIsReal() != null) {
            sql.SET("is_real = #{isReal,jdbcType=BIT}");
        }
        
        if (record.getLivePrice() != null) {
            sql.SET("live_price = #{livePrice,jdbcType=DECIMAL}");
        }
        
        if (record.getFyjine() != null) {
            sql.SET("fyjine = #{fyjine,jdbcType=VARCHAR}");
        }
        
        if (record.getYifan() != null) {
            sql.SET("yifan = #{yifan,jdbcType=VARCHAR}");
        }
        
        if (record.getDeliveryOffice() != null) {
            sql.SET("delivery_office = #{deliveryOffice,jdbcType=BIT}");
        }
        
        if (record.getSubsidyPrice() != null) {
            sql.SET("subsidy_price = #{subsidyPrice,jdbcType=DECIMAL}");
        }
        
        if (record.getDeliveryMchId() != null) {
            sql.SET("delivery_mch_id = #{deliveryMchId,jdbcType=INTEGER}");
        }
        
        if (record.getClerkMchId() != null) {
            sql.SET("clerk_mch_id = #{clerkMchId,jdbcType=INTEGER}");
        }
        
        if (record.getIsGroupCentre() != null) {
            sql.SET("is_group_centre = #{isGroupCentre,jdbcType=INTEGER}");
        }
        
        if (record.getSex() != null) {
            sql.SET("sex = #{sex,jdbcType=INTEGER}");
        }
        
        if (record.getBirthDate() != null) {
            sql.SET("birth_date = #{birthDate,jdbcType=VARCHAR}");
        }
        
        if (record.getIsVgoods() != null) {
            sql.SET("is_vgoods = #{isVgoods,jdbcType=INTEGER}");
        }
        
        if (record.getShareCatId() != null) {
            sql.SET("share_cat_id = #{shareCatId,jdbcType=INTEGER}");
        }
        
        if (record.getUserLabel() != null) {
            sql.SET("user_label = #{userLabel,jdbcType=INTEGER}");
        }
        
        if (record.getGhCardNo() != null) {
            sql.SET("gh_card_no = #{ghCardNo,jdbcType=VARCHAR}");
        }
        
        if (record.getGhCardPwd() != null) {
            sql.SET("gh_card_pwd = #{ghCardPwd,jdbcType=INTEGER}");
        }
        
        if (record.getChannelPhone() != null) {
            sql.SET("channel_phone = #{channelPhone,jdbcType=CHAR}");
        }
        
        if (record.getChannelSign() != null) {
            sql.SET("channel_sign = #{channelSign,jdbcType=VARCHAR}");
        }
        
        if (record.getEmail() != null) {
            sql.SET("email = #{email,jdbcType=VARCHAR}");
        }
        
        if (record.getApplyTime() != null) {
            sql.SET("apply_time = #{applyTime,jdbcType=INTEGER}");
        }
        
        if (record.getApplyStatus() != null) {
            sql.SET("apply_status = #{applyStatus,jdbcType=SMALLINT}");
        }
        
        sql.WHERE("id = #{id,jdbcType=INTEGER}");
        
        return sql.toString();
    }

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