<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fuxi.ws.data.dao.VipMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.Vip">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    <id column="VIPID" jdbcType="VARCHAR" property="vipid" />
    <result column="Code" jdbcType="VARCHAR" property="code" />
    <result column="VIP" jdbcType="VARCHAR" property="vip" />
    <result column="VIPTypeID" jdbcType="VARCHAR" property="viptypeid" />
    <result column="DistrictID" jdbcType="VARCHAR" property="districtid" />
    <result column="Address" jdbcType="VARCHAR" property="address" />
    <result column="Zip" jdbcType="VARCHAR" property="zip" />
    <result column="Tel" jdbcType="VARCHAR" property="tel" />
    <result column="MobilePhone" jdbcType="VARCHAR" property="mobilephone" />
    <result column="EMail" jdbcType="VARCHAR" property="email" />
    <result column="Sex" jdbcType="VARCHAR" property="sex" />
    <result column="Marriage" jdbcType="VARCHAR" property="marriage" />
    <result column="NickName" jdbcType="VARCHAR" property="nickname" />
    <result column="Education" jdbcType="VARCHAR" property="education" />
    <result column="Vocation" jdbcType="VARCHAR" property="vocation" />
    <result column="Income" jdbcType="VARCHAR" property="income" />
    <result column="Country" jdbcType="VARCHAR" property="country" />
    <result column="Nation" jdbcType="VARCHAR" property="nation" />
    <result column="IDType" jdbcType="VARCHAR" property="idtype" />
    <result column="IDNo" jdbcType="VARCHAR" property="idno" />
    <result column="DepartmentID" jdbcType="VARCHAR" property="departmentid" />
    <result column="BeginDate" jdbcType="TIMESTAMP" property="begindate" />
    <result column="EndDate" jdbcType="TIMESTAMP" property="enddate" />
    <result column="BirthDay" jdbcType="TIMESTAMP" property="birthday" />
    <result column="ChineseBirthDay" jdbcType="VARCHAR" property="chinesebirthday" />
    <result column="SpecialDate" jdbcType="TIMESTAMP" property="specialdate" />
    <result column="ClothingSize" jdbcType="VARCHAR" property="clothingsize" />
    <result column="ShoesSize" jdbcType="VARCHAR" property="shoessize" />
    <result column="FavoriteBrand" jdbcType="VARCHAR" property="favoritebrand" />
    <result column="InitPurchasedAmount" jdbcType="DECIMAL" property="initpurchasedamount" />
    <result column="PurchasedAmount" jdbcType="DECIMAL" property="purchasedamount" />
    <result column="LastPurchasedDate" jdbcType="TIMESTAMP" property="lastpurchaseddate" />
    <result column="ModifyDate" jdbcType="TIMESTAMP" property="modifydate" />
    <result column="Editor" jdbcType="VARCHAR" property="editor" />
    <result column="Memo" jdbcType="VARCHAR" property="memo" />
    <result column="UseFlag" jdbcType="BIT" property="useflag" />
    <result column="StopFlag" jdbcType="BIT" property="stopflag" />
    <result column="HelpCode" jdbcType="VARCHAR" property="helpcode" />
    <result column="ICQ" jdbcType="VARCHAR" property="icq" />
    <result column="WebNo" jdbcType="VARCHAR" property="webno" />
    <result column="InitSalesPoint" jdbcType="DECIMAL" property="initsalespoint" />
    <result column="SalesPoint" jdbcType="DECIMAL" property="salespoint" />
    <result column="Password" jdbcType="VARCHAR" property="password" />
    <result column="ExchangedPoint" jdbcType="DECIMAL" property="exchangedpoint" />
    <result column="UsablePoint" jdbcType="DECIMAL" property="usablepoint" />
    <result column="UsableDepositAmount" jdbcType="DECIMAL" property="usabledepositamount" />
    <result column="PromptInfo" jdbcType="VARCHAR" property="promptinfo" />
    <result column="OftenEvection" jdbcType="BIT" property="oftenevection" />
    <result column="OftenEvtCity" jdbcType="VARCHAR" property="oftenevtcity" />
    <result column="Province" jdbcType="VARCHAR" property="province" />
    <result column="City" jdbcType="VARCHAR" property="city" />
    <result column="County" jdbcType="VARCHAR" property="county" />
    <result column="Street" jdbcType="VARCHAR" property="street" />
    <result column="Doorplate" jdbcType="VARCHAR" property="doorplate" />
    <result column="VIPNO" jdbcType="VARCHAR" property="vipno" />
    <result column="EnrollmentDate" jdbcType="TIMESTAMP" property="enrollmentdate" />
    <result column="OldUsableDepositAmount" jdbcType="DECIMAL" property="oldusabledepositamount" />
    <result column="MobilePhone2" jdbcType="VARCHAR" property="mobilephone2" />
    <result column="LineNickname" jdbcType="VARCHAR" property="linenickname" />
    <result column="Industry" jdbcType="VARCHAR" property="industry" />
    <result column="Hobbies" jdbcType="VARCHAR" property="hobbies" />
    <result column="BirthdayYear" jdbcType="INTEGER" property="birthdayyear" />
    <result column="Height" jdbcType="VARCHAR" property="height" />
    <result column="Weight" jdbcType="VARCHAR" property="weight" />
    <result column="RecommenderCode" jdbcType="VARCHAR" property="recommendercode" />
    <result column="VIPLevel" jdbcType="VARCHAR" property="viplevel" />
    <result column="VipPassWord" jdbcType="VARCHAR" property="vippassword" />
    <result column="VipPayWord" jdbcType="VARCHAR" property="vippayword" />
    <result column="wxId" jdbcType="NVARCHAR" property="wxid" />
    <result column="Lang" jdbcType="DECIMAL" property="lang" />
    <result column="Lat" jdbcType="DECIMAL" property="lat" />
    <result column="IsDistribute" jdbcType="BIT" property="isdistribute" />
    <result column="FreezeAmount" jdbcType="DECIMAL" property="freezeamount" />
    <result column="FreezePoint" jdbcType="DECIMAL" property="freezepoint" />
    <result column="PhotoUrl" jdbcType="VARCHAR" property="photourl" />
    <result column="DefaultLoginFlag" jdbcType="BIT" property="defaultloginflag" />
    <result column="RegistType" jdbcType="TINYINT" property="registtype" />
    <result column="BelongGuide" jdbcType="VARCHAR" property="belongguide" />
    <result column="VipBank" jdbcType="NVARCHAR" property="vipbank" />
    <result column="VipBankNo" jdbcType="VARCHAR" property="vipbankno" />
    <result column="HoldName" jdbcType="NVARCHAR" property="holdname" />
    <result column="customer_id" jdbcType="INTEGER" property="customerId" />
    <result column="Creator" jdbcType="VARCHAR" property="creator" />
    <result column="MadeDate" jdbcType="TIMESTAMP" property="madedate" />
    <result column="BuyTimes" jdbcType="INTEGER" property="buytimes" />
    <result column="BuyPrice" jdbcType="DECIMAL" property="buyprice" />
    <result column="LastChatDate" jdbcType="TIMESTAMP" property="lastchatdate" />
    <result column="WeixinCode" jdbcType="VARCHAR" property="weixincode" />
    <result column="Attention" jdbcType="BIT" property="attention" />
    <result column="InteractionTime" jdbcType="TIMESTAMP" property="interactiontime" />
    <result column="AllowedArrearFlag" jdbcType="BIT" property="allowedarrearflag" />
    <result column="AllowedARAmountMax" jdbcType="DECIMAL" property="allowedaramountmax" />
    <result column="AccumulatedDeposit" jdbcType="DECIMAL" property="accumulateddeposit" />
    <result column="AccumulatedDepositAmount" jdbcType="DECIMAL" property="accumulateddepositamount" />
    <result column="AllowDepositRate" jdbcType="BIT" property="allowdepositrate" />
    <result column="DepositDiscountRate" jdbcType="DECIMAL" property="depositdiscountrate" />
    <result column="LastOrderTime" jdbcType="TIMESTAMP" property="lastordertime" />
    <result column="Interfacememo" jdbcType="TINYINT" property="interfacememo" />
    <result column="FinishInfoFlag" jdbcType="TINYINT" property="finishinfoflag" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.fuxi.ws.data.entity.Vip">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    <result column="Photo" jdbcType="LONGVARBINARY" property="photo" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    VIPID, Code, VIP, VIPTypeID, DistrictID, Address, Zip, Tel, MobilePhone, EMail, Sex, 
    Marriage, NickName, Education, Vocation, Income, Country, Nation, IDType, IDNo, DepartmentID, 
    BeginDate, EndDate, BirthDay, ChineseBirthDay, SpecialDate, ClothingSize, ShoesSize, 
    FavoriteBrand, InitPurchasedAmount, PurchasedAmount, LastPurchasedDate, ModifyDate, 
    Editor, Memo, UseFlag, StopFlag, HelpCode, ICQ, WebNo, InitSalesPoint, SalesPoint, 
    Password, ExchangedPoint, UsablePoint, UsableDepositAmount, PromptInfo, OftenEvection, 
    OftenEvtCity, Province, City, County, Street, Doorplate, VIPNO, EnrollmentDate, OldUsableDepositAmount, 
    MobilePhone2, LineNickname, Industry, Hobbies, BirthdayYear, Height, Weight, RecommenderCode, 
    VIPLevel, VipPassWord, VipPayWord, wxId, Lang, Lat, IsDistribute, FreezeAmount, FreezePoint, 
    PhotoUrl, DefaultLoginFlag, RegistType, BelongGuide, VipBank, VipBankNo, HoldName, 
    customer_id, Creator, MadeDate, BuyTimes, BuyPrice, LastChatDate, WeixinCode, Attention, 
    InteractionTime, AllowedArrearFlag, AllowedARAmountMax, AccumulatedDeposit, AccumulatedDepositAmount, 
    AllowDepositRate, DepositDiscountRate, LastOrderTime, Interfacememo, FinishInfoFlag
  </sql>
  <sql id="Blob_Column_List">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    Photo
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.fuxi.ws.data.entity.VipExample" resultMap="ResultMapWithBLOBs">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from VIP
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.VipExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from VIP
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from VIP
    where VIPID = #{vipid,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    delete from VIP
    where VIPID = #{vipid,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.Vip">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    insert into VIP (VIPID, Code, VIP, 
      VIPTypeID, DistrictID, Address, 
      Zip, Tel, MobilePhone, 
      EMail, Sex, Marriage, 
      NickName, Education, Vocation, 
      Income, Country, Nation, 
      IDType, IDNo, DepartmentID, 
      BeginDate, EndDate, BirthDay, 
      ChineseBirthDay, SpecialDate, ClothingSize, 
      ShoesSize, FavoriteBrand, InitPurchasedAmount, 
      PurchasedAmount, LastPurchasedDate, ModifyDate, 
      Editor, Memo, UseFlag, 
      StopFlag, HelpCode, ICQ, 
      WebNo, InitSalesPoint, SalesPoint, 
      Password, ExchangedPoint, UsablePoint, 
      UsableDepositAmount, PromptInfo, OftenEvection, 
      OftenEvtCity, Province, City, 
      County, Street, Doorplate, 
      VIPNO, EnrollmentDate, OldUsableDepositAmount, 
      MobilePhone2, LineNickname, Industry, 
      Hobbies, BirthdayYear, Height, 
      Weight, RecommenderCode, VIPLevel, 
      VipPassWord, VipPayWord, wxId, 
      Lang, Lat, IsDistribute, 
      FreezeAmount, FreezePoint, PhotoUrl, 
      DefaultLoginFlag, RegistType, BelongGuide, 
      VipBank, VipBankNo, HoldName, 
      customer_id, Creator, MadeDate, 
      BuyTimes, BuyPrice, LastChatDate, 
      WeixinCode, Attention, InteractionTime, 
      AllowedArrearFlag, AllowedARAmountMax, AccumulatedDeposit, 
      AccumulatedDepositAmount, AllowDepositRate, 
      DepositDiscountRate, LastOrderTime, Interfacememo, 
      FinishInfoFlag, Photo)
    values (#{vipid,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, #{vip,jdbcType=VARCHAR}, 
      #{viptypeid,jdbcType=VARCHAR}, #{districtid,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, 
      #{zip,jdbcType=VARCHAR}, #{tel,jdbcType=VARCHAR}, #{mobilephone,jdbcType=VARCHAR}, 
      #{email,jdbcType=VARCHAR}, #{sex,jdbcType=VARCHAR}, #{marriage,jdbcType=VARCHAR}, 
      #{nickname,jdbcType=VARCHAR}, #{education,jdbcType=VARCHAR}, #{vocation,jdbcType=VARCHAR}, 
      #{income,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, #{nation,jdbcType=VARCHAR}, 
      #{idtype,jdbcType=VARCHAR}, #{idno,jdbcType=VARCHAR}, #{departmentid,jdbcType=VARCHAR}, 
      #{begindate,jdbcType=TIMESTAMP}, #{enddate,jdbcType=TIMESTAMP}, #{birthday,jdbcType=TIMESTAMP}, 
      #{chinesebirthday,jdbcType=VARCHAR}, #{specialdate,jdbcType=TIMESTAMP}, #{clothingsize,jdbcType=VARCHAR}, 
      #{shoessize,jdbcType=VARCHAR}, #{favoritebrand,jdbcType=VARCHAR}, #{initpurchasedamount,jdbcType=DECIMAL}, 
      #{purchasedamount,jdbcType=DECIMAL}, #{lastpurchaseddate,jdbcType=TIMESTAMP}, #{modifydate,jdbcType=TIMESTAMP}, 
      #{editor,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, #{useflag,jdbcType=BIT}, 
      #{stopflag,jdbcType=BIT}, #{helpcode,jdbcType=VARCHAR}, #{icq,jdbcType=VARCHAR}, 
      #{webno,jdbcType=VARCHAR}, #{initsalespoint,jdbcType=DECIMAL}, #{salespoint,jdbcType=DECIMAL}, 
      #{password,jdbcType=VARCHAR}, #{exchangedpoint,jdbcType=DECIMAL}, #{usablepoint,jdbcType=DECIMAL}, 
      #{usabledepositamount,jdbcType=DECIMAL}, #{promptinfo,jdbcType=VARCHAR}, #{oftenevection,jdbcType=BIT}, 
      #{oftenevtcity,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, 
      #{county,jdbcType=VARCHAR}, #{street,jdbcType=VARCHAR}, #{doorplate,jdbcType=VARCHAR}, 
      #{vipno,jdbcType=VARCHAR}, #{enrollmentdate,jdbcType=TIMESTAMP}, #{oldusabledepositamount,jdbcType=DECIMAL}, 
      #{mobilephone2,jdbcType=VARCHAR}, #{linenickname,jdbcType=VARCHAR}, #{industry,jdbcType=VARCHAR}, 
      #{hobbies,jdbcType=VARCHAR}, #{birthdayyear,jdbcType=INTEGER}, #{height,jdbcType=VARCHAR}, 
      #{weight,jdbcType=VARCHAR}, #{recommendercode,jdbcType=VARCHAR}, #{viplevel,jdbcType=VARCHAR}, 
      #{vippassword,jdbcType=VARCHAR}, #{vippayword,jdbcType=VARCHAR}, #{wxid,jdbcType=NVARCHAR}, 
      #{lang,jdbcType=DECIMAL}, #{lat,jdbcType=DECIMAL}, #{isdistribute,jdbcType=BIT}, 
      #{freezeamount,jdbcType=DECIMAL}, #{freezepoint,jdbcType=DECIMAL}, #{photourl,jdbcType=VARCHAR}, 
      #{defaultloginflag,jdbcType=BIT}, #{registtype,jdbcType=TINYINT}, #{belongguide,jdbcType=VARCHAR}, 
      #{vipbank,jdbcType=NVARCHAR}, #{vipbankno,jdbcType=VARCHAR}, #{holdname,jdbcType=NVARCHAR}, 
      #{customerId,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{madedate,jdbcType=TIMESTAMP}, 
      #{buytimes,jdbcType=INTEGER}, #{buyprice,jdbcType=DECIMAL}, #{lastchatdate,jdbcType=TIMESTAMP}, 
      #{weixincode,jdbcType=VARCHAR}, #{attention,jdbcType=BIT}, #{interactiontime,jdbcType=TIMESTAMP}, 
      #{allowedarrearflag,jdbcType=BIT}, #{allowedaramountmax,jdbcType=DECIMAL}, #{accumulateddeposit,jdbcType=DECIMAL}, 
      #{accumulateddepositamount,jdbcType=DECIMAL}, #{allowdepositrate,jdbcType=BIT}, 
      #{depositdiscountrate,jdbcType=DECIMAL}, #{lastordertime,jdbcType=TIMESTAMP}, #{interfacememo,jdbcType=TINYINT}, 
      #{finishinfoflag,jdbcType=TINYINT}, #{photo,jdbcType=LONGVARBINARY})
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.Vip">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    insert into VIP
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="vipid != null">
        VIPID,
      </if>
      <if test="code != null">
        Code,
      </if>
      <if test="vip != null">
        VIP,
      </if>
      <if test="viptypeid != null">
        VIPTypeID,
      </if>
      <if test="districtid != null">
        DistrictID,
      </if>
      <if test="address != null">
        Address,
      </if>
      <if test="zip != null">
        Zip,
      </if>
      <if test="tel != null">
        Tel,
      </if>
      <if test="mobilephone != null">
        MobilePhone,
      </if>
      <if test="email != null">
        EMail,
      </if>
      <if test="sex != null">
        Sex,
      </if>
      <if test="marriage != null">
        Marriage,
      </if>
      <if test="nickname != null">
        NickName,
      </if>
      <if test="education != null">
        Education,
      </if>
      <if test="vocation != null">
        Vocation,
      </if>
      <if test="income != null">
        Income,
      </if>
      <if test="country != null">
        Country,
      </if>
      <if test="nation != null">
        Nation,
      </if>
      <if test="idtype != null">
        IDType,
      </if>
      <if test="idno != null">
        IDNo,
      </if>
      <if test="departmentid != null">
        DepartmentID,
      </if>
      <if test="begindate != null">
        BeginDate,
      </if>
      <if test="enddate != null">
        EndDate,
      </if>
      <if test="birthday != null">
        BirthDay,
      </if>
      <if test="chinesebirthday != null">
        ChineseBirthDay,
      </if>
      <if test="specialdate != null">
        SpecialDate,
      </if>
      <if test="clothingsize != null">
        ClothingSize,
      </if>
      <if test="shoessize != null">
        ShoesSize,
      </if>
      <if test="favoritebrand != null">
        FavoriteBrand,
      </if>
      <if test="initpurchasedamount != null">
        InitPurchasedAmount,
      </if>
      <if test="purchasedamount != null">
        PurchasedAmount,
      </if>
      <if test="lastpurchaseddate != null">
        LastPurchasedDate,
      </if>
      <if test="modifydate != null">
        ModifyDate,
      </if>
      <if test="editor != null">
        Editor,
      </if>
      <if test="memo != null">
        Memo,
      </if>
      <if test="useflag != null">
        UseFlag,
      </if>
      <if test="stopflag != null">
        StopFlag,
      </if>
      <if test="helpcode != null">
        HelpCode,
      </if>
      <if test="icq != null">
        ICQ,
      </if>
      <if test="webno != null">
        WebNo,
      </if>
      <if test="initsalespoint != null">
        InitSalesPoint,
      </if>
      <if test="salespoint != null">
        SalesPoint,
      </if>
      <if test="password != null">
        Password,
      </if>
      <if test="exchangedpoint != null">
        ExchangedPoint,
      </if>
      <if test="usablepoint != null">
        UsablePoint,
      </if>
      <if test="usabledepositamount != null">
        UsableDepositAmount,
      </if>
      <if test="promptinfo != null">
        PromptInfo,
      </if>
      <if test="oftenevection != null">
        OftenEvection,
      </if>
      <if test="oftenevtcity != null">
        OftenEvtCity,
      </if>
      <if test="province != null">
        Province,
      </if>
      <if test="city != null">
        City,
      </if>
      <if test="county != null">
        County,
      </if>
      <if test="street != null">
        Street,
      </if>
      <if test="doorplate != null">
        Doorplate,
      </if>
      <if test="vipno != null">
        VIPNO,
      </if>
      <if test="enrollmentdate != null">
        EnrollmentDate,
      </if>
      <if test="oldusabledepositamount != null">
        OldUsableDepositAmount,
      </if>
      <if test="mobilephone2 != null">
        MobilePhone2,
      </if>
      <if test="linenickname != null">
        LineNickname,
      </if>
      <if test="industry != null">
        Industry,
      </if>
      <if test="hobbies != null">
        Hobbies,
      </if>
      <if test="birthdayyear != null">
        BirthdayYear,
      </if>
      <if test="height != null">
        Height,
      </if>
      <if test="weight != null">
        Weight,
      </if>
      <if test="recommendercode != null">
        RecommenderCode,
      </if>
      <if test="viplevel != null">
        VIPLevel,
      </if>
      <if test="vippassword != null">
        VipPassWord,
      </if>
      <if test="vippayword != null">
        VipPayWord,
      </if>
      <if test="wxid != null">
        wxId,
      </if>
      <if test="lang != null">
        Lang,
      </if>
      <if test="lat != null">
        Lat,
      </if>
      <if test="isdistribute != null">
        IsDistribute,
      </if>
      <if test="freezeamount != null">
        FreezeAmount,
      </if>
      <if test="freezepoint != null">
        FreezePoint,
      </if>
      <if test="photourl != null">
        PhotoUrl,
      </if>
      <if test="defaultloginflag != null">
        DefaultLoginFlag,
      </if>
      <if test="registtype != null">
        RegistType,
      </if>
      <if test="belongguide != null">
        BelongGuide,
      </if>
      <if test="vipbank != null">
        VipBank,
      </if>
      <if test="vipbankno != null">
        VipBankNo,
      </if>
      <if test="holdname != null">
        HoldName,
      </if>
      <if test="customerId != null">
        customer_id,
      </if>
      <if test="creator != null">
        Creator,
      </if>
      <if test="madedate != null">
        MadeDate,
      </if>
      <if test="buytimes != null">
        BuyTimes,
      </if>
      <if test="buyprice != null">
        BuyPrice,
      </if>
      <if test="lastchatdate != null">
        LastChatDate,
      </if>
      <if test="weixincode != null">
        WeixinCode,
      </if>
      <if test="attention != null">
        Attention,
      </if>
      <if test="interactiontime != null">
        InteractionTime,
      </if>
      <if test="allowedarrearflag != null">
        AllowedArrearFlag,
      </if>
      <if test="allowedaramountmax != null">
        AllowedARAmountMax,
      </if>
      <if test="accumulateddeposit != null">
        AccumulatedDeposit,
      </if>
      <if test="accumulateddepositamount != null">
        AccumulatedDepositAmount,
      </if>
      <if test="allowdepositrate != null">
        AllowDepositRate,
      </if>
      <if test="depositdiscountrate != null">
        DepositDiscountRate,
      </if>
      <if test="lastordertime != null">
        LastOrderTime,
      </if>
      <if test="interfacememo != null">
        Interfacememo,
      </if>
      <if test="finishinfoflag != null">
        FinishInfoFlag,
      </if>
      <if test="photo != null">
        Photo,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="vipid != null">
        #{vipid,jdbcType=VARCHAR},
      </if>
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="vip != null">
        #{vip,jdbcType=VARCHAR},
      </if>
      <if test="viptypeid != null">
        #{viptypeid,jdbcType=VARCHAR},
      </if>
      <if test="districtid != null">
        #{districtid,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="zip != null">
        #{zip,jdbcType=VARCHAR},
      </if>
      <if test="tel != null">
        #{tel,jdbcType=VARCHAR},
      </if>
      <if test="mobilephone != null">
        #{mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        #{sex,jdbcType=VARCHAR},
      </if>
      <if test="marriage != null">
        #{marriage,jdbcType=VARCHAR},
      </if>
      <if test="nickname != null">
        #{nickname,jdbcType=VARCHAR},
      </if>
      <if test="education != null">
        #{education,jdbcType=VARCHAR},
      </if>
      <if test="vocation != null">
        #{vocation,jdbcType=VARCHAR},
      </if>
      <if test="income != null">
        #{income,jdbcType=VARCHAR},
      </if>
      <if test="country != null">
        #{country,jdbcType=VARCHAR},
      </if>
      <if test="nation != null">
        #{nation,jdbcType=VARCHAR},
      </if>
      <if test="idtype != null">
        #{idtype,jdbcType=VARCHAR},
      </if>
      <if test="idno != null">
        #{idno,jdbcType=VARCHAR},
      </if>
      <if test="departmentid != null">
        #{departmentid,jdbcType=VARCHAR},
      </if>
      <if test="begindate != null">
        #{begindate,jdbcType=TIMESTAMP},
      </if>
      <if test="enddate != null">
        #{enddate,jdbcType=TIMESTAMP},
      </if>
      <if test="birthday != null">
        #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="chinesebirthday != null">
        #{chinesebirthday,jdbcType=VARCHAR},
      </if>
      <if test="specialdate != null">
        #{specialdate,jdbcType=TIMESTAMP},
      </if>
      <if test="clothingsize != null">
        #{clothingsize,jdbcType=VARCHAR},
      </if>
      <if test="shoessize != null">
        #{shoessize,jdbcType=VARCHAR},
      </if>
      <if test="favoritebrand != null">
        #{favoritebrand,jdbcType=VARCHAR},
      </if>
      <if test="initpurchasedamount != null">
        #{initpurchasedamount,jdbcType=DECIMAL},
      </if>
      <if test="purchasedamount != null">
        #{purchasedamount,jdbcType=DECIMAL},
      </if>
      <if test="lastpurchaseddate != null">
        #{lastpurchaseddate,jdbcType=TIMESTAMP},
      </if>
      <if test="modifydate != null">
        #{modifydate,jdbcType=TIMESTAMP},
      </if>
      <if test="editor != null">
        #{editor,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=VARCHAR},
      </if>
      <if test="useflag != null">
        #{useflag,jdbcType=BIT},
      </if>
      <if test="stopflag != null">
        #{stopflag,jdbcType=BIT},
      </if>
      <if test="helpcode != null">
        #{helpcode,jdbcType=VARCHAR},
      </if>
      <if test="icq != null">
        #{icq,jdbcType=VARCHAR},
      </if>
      <if test="webno != null">
        #{webno,jdbcType=VARCHAR},
      </if>
      <if test="initsalespoint != null">
        #{initsalespoint,jdbcType=DECIMAL},
      </if>
      <if test="salespoint != null">
        #{salespoint,jdbcType=DECIMAL},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="exchangedpoint != null">
        #{exchangedpoint,jdbcType=DECIMAL},
      </if>
      <if test="usablepoint != null">
        #{usablepoint,jdbcType=DECIMAL},
      </if>
      <if test="usabledepositamount != null">
        #{usabledepositamount,jdbcType=DECIMAL},
      </if>
      <if test="promptinfo != null">
        #{promptinfo,jdbcType=VARCHAR},
      </if>
      <if test="oftenevection != null">
        #{oftenevection,jdbcType=BIT},
      </if>
      <if test="oftenevtcity != null">
        #{oftenevtcity,jdbcType=VARCHAR},
      </if>
      <if test="province != null">
        #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        #{city,jdbcType=VARCHAR},
      </if>
      <if test="county != null">
        #{county,jdbcType=VARCHAR},
      </if>
      <if test="street != null">
        #{street,jdbcType=VARCHAR},
      </if>
      <if test="doorplate != null">
        #{doorplate,jdbcType=VARCHAR},
      </if>
      <if test="vipno != null">
        #{vipno,jdbcType=VARCHAR},
      </if>
      <if test="enrollmentdate != null">
        #{enrollmentdate,jdbcType=TIMESTAMP},
      </if>
      <if test="oldusabledepositamount != null">
        #{oldusabledepositamount,jdbcType=DECIMAL},
      </if>
      <if test="mobilephone2 != null">
        #{mobilephone2,jdbcType=VARCHAR},
      </if>
      <if test="linenickname != null">
        #{linenickname,jdbcType=VARCHAR},
      </if>
      <if test="industry != null">
        #{industry,jdbcType=VARCHAR},
      </if>
      <if test="hobbies != null">
        #{hobbies,jdbcType=VARCHAR},
      </if>
      <if test="birthdayyear != null">
        #{birthdayyear,jdbcType=INTEGER},
      </if>
      <if test="height != null">
        #{height,jdbcType=VARCHAR},
      </if>
      <if test="weight != null">
        #{weight,jdbcType=VARCHAR},
      </if>
      <if test="recommendercode != null">
        #{recommendercode,jdbcType=VARCHAR},
      </if>
      <if test="viplevel != null">
        #{viplevel,jdbcType=VARCHAR},
      </if>
      <if test="vippassword != null">
        #{vippassword,jdbcType=VARCHAR},
      </if>
      <if test="vippayword != null">
        #{vippayword,jdbcType=VARCHAR},
      </if>
      <if test="wxid != null">
        #{wxid,jdbcType=NVARCHAR},
      </if>
      <if test="lang != null">
        #{lang,jdbcType=DECIMAL},
      </if>
      <if test="lat != null">
        #{lat,jdbcType=DECIMAL},
      </if>
      <if test="isdistribute != null">
        #{isdistribute,jdbcType=BIT},
      </if>
      <if test="freezeamount != null">
        #{freezeamount,jdbcType=DECIMAL},
      </if>
      <if test="freezepoint != null">
        #{freezepoint,jdbcType=DECIMAL},
      </if>
      <if test="photourl != null">
        #{photourl,jdbcType=VARCHAR},
      </if>
      <if test="defaultloginflag != null">
        #{defaultloginflag,jdbcType=BIT},
      </if>
      <if test="registtype != null">
        #{registtype,jdbcType=TINYINT},
      </if>
      <if test="belongguide != null">
        #{belongguide,jdbcType=VARCHAR},
      </if>
      <if test="vipbank != null">
        #{vipbank,jdbcType=NVARCHAR},
      </if>
      <if test="vipbankno != null">
        #{vipbankno,jdbcType=VARCHAR},
      </if>
      <if test="holdname != null">
        #{holdname,jdbcType=NVARCHAR},
      </if>
      <if test="customerId != null">
        #{customerId,jdbcType=INTEGER},
      </if>
      <if test="creator != null">
        #{creator,jdbcType=VARCHAR},
      </if>
      <if test="madedate != null">
        #{madedate,jdbcType=TIMESTAMP},
      </if>
      <if test="buytimes != null">
        #{buytimes,jdbcType=INTEGER},
      </if>
      <if test="buyprice != null">
        #{buyprice,jdbcType=DECIMAL},
      </if>
      <if test="lastchatdate != null">
        #{lastchatdate,jdbcType=TIMESTAMP},
      </if>
      <if test="weixincode != null">
        #{weixincode,jdbcType=VARCHAR},
      </if>
      <if test="attention != null">
        #{attention,jdbcType=BIT},
      </if>
      <if test="interactiontime != null">
        #{interactiontime,jdbcType=TIMESTAMP},
      </if>
      <if test="allowedarrearflag != null">
        #{allowedarrearflag,jdbcType=BIT},
      </if>
      <if test="allowedaramountmax != null">
        #{allowedaramountmax,jdbcType=DECIMAL},
      </if>
      <if test="accumulateddeposit != null">
        #{accumulateddeposit,jdbcType=DECIMAL},
      </if>
      <if test="accumulateddepositamount != null">
        #{accumulateddepositamount,jdbcType=DECIMAL},
      </if>
      <if test="allowdepositrate != null">
        #{allowdepositrate,jdbcType=BIT},
      </if>
      <if test="depositdiscountrate != null">
        #{depositdiscountrate,jdbcType=DECIMAL},
      </if>
      <if test="lastordertime != null">
        #{lastordertime,jdbcType=TIMESTAMP},
      </if>
      <if test="interfacememo != null">
        #{interfacememo,jdbcType=TINYINT},
      </if>
      <if test="finishinfoflag != null">
        #{finishinfoflag,jdbcType=TINYINT},
      </if>
      <if test="photo != null">
        #{photo,jdbcType=LONGVARBINARY},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.VipExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    select count(*) from VIP
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.Vip">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    update VIP
    <set>
      <if test="code != null">
        Code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="vip != null">
        VIP = #{vip,jdbcType=VARCHAR},
      </if>
      <if test="viptypeid != null">
        VIPTypeID = #{viptypeid,jdbcType=VARCHAR},
      </if>
      <if test="districtid != null">
        DistrictID = #{districtid,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        Address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="zip != null">
        Zip = #{zip,jdbcType=VARCHAR},
      </if>
      <if test="tel != null">
        Tel = #{tel,jdbcType=VARCHAR},
      </if>
      <if test="mobilephone != null">
        MobilePhone = #{mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        EMail = #{email,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        Sex = #{sex,jdbcType=VARCHAR},
      </if>
      <if test="marriage != null">
        Marriage = #{marriage,jdbcType=VARCHAR},
      </if>
      <if test="nickname != null">
        NickName = #{nickname,jdbcType=VARCHAR},
      </if>
      <if test="education != null">
        Education = #{education,jdbcType=VARCHAR},
      </if>
      <if test="vocation != null">
        Vocation = #{vocation,jdbcType=VARCHAR},
      </if>
      <if test="income != null">
        Income = #{income,jdbcType=VARCHAR},
      </if>
      <if test="country != null">
        Country = #{country,jdbcType=VARCHAR},
      </if>
      <if test="nation != null">
        Nation = #{nation,jdbcType=VARCHAR},
      </if>
      <if test="idtype != null">
        IDType = #{idtype,jdbcType=VARCHAR},
      </if>
      <if test="idno != null">
        IDNo = #{idno,jdbcType=VARCHAR},
      </if>
      <if test="departmentid != null">
        DepartmentID = #{departmentid,jdbcType=VARCHAR},
      </if>
      <if test="begindate != null">
        BeginDate = #{begindate,jdbcType=TIMESTAMP},
      </if>
      <if test="enddate != null">
        EndDate = #{enddate,jdbcType=TIMESTAMP},
      </if>
      <if test="birthday != null">
        BirthDay = #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="chinesebirthday != null">
        ChineseBirthDay = #{chinesebirthday,jdbcType=VARCHAR},
      </if>
      <if test="specialdate != null">
        SpecialDate = #{specialdate,jdbcType=TIMESTAMP},
      </if>
      <if test="clothingsize != null">
        ClothingSize = #{clothingsize,jdbcType=VARCHAR},
      </if>
      <if test="shoessize != null">
        ShoesSize = #{shoessize,jdbcType=VARCHAR},
      </if>
      <if test="favoritebrand != null">
        FavoriteBrand = #{favoritebrand,jdbcType=VARCHAR},
      </if>
      <if test="initpurchasedamount != null">
        InitPurchasedAmount = #{initpurchasedamount,jdbcType=DECIMAL},
      </if>
      <if test="purchasedamount != null">
        PurchasedAmount = #{purchasedamount,jdbcType=DECIMAL},
      </if>
      <if test="lastpurchaseddate != null">
        LastPurchasedDate = #{lastpurchaseddate,jdbcType=TIMESTAMP},
      </if>
      <if test="modifydate != null">
        ModifyDate = #{modifydate,jdbcType=TIMESTAMP},
      </if>
      <if test="editor != null">
        Editor = #{editor,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        Memo = #{memo,jdbcType=VARCHAR},
      </if>
      <if test="useflag != null">
        UseFlag = #{useflag,jdbcType=BIT},
      </if>
      <if test="stopflag != null">
        StopFlag = #{stopflag,jdbcType=BIT},
      </if>
      <if test="helpcode != null">
        HelpCode = #{helpcode,jdbcType=VARCHAR},
      </if>
      <if test="icq != null">
        ICQ = #{icq,jdbcType=VARCHAR},
      </if>
      <if test="webno != null">
        WebNo = #{webno,jdbcType=VARCHAR},
      </if>
      <if test="initsalespoint != null">
        InitSalesPoint = #{initsalespoint,jdbcType=DECIMAL},
      </if>
      <if test="salespoint != null">
        SalesPoint = #{salespoint,jdbcType=DECIMAL},
      </if>
      <if test="password != null">
        Password = #{password,jdbcType=VARCHAR},
      </if>
      <if test="exchangedpoint != null">
        ExchangedPoint = #{exchangedpoint,jdbcType=DECIMAL},
      </if>
      <if test="usablepoint != null">
        UsablePoint = #{usablepoint,jdbcType=DECIMAL},
      </if>
      <if test="usabledepositamount != null">
        UsableDepositAmount = #{usabledepositamount,jdbcType=DECIMAL},
      </if>
      <if test="promptinfo != null">
        PromptInfo = #{promptinfo,jdbcType=VARCHAR},
      </if>
      <if test="oftenevection != null">
        OftenEvection = #{oftenevection,jdbcType=BIT},
      </if>
      <if test="oftenevtcity != null">
        OftenEvtCity = #{oftenevtcity,jdbcType=VARCHAR},
      </if>
      <if test="province != null">
        Province = #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        City = #{city,jdbcType=VARCHAR},
      </if>
      <if test="county != null">
        County = #{county,jdbcType=VARCHAR},
      </if>
      <if test="street != null">
        Street = #{street,jdbcType=VARCHAR},
      </if>
      <if test="doorplate != null">
        Doorplate = #{doorplate,jdbcType=VARCHAR},
      </if>
      <if test="vipno != null">
        VIPNO = #{vipno,jdbcType=VARCHAR},
      </if>
      <if test="enrollmentdate != null">
        EnrollmentDate = #{enrollmentdate,jdbcType=TIMESTAMP},
      </if>
      <if test="oldusabledepositamount != null">
        OldUsableDepositAmount = #{oldusabledepositamount,jdbcType=DECIMAL},
      </if>
      <if test="mobilephone2 != null">
        MobilePhone2 = #{mobilephone2,jdbcType=VARCHAR},
      </if>
      <if test="linenickname != null">
        LineNickname = #{linenickname,jdbcType=VARCHAR},
      </if>
      <if test="industry != null">
        Industry = #{industry,jdbcType=VARCHAR},
      </if>
      <if test="hobbies != null">
        Hobbies = #{hobbies,jdbcType=VARCHAR},
      </if>
      <if test="birthdayyear != null">
        BirthdayYear = #{birthdayyear,jdbcType=INTEGER},
      </if>
      <if test="height != null">
        Height = #{height,jdbcType=VARCHAR},
      </if>
      <if test="weight != null">
        Weight = #{weight,jdbcType=VARCHAR},
      </if>
      <if test="recommendercode != null">
        RecommenderCode = #{recommendercode,jdbcType=VARCHAR},
      </if>
      <if test="viplevel != null">
        VIPLevel = #{viplevel,jdbcType=VARCHAR},
      </if>
      <if test="vippassword != null">
        VipPassWord = #{vippassword,jdbcType=VARCHAR},
      </if>
      <if test="vippayword != null">
        VipPayWord = #{vippayword,jdbcType=VARCHAR},
      </if>
      <if test="wxid != null">
        wxId = #{wxid,jdbcType=NVARCHAR},
      </if>
      <if test="lang != null">
        Lang = #{lang,jdbcType=DECIMAL},
      </if>
      <if test="lat != null">
        Lat = #{lat,jdbcType=DECIMAL},
      </if>
      <if test="isdistribute != null">
        IsDistribute = #{isdistribute,jdbcType=BIT},
      </if>
      <if test="freezeamount != null">
        FreezeAmount = #{freezeamount,jdbcType=DECIMAL},
      </if>
      <if test="freezepoint != null">
        FreezePoint = #{freezepoint,jdbcType=DECIMAL},
      </if>
      <if test="photourl != null">
        PhotoUrl = #{photourl,jdbcType=VARCHAR},
      </if>
      <if test="defaultloginflag != null">
        DefaultLoginFlag = #{defaultloginflag,jdbcType=BIT},
      </if>
      <if test="registtype != null">
        RegistType = #{registtype,jdbcType=TINYINT},
      </if>
      <if test="belongguide != null">
        BelongGuide = #{belongguide,jdbcType=VARCHAR},
      </if>
      <if test="vipbank != null">
        VipBank = #{vipbank,jdbcType=NVARCHAR},
      </if>
      <if test="vipbankno != null">
        VipBankNo = #{vipbankno,jdbcType=VARCHAR},
      </if>
      <if test="holdname != null">
        HoldName = #{holdname,jdbcType=NVARCHAR},
      </if>
      <if test="customerId != null">
        customer_id = #{customerId,jdbcType=INTEGER},
      </if>
      <if test="creator != null">
        Creator = #{creator,jdbcType=VARCHAR},
      </if>
      <if test="madedate != null">
        MadeDate = #{madedate,jdbcType=TIMESTAMP},
      </if>
      <if test="buytimes != null">
        BuyTimes = #{buytimes,jdbcType=INTEGER},
      </if>
      <if test="buyprice != null">
        BuyPrice = #{buyprice,jdbcType=DECIMAL},
      </if>
      <if test="lastchatdate != null">
        LastChatDate = #{lastchatdate,jdbcType=TIMESTAMP},
      </if>
      <if test="weixincode != null">
        WeixinCode = #{weixincode,jdbcType=VARCHAR},
      </if>
      <if test="attention != null">
        Attention = #{attention,jdbcType=BIT},
      </if>
      <if test="interactiontime != null">
        InteractionTime = #{interactiontime,jdbcType=TIMESTAMP},
      </if>
      <if test="allowedarrearflag != null">
        AllowedArrearFlag = #{allowedarrearflag,jdbcType=BIT},
      </if>
      <if test="allowedaramountmax != null">
        AllowedARAmountMax = #{allowedaramountmax,jdbcType=DECIMAL},
      </if>
      <if test="accumulateddeposit != null">
        AccumulatedDeposit = #{accumulateddeposit,jdbcType=DECIMAL},
      </if>
      <if test="accumulateddepositamount != null">
        AccumulatedDepositAmount = #{accumulateddepositamount,jdbcType=DECIMAL},
      </if>
      <if test="allowdepositrate != null">
        AllowDepositRate = #{allowdepositrate,jdbcType=BIT},
      </if>
      <if test="depositdiscountrate != null">
        DepositDiscountRate = #{depositdiscountrate,jdbcType=DECIMAL},
      </if>
      <if test="lastordertime != null">
        LastOrderTime = #{lastordertime,jdbcType=TIMESTAMP},
      </if>
      <if test="interfacememo != null">
        Interfacememo = #{interfacememo,jdbcType=TINYINT},
      </if>
      <if test="finishinfoflag != null">
        FinishInfoFlag = #{finishinfoflag,jdbcType=TINYINT},
      </if>
      <if test="photo != null">
        Photo = #{photo,jdbcType=LONGVARBINARY},
      </if>
    </set>
    where VIPID = #{vipid,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.fuxi.ws.data.entity.Vip">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    update VIP
    set Code = #{code,jdbcType=VARCHAR},
      VIP = #{vip,jdbcType=VARCHAR},
      VIPTypeID = #{viptypeid,jdbcType=VARCHAR},
      DistrictID = #{districtid,jdbcType=VARCHAR},
      Address = #{address,jdbcType=VARCHAR},
      Zip = #{zip,jdbcType=VARCHAR},
      Tel = #{tel,jdbcType=VARCHAR},
      MobilePhone = #{mobilephone,jdbcType=VARCHAR},
      EMail = #{email,jdbcType=VARCHAR},
      Sex = #{sex,jdbcType=VARCHAR},
      Marriage = #{marriage,jdbcType=VARCHAR},
      NickName = #{nickname,jdbcType=VARCHAR},
      Education = #{education,jdbcType=VARCHAR},
      Vocation = #{vocation,jdbcType=VARCHAR},
      Income = #{income,jdbcType=VARCHAR},
      Country = #{country,jdbcType=VARCHAR},
      Nation = #{nation,jdbcType=VARCHAR},
      IDType = #{idtype,jdbcType=VARCHAR},
      IDNo = #{idno,jdbcType=VARCHAR},
      DepartmentID = #{departmentid,jdbcType=VARCHAR},
      BeginDate = #{begindate,jdbcType=TIMESTAMP},
      EndDate = #{enddate,jdbcType=TIMESTAMP},
      BirthDay = #{birthday,jdbcType=TIMESTAMP},
      ChineseBirthDay = #{chinesebirthday,jdbcType=VARCHAR},
      SpecialDate = #{specialdate,jdbcType=TIMESTAMP},
      ClothingSize = #{clothingsize,jdbcType=VARCHAR},
      ShoesSize = #{shoessize,jdbcType=VARCHAR},
      FavoriteBrand = #{favoritebrand,jdbcType=VARCHAR},
      InitPurchasedAmount = #{initpurchasedamount,jdbcType=DECIMAL},
      PurchasedAmount = #{purchasedamount,jdbcType=DECIMAL},
      LastPurchasedDate = #{lastpurchaseddate,jdbcType=TIMESTAMP},
      ModifyDate = #{modifydate,jdbcType=TIMESTAMP},
      Editor = #{editor,jdbcType=VARCHAR},
      Memo = #{memo,jdbcType=VARCHAR},
      UseFlag = #{useflag,jdbcType=BIT},
      StopFlag = #{stopflag,jdbcType=BIT},
      HelpCode = #{helpcode,jdbcType=VARCHAR},
      ICQ = #{icq,jdbcType=VARCHAR},
      WebNo = #{webno,jdbcType=VARCHAR},
      InitSalesPoint = #{initsalespoint,jdbcType=DECIMAL},
      SalesPoint = #{salespoint,jdbcType=DECIMAL},
      Password = #{password,jdbcType=VARCHAR},
      ExchangedPoint = #{exchangedpoint,jdbcType=DECIMAL},
      UsablePoint = #{usablepoint,jdbcType=DECIMAL},
      UsableDepositAmount = #{usabledepositamount,jdbcType=DECIMAL},
      PromptInfo = #{promptinfo,jdbcType=VARCHAR},
      OftenEvection = #{oftenevection,jdbcType=BIT},
      OftenEvtCity = #{oftenevtcity,jdbcType=VARCHAR},
      Province = #{province,jdbcType=VARCHAR},
      City = #{city,jdbcType=VARCHAR},
      County = #{county,jdbcType=VARCHAR},
      Street = #{street,jdbcType=VARCHAR},
      Doorplate = #{doorplate,jdbcType=VARCHAR},
      VIPNO = #{vipno,jdbcType=VARCHAR},
      EnrollmentDate = #{enrollmentdate,jdbcType=TIMESTAMP},
      OldUsableDepositAmount = #{oldusabledepositamount,jdbcType=DECIMAL},
      MobilePhone2 = #{mobilephone2,jdbcType=VARCHAR},
      LineNickname = #{linenickname,jdbcType=VARCHAR},
      Industry = #{industry,jdbcType=VARCHAR},
      Hobbies = #{hobbies,jdbcType=VARCHAR},
      BirthdayYear = #{birthdayyear,jdbcType=INTEGER},
      Height = #{height,jdbcType=VARCHAR},
      Weight = #{weight,jdbcType=VARCHAR},
      RecommenderCode = #{recommendercode,jdbcType=VARCHAR},
      VIPLevel = #{viplevel,jdbcType=VARCHAR},
      VipPassWord = #{vippassword,jdbcType=VARCHAR},
      VipPayWord = #{vippayword,jdbcType=VARCHAR},
      wxId = #{wxid,jdbcType=NVARCHAR},
      Lang = #{lang,jdbcType=DECIMAL},
      Lat = #{lat,jdbcType=DECIMAL},
      IsDistribute = #{isdistribute,jdbcType=BIT},
      FreezeAmount = #{freezeamount,jdbcType=DECIMAL},
      FreezePoint = #{freezepoint,jdbcType=DECIMAL},
      PhotoUrl = #{photourl,jdbcType=VARCHAR},
      DefaultLoginFlag = #{defaultloginflag,jdbcType=BIT},
      RegistType = #{registtype,jdbcType=TINYINT},
      BelongGuide = #{belongguide,jdbcType=VARCHAR},
      VipBank = #{vipbank,jdbcType=NVARCHAR},
      VipBankNo = #{vipbankno,jdbcType=VARCHAR},
      HoldName = #{holdname,jdbcType=NVARCHAR},
      customer_id = #{customerId,jdbcType=INTEGER},
      Creator = #{creator,jdbcType=VARCHAR},
      MadeDate = #{madedate,jdbcType=TIMESTAMP},
      BuyTimes = #{buytimes,jdbcType=INTEGER},
      BuyPrice = #{buyprice,jdbcType=DECIMAL},
      LastChatDate = #{lastchatdate,jdbcType=TIMESTAMP},
      WeixinCode = #{weixincode,jdbcType=VARCHAR},
      Attention = #{attention,jdbcType=BIT},
      InteractionTime = #{interactiontime,jdbcType=TIMESTAMP},
      AllowedArrearFlag = #{allowedarrearflag,jdbcType=BIT},
      AllowedARAmountMax = #{allowedaramountmax,jdbcType=DECIMAL},
      AccumulatedDeposit = #{accumulateddeposit,jdbcType=DECIMAL},
      AccumulatedDepositAmount = #{accumulateddepositamount,jdbcType=DECIMAL},
      AllowDepositRate = #{allowdepositrate,jdbcType=BIT},
      DepositDiscountRate = #{depositdiscountrate,jdbcType=DECIMAL},
      LastOrderTime = #{lastordertime,jdbcType=TIMESTAMP},
      Interfacememo = #{interfacememo,jdbcType=TINYINT},
      FinishInfoFlag = #{finishinfoflag,jdbcType=TINYINT},
      Photo = #{photo,jdbcType=LONGVARBINARY}
    where VIPID = #{vipid,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.Vip">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 27 11:22:37 CST 2019.
    -->
    update VIP
    set Code = #{code,jdbcType=VARCHAR},
      VIP = #{vip,jdbcType=VARCHAR},
      VIPTypeID = #{viptypeid,jdbcType=VARCHAR},
      DistrictID = #{districtid,jdbcType=VARCHAR},
      Address = #{address,jdbcType=VARCHAR},
      Zip = #{zip,jdbcType=VARCHAR},
      Tel = #{tel,jdbcType=VARCHAR},
      MobilePhone = #{mobilephone,jdbcType=VARCHAR},
      EMail = #{email,jdbcType=VARCHAR},
      Sex = #{sex,jdbcType=VARCHAR},
      Marriage = #{marriage,jdbcType=VARCHAR},
      NickName = #{nickname,jdbcType=VARCHAR},
      Education = #{education,jdbcType=VARCHAR},
      Vocation = #{vocation,jdbcType=VARCHAR},
      Income = #{income,jdbcType=VARCHAR},
      Country = #{country,jdbcType=VARCHAR},
      Nation = #{nation,jdbcType=VARCHAR},
      IDType = #{idtype,jdbcType=VARCHAR},
      IDNo = #{idno,jdbcType=VARCHAR},
      DepartmentID = #{departmentid,jdbcType=VARCHAR},
      BeginDate = #{begindate,jdbcType=TIMESTAMP},
      EndDate = #{enddate,jdbcType=TIMESTAMP},
      BirthDay = #{birthday,jdbcType=TIMESTAMP},
      ChineseBirthDay = #{chinesebirthday,jdbcType=VARCHAR},
      SpecialDate = #{specialdate,jdbcType=TIMESTAMP},
      ClothingSize = #{clothingsize,jdbcType=VARCHAR},
      ShoesSize = #{shoessize,jdbcType=VARCHAR},
      FavoriteBrand = #{favoritebrand,jdbcType=VARCHAR},
      InitPurchasedAmount = #{initpurchasedamount,jdbcType=DECIMAL},
      PurchasedAmount = #{purchasedamount,jdbcType=DECIMAL},
      LastPurchasedDate = #{lastpurchaseddate,jdbcType=TIMESTAMP},
      ModifyDate = #{modifydate,jdbcType=TIMESTAMP},
      Editor = #{editor,jdbcType=VARCHAR},
      Memo = #{memo,jdbcType=VARCHAR},
      UseFlag = #{useflag,jdbcType=BIT},
      StopFlag = #{stopflag,jdbcType=BIT},
      HelpCode = #{helpcode,jdbcType=VARCHAR},
      ICQ = #{icq,jdbcType=VARCHAR},
      WebNo = #{webno,jdbcType=VARCHAR},
      InitSalesPoint = #{initsalespoint,jdbcType=DECIMAL},
      SalesPoint = #{salespoint,jdbcType=DECIMAL},
      Password = #{password,jdbcType=VARCHAR},
      ExchangedPoint = #{exchangedpoint,jdbcType=DECIMAL},
      UsablePoint = #{usablepoint,jdbcType=DECIMAL},
      UsableDepositAmount = #{usabledepositamount,jdbcType=DECIMAL},
      PromptInfo = #{promptinfo,jdbcType=VARCHAR},
      OftenEvection = #{oftenevection,jdbcType=BIT},
      OftenEvtCity = #{oftenevtcity,jdbcType=VARCHAR},
      Province = #{province,jdbcType=VARCHAR},
      City = #{city,jdbcType=VARCHAR},
      County = #{county,jdbcType=VARCHAR},
      Street = #{street,jdbcType=VARCHAR},
      Doorplate = #{doorplate,jdbcType=VARCHAR},
      VIPNO = #{vipno,jdbcType=VARCHAR},
      EnrollmentDate = #{enrollmentdate,jdbcType=TIMESTAMP},
      OldUsableDepositAmount = #{oldusabledepositamount,jdbcType=DECIMAL},
      MobilePhone2 = #{mobilephone2,jdbcType=VARCHAR},
      LineNickname = #{linenickname,jdbcType=VARCHAR},
      Industry = #{industry,jdbcType=VARCHAR},
      Hobbies = #{hobbies,jdbcType=VARCHAR},
      BirthdayYear = #{birthdayyear,jdbcType=INTEGER},
      Height = #{height,jdbcType=VARCHAR},
      Weight = #{weight,jdbcType=VARCHAR},
      RecommenderCode = #{recommendercode,jdbcType=VARCHAR},
      VIPLevel = #{viplevel,jdbcType=VARCHAR},
      VipPassWord = #{vippassword,jdbcType=VARCHAR},
      VipPayWord = #{vippayword,jdbcType=VARCHAR},
      wxId = #{wxid,jdbcType=NVARCHAR},
      Lang = #{lang,jdbcType=DECIMAL},
      Lat = #{lat,jdbcType=DECIMAL},
      IsDistribute = #{isdistribute,jdbcType=BIT},
      FreezeAmount = #{freezeamount,jdbcType=DECIMAL},
      FreezePoint = #{freezepoint,jdbcType=DECIMAL},
      PhotoUrl = #{photourl,jdbcType=VARCHAR},
      DefaultLoginFlag = #{defaultloginflag,jdbcType=BIT},
      RegistType = #{registtype,jdbcType=TINYINT},
      BelongGuide = #{belongguide,jdbcType=VARCHAR},
      VipBank = #{vipbank,jdbcType=NVARCHAR},
      VipBankNo = #{vipbankno,jdbcType=VARCHAR},
      HoldName = #{holdname,jdbcType=NVARCHAR},
      customer_id = #{customerId,jdbcType=INTEGER},
      Creator = #{creator,jdbcType=VARCHAR},
      MadeDate = #{madedate,jdbcType=TIMESTAMP},
      BuyTimes = #{buytimes,jdbcType=INTEGER},
      BuyPrice = #{buyprice,jdbcType=DECIMAL},
      LastChatDate = #{lastchatdate,jdbcType=TIMESTAMP},
      WeixinCode = #{weixincode,jdbcType=VARCHAR},
      Attention = #{attention,jdbcType=BIT},
      InteractionTime = #{interactiontime,jdbcType=TIMESTAMP},
      AllowedArrearFlag = #{allowedarrearflag,jdbcType=BIT},
      AllowedARAmountMax = #{allowedaramountmax,jdbcType=DECIMAL},
      AccumulatedDeposit = #{accumulateddeposit,jdbcType=DECIMAL},
      AccumulatedDepositAmount = #{accumulateddepositamount,jdbcType=DECIMAL},
      AllowDepositRate = #{allowdepositrate,jdbcType=BIT},
      DepositDiscountRate = #{depositdiscountrate,jdbcType=DECIMAL},
      LastOrderTime = #{lastordertime,jdbcType=TIMESTAMP},
      Interfacememo = #{interfacememo,jdbcType=TINYINT},
      FinishInfoFlag = #{finishinfoflag,jdbcType=TINYINT}
    where VIPID = #{vipid,jdbcType=VARCHAR}
  </update>

	<select id="selectVipAmount" parameterType="java.lang.String" resultMap="BaseResultMap">
		select a.VIPID,a.VIP,a.Code,a.UsablePoint,isnull(a.UsableDepositAmount,0) UsableDepositAmount,b.VIPType as VIPLevel,
		a.Mobilephone,a.Linenickname,a.Photourl
		from VIP a left join
		VIPType b on a.VIPTypeID=b.VIPTypeID
		where a.VIPID = #{vipid,jdbcType=VARCHAR}
	</select>
	
	<!-- 后台会员列表 -->
  <select id="selectViplist" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
  	SELECT CONVERT(varchar(10),a.BeginDate, 121) AS BeginDate, a.VIPID, a.Code, a.VIP, a.MobilePhone, isnull(a.Sex,'') Sex,  		
  		isnull(a.Province,'') Province, isnull(a.City,'') as City,  		
  		a.PhotoUrl, b.VIPType, c.Department,
  		case a.RegistType when 1 then '直接注册' when 2 then '会员分享' when 3 then '扫描门店二维码' 
  		when 4 then '扫描导购二维码' when 5 then '其他注册' when 6 then '微信会员卡注册' when 7 then '导入' 
  		when 8 then '手工添加' else '其他注册' end as RegistType,CONVERT(varchar(10),a.EnrollmentDate, 121) AS EnrollmentDate,
  		a.Attention,case when DATEDIFF(mi,a.InteractionTime,GETDATE()) &lt; 2880 then 1 else 0 end as Interaction
	FROM  VIP AS a left JOIN
	VIPType AS b ON a.VIPTypeID = b.VIPTypeID left JOIN
	Department AS c ON a.DepartmentID = c.DepartmentID
    <if test="conditions != null and conditions != ''">
		where			
		${conditions}
	</if>
	<if test="conditions == null or conditions == ''">
		where a.VIPID <![CDATA[<>]]>'-111'
	</if>
  </select>
  <!-- 后台待对照会员列表 -->
  <select id="selectnoViplist" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
  	SELECT   a.VIPNO,a.VIPID, a.Code , a.VIP, a.MobilePhone, isnull(a.Sex,'') Sex,  		 		
  		a.PhotoUrl, b.VIPType, c.Department,
  		case a.RegistType when 1 then '直接注册' when 2 then '会员分享' when 3 then '扫描门店二维码' 
  		when 4 then '扫描导购二维码' when 5 then '其他注册' when 6 then '微信会员卡注册' when 7 then '导入' 
  		when 8 then '手工添加' else '其他注册' end as RegistType,CONVERT(varchar(10),a.EnrollmentDate, 121) AS BeginDate,a.Attention,case when DATEDIFF(mi,a.InteractionTime,GETDATE()) &lt; 2880 then 1 else 0 end as Interaction 
	FROM  VIP AS a left JOIN
	VIPType AS b ON a.VIPTypeID = b.VIPTypeID left JOIN
	Department AS c ON a.DepartmentID = c.DepartmentID
	where (a.VIPNO  is null or a.VIPNO='')
    <if test="conditions != null and conditions != ''">
		 ${conditions} 
	</if>
	<if test="conditions == null or conditions == ''">
		and a.VIPID <![CDATA[<>]]>'-111'
	</if>
  </select>
  
  <select id="getVip" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
  	select a.VIPID,a.Code,isnull(a.VIP,'') VIP,a.VIPTypeID,isnull(b.VIPType,'') VIPType,isnull(a.Zip,'') Zip,
  		isnull(a.MobilePhone,'') MobilePhone,isnull(a.EMail,'') EMail,isnull(a.Sex,'') Sex,isnull(d.Department,'') Department,
		isnull(Convert(varchar(19),a.BirthDay,121),'') BirthDay,isnull(a.UsablePoint,0) UsablePoint,isnull(a.UsableDepositAmount,0) UsableDepositAmount,
		isnull(a.Province,'') Province,isnull(a.City,'') City,isnull(a.County,'') County,isnull(a.Address,'') Address,
		isnull(Convert(varchar(19),a.EnrollmentDate,121),'') EnrollmentDate,isnull(a.LineNickname,'') LineNickname,isnull(a.RecommenderCode,'') RecommenderCode,
		a.IsDistribute,isnull(a.RegistType,1) RegistType,isnull(e.Name,'') BelongGuide
	from vip a left join 
	viptype b on a.VIPTypeID=b.VIPTypeID left join
	Department d on d.departmentid=a.departmentid left join
	Employee e on e.EmployeeID=a.BelongGuide
    <if test="conditions != null and conditions != ''">
		where			
		${conditions}
	</if>
	<if test="conditions == null or conditions == ''">
		where a.VIPID <![CDATA[<>]]>'-111'
	</if>
	order by a.VIPID desc
  </select>
  
  <select id="vipdetail" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
  	select a.VIPID,a.Code,isnull(a.VIP,'') VIP,isnull(b.VIPType,'') VIPType,a.PhotoUrl,isnull(a.LineNickname,'') Nickname,
  		isnull(a.MobilePhone,'') MobilePhone,isnull(a.EMail,'') EMail,isnull(a.Sex,'') Sex,isnull(d.Department,'') Department,
		isnull(CONVERT(varchar(10),a.BirthDay,121),'') BirthDay,isnull(a.UsablePoint,0) UsablePoint,
		isnull(a.UsableDepositAmount,0) UsableDepositAmount,isnull(a.Province,'') Province,isnull(a.City,'') City,a.ClothingSize,
		isnull(a.County,'') County,isnull((select VIP from vip t where t.code=a.RecommenderCode),'') Recommender,a.ShoesSize,
		case a.RegistType when 1 then '直接注册' when 2 then '会员分享' when 3 then '扫描门店二维码' when 4 then '扫描导购二维码' 
		when 5 then '其他注册' when 6 then '微信会员卡注册' when 7 then '导入'	when 8 then '手工添加' else '其他注册'
		end as RegistType,a.IsDistribute,f.IsGuide,isnull(e.Name,'') BelongGuide,a.BelongGuide as BelongGuideID,isnull(a.VipBank,'') VipBank,
		isnull(a.VipBankNo,'') VipBankNo,isnull(a.HoldName,'') HoldName,p.Height,p.Weight,p.Bust,p.Waistline,p.Hips,p.Shoulder,
		p.UpArmsize,p.Legsize,p.BottomBust,p.FootLen,p.FootWidth,p.FootCycle,a.VipNo,CONVERT(varchar(10),a.BeginDate, 121) AS BeginDate,
		CONVERT(varchar(10),a.EnrollmentDate, 121) AS EnrollmentDate,CONVERT(varchar(10),a.EndDate, 121) AS enddate	
	from vip a left join 
	viptype b on a.VIPTypeID=b.VIPTypeID left join
	Department d on d.departmentid=a.departmentid left join
	Employee e on e.EmployeeID=a.BelongGuide left join
	Employee f on f.VIPID=a.VIPID left join
	W_VipProp p on p.vipid=a.vipid
   	where a.VIPID = #{vipid,jdbcType=VARCHAR}
  </select>
  
  <select id="vipLabels" resultType="java.util.LinkedHashMap">
		select
		a.*,b.LabelName,b.LabelType,b.Color from W_VipLabel a
		join W_Label b on
		a.LabelID=b.LabelID
		where a.VIPID=#{ vipid }
	</select>

	<select id="noSelectLabel" resultType="java.util.LinkedHashMap">
		select * from W_Label
		<if test="list.size() &gt;0">
			where
			LabelID not in
			<foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
				#{item}
			</foreach>
		</if>
	</select>
	
	<!-- 会员营销列表 -->
	<select id="searchViplist" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
	  	SELECT a.VIPID,a.VIPNO,a.Code,a.VIP, a.PhotoUrl,a.UsablePoint,a.UsableDepositAmount,a.EnrollmentDate,
	  		a.LastChatDate,a.LastPurchasedDate,a.BuyTimes,a.PurchasedAmount,a.BuyPrice,a.wxId,CONVERT(varchar(10),a.BeginDate, 121) + '<![CDATA[<br/>]]>'
		+ CONVERT(varchar(10), a.BeginDate, 108) AS BeginDate,a.Attention,a.MobilePhone,a.Province,a.City,
		CONVERT(varchar(10),BeginDate, 121) AS BeginDate1,CONVERT(varchar(10),EndDate, 121) AS EndDate,
		CONVERT(varchar(10),BirthDay, 121) AS BirthDay,CONVERT(varchar(10),LastPurchasedDate, 121) AS LastPurchasedDate1,
		case when a.InteractionTime is null then 0 when datediff(hh,a.InteractionTime,getdate())&gt;48 then 0 else 1 end as Interaction,
		a.DepartmentID,department.Department,a.VIPTypeID,b.VIPType,pp.labelname
		FROM  VIP AS a 	
		left join department on department.departmentid=a.departmentid
		inner JOIN VIPType AS b ON a.VIPTypeID = b.VIPTypeID 
		<if test="typelist != null and typelist.size() &gt;1">
			and b.VIPTypeID in
			<foreach close=")" collection="typelist" index="index" item="item" open="(" separator=",">
				#{item}
			</foreach>
		</if>
		<if test="typelist != null and typelist.size()==1">
			and b.VIPTypeID =
			<foreach close="" collection="typelist" index="index" item="item" open="" separator="">
				#{item}
			</foreach>
		</if>	
		<if test="labellist != null and labellist.size() &gt;0">
			inner JOIN
			(select distinct VIPID from W_VipLabel where 
			<if test="labellist.size() &gt;1">
				LabelID in	
				<foreach close=")" collection="labellist" index="index" item="item" open="(" separator=",">
					#{item}
				</foreach>
			</if>
			<if test="labellist.size()==1">
				LabelID =
				<foreach close="" collection="labellist" index="index" item="item" open="" separator="">
					#{item}
				</foreach>
			</if>
			) lb on lb.VIPID=a.VIPID
		</if>
		<if test="props != null and props != ''">
			inner JOIN
			W_VipProp p on p.VIPID=a.VIPID
			and ${props}
		</if>
		left join (	
			select tt.VIPID, labelname = (stuff((select '[00]' + bb.LabelName 
			from W_VipLabel aa inner join W_Label bb on aa.LabelID=bb.LabelID 
		    where aa.VIPID = tt.VIPID and bb.LabelType=3 for xml path('')),1,4,'')) from W_VipLabel tt 
		    group by tt.VIPID
	    ) pp on pp.VIPID=a.VIPID
		where 1=1
		<if test="arealist != null and arealist.size() &gt;0">			
			<if test="arealist.size() &gt;1">
				and a.Province in
				<foreach close=")" collection="arealist" index="index" item="item" open="(" separator=",">
					#{item}
				</foreach>
			</if>
			<if test="arealist.size()==1">
				and a.Province =
				<foreach close="" collection="arealist" index="index" item="item" open="" separator="">
					#{item}
				</foreach>
			</if>
		</if>	
		<if test="provincename != null and provincename != ''">
			and a.Province = #{provincename,jdbcType=VARCHAR}
		</if>
		<if test="cityname != null and cityname != ''">
			and a.City = #{cityname,jdbcType=VARCHAR}
		</if>	
	    <if test="expens != null and expens != ''">
			and ${expens}
		</if>
		<if test="department != null and department != ''">
			and department.department like '%'+#{department,jdbcType=NVARCHAR}+'%' 
		</if>
		<if test="birthday == 1">
			and CONVERT(varchar(5),a.BirthDay,101)= Convert(varchar(5),getdate(),101) 
		</if>
		<if test="birthday == 2">
			and Convert(varchar(2),a.BirthDay,101)= Convert(varchar(2),getdate(),101) 
		</if>
		<if test="birthday == 3">
			and Convert(varchar(2),a.BirthDay,101)= Convert(varchar(2),Dateadd(mm,1,getdate()),101) 
		</if>
		<if test="status == 0">
			and a.Attention =1 
		</if>
		<if test="status == 1">
			and (a.Attention is null or a.Attention=0)
		</if>
		<if test="status == 2">
			and a.wxId<![CDATA[<>]]>''
		</if>
		<if test="status == 3">
			and (a.wxId is null or a.wxId='')
		</if>
		<if test="status == 4">
			and (a.Attention =1 and DATEDIFF(mi,a.InteractionTime,GETDATE()) <![CDATA[<]]> 2880)
		</if>
		<if test="status == 5">
			and ((a.Attention <![CDATA[<>]]> 1 or DATEDIFF(mi,a.InteractionTime,GETDATE()) is null or DATEDIFF(mi,a.InteractionTime,GETDATE()) &gt;= 2880))
		</if>
		<if test="status == 6">
			and a.Attention = 1 and a.wxId<![CDATA[<>]]>''
		</if>
		<if test="(expens == null or expens == '') and (arealist == null or arealist.size()==0) and (props == null or props == '') and (labellist == null or labellist.size()==0) and (typelist == null or typelist.size()==0)">
			and a.VIPID <![CDATA[<>]]>'-111'
		</if>
		order by 
		<if test="buynumber != null and buynumber != ''">
			<if test="buynumber == 1">
				a.BuyTimes desc,
			</if>
			<if test="buynumber != 1">
				a.BuyTimes asc,
			</if>
		</if>
		<if test="buymoney != null and buymoney != ''">
			<if test="buymoney == 1">
				a.PurchasedAmount desc,
			</if>
			<if test="buymoney != 1">
				a.PurchasedAmount asc,
			</if>
		</if>
		<if test="buyprice != null and buyprice != ''">
			<if test="buyprice == 1">
				a.BuyPrice desc,
			</if>
			<if test="buyprice != 1">
				a.BuyPrice asc,
			</if>
		</if>
		a.VIPID desc
  </select>
  
  <select id="searchVipBaselist" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
	  	SELECT a.VIPID,a.VIP,a.MobilePhone,a.VIPNO,a.Code,a.wxId,a.InteractionTime 
		FROM  VIP AS a 	
		left join department on department.departmentid=a.departmentid
		inner JOIN VIPType AS b ON a.VIPTypeID = b.VIPTypeID 
		<if test="typelist.size() &gt;1">
			and b.VIPTypeID in
			<foreach close=")" collection="typelist" index="index" item="item" open="(" separator=",">
				#{item}
			</foreach>
		</if>
		<if test="typelist.size()==1">
			and b.VIPTypeID =
			<foreach close="" collection="typelist" index="index" item="item" open="" separator="">
				#{item}
			</foreach>
		</if>
		<if test="labellist != null and labellist.size() &gt;0">
			inner JOIN
			(select distinct VIPID from W_VipLabel where 
			<if test="labellist.size() &gt;1">
				LabelID in	
				<foreach close=")" collection="labellist" index="index" item="item" open="(" separator=",">
					#{item}
				</foreach>
			</if>
			<if test="labellist.size()==1">
				LabelID =
				<foreach close="" collection="labellist" index="index" item="item" open="" separator="">
					#{item}
				</foreach>
			</if>
			) lb on lb.VIPID=a.VIPID
		</if>
		<if test="props != null and props != ''">
			inner JOIN
			W_VipProp p on p.VIPID=a.VIPID
			and ${props}
		</if>
		where 1=1
		<if test="arealist != null and arealist.size() &gt;0">			
			<if test="arealist.size() &gt;1">
				and a.Province in
				<foreach close=")" collection="arealist" index="index" item="item" open="(" separator=",">
					#{item}
				</foreach>
			</if>
			<if test="arealist.size()==1">
				and a.Province =
				<foreach close="" collection="arealist" index="index" item="item" open="" separator="">
					#{item}
				</foreach>
			</if>
		</if>		
		<if test="provincename != null and provincename != ''">
			and a.Province = #{provincename,jdbcType=VARCHAR}
		</if>
		<if test="cityname != null and cityname != ''">
			and a.City = #{cityname,jdbcType=VARCHAR}
		</if>	
	    <if test="expens != null and expens != ''">
			and ${expens}
		</if>
		<if test="department != null and department != ''">
			and department.department like '%'+#{department,jdbcType=NVARCHAR}+'%' 
		</if>
		<if test="birthday == 1">
			and CONVERT(varchar(5),a.BirthDay,101)= Convert(varchar(5),getdate(),101) 
		</if>
		<if test="birthday == 2">
			and Convert(varchar(2),a.BirthDay,101)= Convert(varchar(2),getdate(),101) 
		</if>
		<if test="birthday == 3">
			and Convert(varchar(2),a.BirthDay,101)= Convert(varchar(2),Dateadd(mm,1,getdate()),101) 
		</if>
		<if test="status == 0">
			and a.Attention =1 
		</if>
		<if test="status == 1">
			and (a.Attention is null or a.Attention=0)
		</if>
		<if test="status == 2">
			and a.wxId<![CDATA[<>]]>''
		</if>
		<if test="status == 3">
			and (a.wxId is null or a.wxId='')
		</if>
		<if test="status == 4">
			and (a.Attention =1 and DATEDIFF(mi,a.InteractionTime,GETDATE()) <![CDATA[<]]> 2880)
		</if>
		<if test="status == 5">
			and ((a.Attention <![CDATA[<>]]> 1 or DATEDIFF(mi,a.InteractionTime,GETDATE()) is null or DATEDIFF(mi,a.InteractionTime,GETDATE()) &gt;= 2880))
		</if>
		<if test="status == 6">
			and a.Attention = 1 and a.wxId<![CDATA[<>]]>''
		</if>
		<if test="(expens == null or expens == '') and (arealist == null or arealist.size()==0) and (props == null or props == '') and (labellist == null or labellist.size()==0) and (typelist == null or typelist.size()==0)">
			and a.VIPID <![CDATA[<>]]>'-111'
		</if>
		order by a.VIPID desc
  </select>
  
  <!-- 读取会员信息修改 -->
  <select id="selectalterinfo" resultType="java.util.LinkedHashMap">
  	select a.VIP, a.VIPID, a.Code, b.VIPType, a.Sex, a.BirthDay, a.LineNickname, a.MobilePhone, a.EMail, a.Province, a.City, 
  			a.County, c.Department
  	from VIP as a inner JOIN VIPType as b ON a.VIPTypeID = b.VIPTypeID 
  				  inner JOIN Department as c ON a.DepartmentID = c.DepartmentID
  	where a.VIPID = #{vipId,jdbcType=VARCHAR}
 
  </select>
  
  <!-- 会员列表导出 -->
	<select id="outputViplist" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
	  	SELECT isnull(a.VIPID,'') as VIPID , a.Code,isnull(b.VIPType,'') as VIPType ,isnull(a.VIP,'') as VIP, isnull(a.Sex,'') as Sex, isnull(a.BirthDay,'') as BirthDay, isnull(a.Province,'') as Province, isnull(a.City,'') as City, isnull(a.LineNickname,'') as LineNickname,isnull(a.BelongGuide,'') as BelongGuide,isnull(f.Name,'') as EmployeeName , 
	  		isnull(a.MobilePhone,'') as MobilePhone,isnull(a.EMail,'') as EMail, isnull(a.UsablePoint,'') as UsablePoint, isnull(a.UsableDepositAmount,'') as UsableDepositAmount, isnull(c.Department,'') as Department, isnull(CONVERT(varchar(10),a.BeginDate, 121),'') as BeginDate,
	  		dbo.getVipLabels(a.VIPID, 1) AS viplabel, dbo.getVipLabels(a.VIPID, 2) AS goodslabel, 
	  		dbo.getVipLabels(a.VIPID, 3) AS grouplabel,a.ClothingSize, a.ShoesSize, e.Height, e.Weight, 
	  		e.Bust,e.Waistline, e.Hips, e.Shoulder, e.UpArmsize, e.Legsize, e.BottomBust, e.FootLen, 
	  		e.FootWidth,e.FootCycle, case when a.wxId<![CDATA[<>]]>'' then '是' else '否' end as rigirstion,
	  		case when a.Attention=1 then '是' else '否' end as Attention
	  		,case a.RegistType when 1 then '直接注册' when 2 then '会员分享' when 3 then '扫描门店二维码' 
  			when 4 then '扫描导购二维码' when 5 then '其他注册' when 6 then '微信会员卡注册' when 7 then '导入' 
  			when 8 then '手工添加' else '其他注册' end as RegistType,
  		isnull(CONVERT(varchar(10),a.EnrollmentDate, 121),'') AS EnrollmentDate
		FROM  VIP AS a INNER JOIN
		VIPType AS b ON a.VIPTypeID = b.VIPTypeID
		 LEFT OUTER JOIN Employee as f on f.EmployeeID=a.BelongGuide
		 LEFT OUTER JOIN
		Department c ON a.DepartmentID = c.DepartmentID LEFT OUTER JOIN
		W_VipProp AS e ON a.VIPID = e.VIPID
		<if test="conditions != null and conditions != ''">
			where			
			${conditions}
		</if>
		<if test="conditions == null or conditions == ''">
			where a.VIPID <![CDATA[<>]]>'-111'
		</if>
		order by a.VIPID desc
  </select>
  
  <update id="updateweixincardcode" parameterType="com.fuxi.ws.data.entity.Vip">
  	update VIP set Code = #{code,jdbcType=VARCHAR},WeixinCode = #{code,jdbcType=VARCHAR} 
  	where Code = #{oldcode,jdbcType=VARCHAR}
  </update>
  
	<select id="vipinfo" resultType="java.util.LinkedHashMap">
		${paramSQL}
	</select>
	
	<select id="vippreference" resultType="java.util.LinkedHashMap">
		${paramSQL}
	</select>
	
	<select id="viprecommend" resultType="java.util.LinkedHashMap">
		${paramSQL}
	</select>
	
	<select id="purchasedate" resultType="java.util.LinkedHashMap">
		${paramSQL}
	</select>
	
	<select id="purchasehistory" resultType="java.util.LinkedHashMap">
		${paramSQL}
	</select>
	
	<select id="getRegentData" resultType="java.util.LinkedHashMap">
		${paramSQL}
	</select>
	<select id="selectVipsNum" resultType="java.lang.Integer">
		${paramSQL}
	</select>
	<!-- 修改线下会员编号 -->
	<update id="updateVipNo" parameterType="java.util.LinkedHashMap">
		update VIP set vipno =#{vipno,jdbcType=VARCHAR} where VIPID=#{vipid,jdbcType=VARCHAR}
	</update>
	<select id="selectCountVips" resultType="java.lang.Integer">
		select count(*) from vip
	</select>
	
	<!-- 后台通过会员分组统计获取会员列表 -->
  <select id="selectGroupViplist" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
  	SELECT CONVERT(varchar(10),a.BeginDate, 121) AS BeginDate, a.VIPID, a.Code, a.VIP, a.MobilePhone, isnull(a.Sex,'') Sex,  		
  		isnull(a.Province,'') Province, isnull(a.City,'') as City,  		
  		a.PhotoUrl, b.VIPType, c.Department,
  		case a.RegistType when 1 then '直接注册' when 2 then '会员分享' when 3 then '扫描门店二维码' 
  		when 4 then '扫描导购二维码' when 5 then '其他注册' when 6 then '微信会员卡注册' when 7 then '导入' 
  		when 8 then '手工添加' else '其他注册' end as RegistType,CONVERT(varchar(10),a.EnrollmentDate, 121) AS EnrollmentDate,a.Attention,case when DATEDIFF(mi,a.InteractionTime,GETDATE()) &lt; 2880 then 1 else 0 end as Interaction 
	FROM  VIP AS a left JOIN
	VIPType AS b ON a.VIPTypeID = b.VIPTypeID left JOIN
	Department AS c ON a.DepartmentID = c.DepartmentID
    <if test="conditions != null and conditions != ''">
		${conditions}
	</if>
		where a.VIPID <![CDATA[<>]]>'-111'
	 	order by a.BeginDate desc,a.VIPID desc
  </select>
  
  
  <!-- 后台通过会员分组统计会员列表导出 -->
	<select id="outputGroupViplist" parameterType="java.util.HashMap" resultType="java.util.LinkedHashMap"> 
	  	SELECT isnull(a.VIPID,'') as VIPID , a.Code,isnull(b.VIPType,'') as VIPType ,isnull(a.VIP,'') as VIP, isnull(a.Sex,'') as Sex, isnull(a.BirthDay,'') as BirthDay, isnull(a.Province,'') as Province, isnull(a.City,'') as City, isnull(a.LineNickname,'') as LineNickname,isnull(a.BelongGuide,'') as BelongGuide,isnull(f.Name,'') as EmployeeName , 
	  		isnull(a.MobilePhone,'') as MobilePhone,isnull(a.EMail,'') as EMail, isnull(a.UsablePoint,'') as UsablePoint, isnull(a.UsableDepositAmount,'') as UsableDepositAmount, isnull(c.Department,'') as Department, isnull(CONVERT(varchar(10),a.BeginDate, 121),'') as BeginDate,
	  		dbo.getVipLabels(a.VIPID, 1) AS viplabel, dbo.getVipLabels(a.VIPID, 2) AS goodslabel, 
	  		dbo.getVipLabels(a.VIPID, 3) AS grouplabel,a.ClothingSize, a.ShoesSize, e.Height, e.Weight, 
	  		e.Bust,e.Waistline, e.Hips, e.Shoulder, e.UpArmsize, e.Legsize, e.BottomBust, e.FootLen, 
	  		e.FootWidth,e.FootCycle, case when a.wxId<![CDATA[<>]]>'' then '是' else '否' end as rigirstion,
	  		case when a.Attention=1 then '是' else '否' end as Attention
	  		,case a.RegistType when 1 then '直接注册' when 2 then '会员分享' when 3 then '扫描门店二维码' 
  			when 4 then '扫描导购二维码' when 5 then '其他注册' when 6 then '微信会员卡注册' when 7 then '导入' 
  			when 8 then '手工添加' else '其他注册' end as RegistType,
  		isnull(CONVERT(varchar(10),a.EnrollmentDate, 121),'') AS EnrollmentDate
		FROM  VIP AS a INNER JOIN
		VIPType AS b ON a.VIPTypeID = b.VIPTypeID
		 LEFT OUTER JOIN Employee as f on f.EmployeeID=a.BelongGuide
		 LEFT OUTER JOIN
		Department c ON a.DepartmentID = c.DepartmentID LEFT OUTER JOIN
		W_VipProp AS e ON a.VIPID = e.VIPID
		<if test="conditions != null and conditions != ''">
			${conditions}
		</if>
		where a.VIPID <![CDATA[<>]]>'-111'
	 	order by a.BeginDate desc,a.VIPID desc
  </select>
</mapper>