<?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.VipconsigneeMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.Vipconsignee">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    <id column="VIPConsigneeID" jdbcType="INTEGER" property="vipconsigneeid" />
    <result column="VipID" jdbcType="VARCHAR" property="vipid" />
    <result column="Name" jdbcType="VARCHAR" property="name" />
    <result column="Provinces" jdbcType="VARCHAR" property="provinces" />
    <result column="City" jdbcType="VARCHAR" property="city" />
    <result column="County" jdbcType="VARCHAR" property="county" />
    <result column="Addr" jdbcType="VARCHAR" property="addr" />
    <result column="Phone" jdbcType="VARCHAR" property="phone" />
    <result column="Mobile" jdbcType="VARCHAR" property="mobile" />
    <result column="AllotFlag" jdbcType="BIT" property="allotflag" />
    <result column="ZipCode" jdbcType="VARCHAR" property="zipcode" />
    <result column="IDCardNo" jdbcType="VARCHAR" property="idcardno" />
    <result column="IDCardFace" jdbcType="VARCHAR" property="idcardface" />
    <result column="IDCardBack" jdbcType="VARCHAR" property="idcardback" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    <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 Tue May 17 14:38:58 CST 2016.
    -->
    VIPConsigneeID, VipID, Name, Provinces, City, County, Addr, Phone, Mobile, AllotFlag, 
    ZipCode, IDCardNo, IDCardFace, IDCardBack
  </sql>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.VipconsigneeExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from VIPConsignee
    <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.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    select 
    <include refid="Base_Column_List" />
    from VIPConsignee
    where VIPConsigneeID = #{vipconsigneeid,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    delete from VIPConsignee
    where VIPConsigneeID = #{vipconsigneeid,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.Vipconsignee">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    insert into VIPConsignee (VIPConsigneeID, VipID, Name, 
      Provinces, City, County, 
      Addr, Phone, Mobile, 
      AllotFlag, ZipCode, IDCardNo, 
      IDCardFace, IDCardBack)
    values (#{vipconsigneeid,jdbcType=INTEGER}, #{vipid,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{provinces,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{county,jdbcType=VARCHAR}, 
      #{addr,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, 
      #{allotflag,jdbcType=BIT}, #{zipcode,jdbcType=VARCHAR}, #{idcardno,jdbcType=VARCHAR}, 
      #{idcardface,jdbcType=VARCHAR}, #{idcardback,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.Vipconsignee">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    insert into VIPConsignee
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="vipconsigneeid != null">
        VIPConsigneeID,
      </if>
      <if test="vipid != null">
        VipID,
      </if>
      <if test="name != null">
        Name,
      </if>
      <if test="provinces != null">
        Provinces,
      </if>
      <if test="city != null">
        City,
      </if>
      <if test="county != null">
        County,
      </if>
      <if test="addr != null">
        Addr,
      </if>
      <if test="phone != null">
        Phone,
      </if>
      <if test="mobile != null">
        Mobile,
      </if>
      <if test="allotflag != null">
        AllotFlag,
      </if>
      <if test="zipcode != null">
        ZipCode,
      </if>
      <if test="idcardno != null">
        IDCardNo,
      </if>
      <if test="idcardface != null">
        IDCardFace,
      </if>
      <if test="idcardback != null">
        IDCardBack,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="vipconsigneeid != null">
        #{vipconsigneeid,jdbcType=INTEGER},
      </if>
      <if test="vipid != null">
        #{vipid,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="provinces != null">
        #{provinces,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        #{city,jdbcType=VARCHAR},
      </if>
      <if test="county != null">
        #{county,jdbcType=VARCHAR},
      </if>
      <if test="addr != null">
        #{addr,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="allotflag != null">
        #{allotflag,jdbcType=BIT},
      </if>
      <if test="zipcode != null">
        #{zipcode,jdbcType=VARCHAR},
      </if>
      <if test="idcardno != null">
        #{idcardno,jdbcType=VARCHAR},
      </if>
      <if test="idcardface != null">
        #{idcardface,jdbcType=VARCHAR},
      </if>
      <if test="idcardback != null">
        #{idcardback,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.VipconsigneeExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    select count(*) from VIPConsignee
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.Vipconsignee">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    update VIPConsignee
    <set>
      <if test="vipid != null">
        VipID = #{vipid,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        Name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="provinces != null">
        Provinces = #{provinces,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        City = #{city,jdbcType=VARCHAR},
      </if>
      <if test="county != null">
        County = #{county,jdbcType=VARCHAR},
      </if>
      <if test="addr != null">
        Addr = #{addr,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        Phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        Mobile = #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="allotflag != null">
        AllotFlag = #{allotflag,jdbcType=BIT},
      </if>
      <if test="zipcode != null">
        ZipCode = #{zipcode,jdbcType=VARCHAR},
      </if>
      <if test="idcardno != null">
        IDCardNo = #{idcardno,jdbcType=VARCHAR},
      </if>
      <if test="idcardface != null">
        IDCardFace = #{idcardface,jdbcType=VARCHAR},
      </if>
      <if test="idcardback != null">
        IDCardBack = #{idcardback,jdbcType=VARCHAR},
      </if>
    </set>
    where VIPConsigneeID = #{vipconsigneeid,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.Vipconsignee">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue May 17 14:38:58 CST 2016.
    -->
    update VIPConsignee
    set VipID = #{vipid,jdbcType=VARCHAR},
      Name = #{name,jdbcType=VARCHAR},
      Provinces = #{provinces,jdbcType=VARCHAR},
      City = #{city,jdbcType=VARCHAR},
      County = #{county,jdbcType=VARCHAR},
      Addr = #{addr,jdbcType=VARCHAR},
      Phone = #{phone,jdbcType=VARCHAR},
      Mobile = #{mobile,jdbcType=VARCHAR},
      AllotFlag = #{allotflag,jdbcType=BIT},
      ZipCode = #{zipcode,jdbcType=VARCHAR},
      IDCardNo = #{idcardno,jdbcType=VARCHAR},
      IDCardFace = #{idcardface,jdbcType=VARCHAR},
      IDCardBack = #{idcardback,jdbcType=VARCHAR}
    where VIPConsigneeID = #{vipconsigneeid,jdbcType=INTEGER}
  </update>

	<update id="updateByVipID" parameterType="com.fuxi.ws.data.entity.Vipconsignee">
		update VIPConsignee
		set
		AllotFlag = #{allotflag,jdbcType=BIT}
		where VipID =
		#{vipid,jdbcType=VARCHAR}
	</update>

	<select id="getAddress" resultType="java.util.LinkedHashMap">
		select a.*,b.Fee from
		VIPConsignee a
		left join W_Shipment b on a.Provinces=b.name
		where
		a.VipID=#{ vipid }
	</select>
</mapper>