<?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.WRepairMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WRepair">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    <id column="RepairID" jdbcType="BIGINT" property="repairid" />
    <result column="RepairNo" jdbcType="VARCHAR" property="repairno" />
    <result column="Vipid" jdbcType="VARCHAR" property="vipid" />
    <result column="EShopOrderID" jdbcType="INTEGER" property="eshoporderid" />
    <result column="EShopOrderNo" jdbcType="VARCHAR" property="eshoporderno" />
    <result column="Reason" jdbcType="NVARCHAR" property="reason" />
    <result column="Fee" jdbcType="DECIMAL" property="fee" />
    <result column="DepartmentID" jdbcType="VARCHAR" property="departmentid" />
    <result column="Province" jdbcType="VARCHAR" property="province" />
    <result column="City" jdbcType="VARCHAR" property="city" />
    <result column="District" jdbcType="VARCHAR" property="district" />
    <result column="Address" jdbcType="VARCHAR" property="address" />
    <result column="CarrierMen" jdbcType="VARCHAR" property="carriermen" />
    <result column="MobilePhone" jdbcType="VARCHAR" property="mobilephone" />
    <result column="PostName" jdbcType="VARCHAR" property="postname" />
    <result column="PostNo" jdbcType="VARCHAR" property="postno" />
    <result column="PostTime" jdbcType="TIMESTAMP" property="posttime" />
    <result column="PaymentType" jdbcType="VARCHAR" property="paymenttype" />
    <result column="Payed" jdbcType="DECIMAL" property="payed" />
    <result column="DepositAmount" jdbcType="DECIMAL" property="depositamount" />
    <result column="ExchangedPoint" jdbcType="DECIMAL" property="exchangedpoint" />
    <result column="ThisSalesPoint" jdbcType="DECIMAL" property="thissalespoint" />
    <result column="PayNo" jdbcType="VARCHAR" property="payno" />
    <result column="UseAmount" jdbcType="BIT" property="useamount" />
    <result column="UsePoint" jdbcType="BIT" property="usepoint" />
    <result column="Province1" jdbcType="VARCHAR" property="province1" />
    <result column="City1" jdbcType="VARCHAR" property="city1" />
    <result column="District1" jdbcType="VARCHAR" property="district1" />
    <result column="Address1" jdbcType="VARCHAR" property="address1" />
    <result column="CarrierMen1" jdbcType="VARCHAR" property="carriermen1" />
    <result column="MobilePhone1" jdbcType="VARCHAR" property="mobilephone1" />
    <result column="PostName1" jdbcType="VARCHAR" property="postname1" />
    <result column="PostNo1" jdbcType="VARCHAR" property="postno1" />
    <result column="Postfee" jdbcType="DECIMAL" property="postfee" />
    <result column="SendTime" jdbcType="TIMESTAMP" property="sendtime" />
    <result column="SendPerson" jdbcType="VARCHAR" property="sendperson" />
    <result column="Created" jdbcType="TIMESTAMP" property="created" />
    <result column="Confirmer" jdbcType="VARCHAR" property="confirmer" />
    <result column="Confirmed" jdbcType="TIMESTAMP" property="confirmed" />
    <result column="ConcelTime" jdbcType="TIMESTAMP" property="conceltime" />
    <result column="PriceTime" jdbcType="TIMESTAMP" property="pricetime" />
    <result column="PricePerson" jdbcType="VARCHAR" property="priceperson" />
    <result column="PayTime" jdbcType="TIMESTAMP" property="paytime" />
    <result column="ReceiveTime" jdbcType="TIMESTAMP" property="receivetime" />
    <result column="Status" jdbcType="TINYINT" property="status" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    <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 Thu Aug 13 16:48:07 CST 2015.
    -->
    RepairID, RepairNo, Vipid, EShopOrderID, EShopOrderNo, Reason, Fee, DepartmentID, 
    Province, City, District, Address, CarrierMen, MobilePhone, PostName, PostNo, PostTime, 
    PaymentType, Payed, DepositAmount, ExchangedPoint, ThisSalesPoint, PayNo, UseAmount, 
    UsePoint, Province1, City1, District1, Address1, CarrierMen1, MobilePhone1, PostName1, 
    PostNo1, Postfee, SendTime, SendPerson, Created, Confirmer, Confirmed, ConcelTime, 
    PriceTime, PricePerson, PayTime, ReceiveTime, Status
  </sql>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.WRepairExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_Repair
    <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.Long" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_Repair
    where RepairID = #{repairid,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    delete from W_Repair
    where RepairID = #{repairid,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WRepair">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    insert into W_Repair (RepairID, RepairNo, Vipid, 
      EShopOrderID, EShopOrderNo, Reason, 
      Fee, DepartmentID, Province, 
      City, District, Address, 
      CarrierMen, MobilePhone, PostName, 
      PostNo, PostTime, PaymentType, 
      Payed, DepositAmount, ExchangedPoint, 
      ThisSalesPoint, PayNo, UseAmount, 
      UsePoint, Province1, City1, 
      District1, Address1, CarrierMen1, 
      MobilePhone1, PostName1, PostNo1, 
      Postfee, SendTime, SendPerson, 
      Created, Confirmer, Confirmed, 
      ConcelTime, PriceTime, PricePerson, 
      PayTime, ReceiveTime, Status
      )
    values (#{repairid,jdbcType=BIGINT}, #{repairno,jdbcType=VARCHAR}, #{vipid,jdbcType=VARCHAR}, 
      #{eshoporderid,jdbcType=INTEGER}, #{eshoporderno,jdbcType=VARCHAR}, #{reason,jdbcType=NVARCHAR}, 
      #{fee,jdbcType=DECIMAL}, #{departmentid,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, 
      #{city,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, 
      #{carriermen,jdbcType=VARCHAR}, #{mobilephone,jdbcType=VARCHAR}, #{postname,jdbcType=VARCHAR}, 
      #{postno,jdbcType=VARCHAR}, #{posttime,jdbcType=TIMESTAMP}, #{paymenttype,jdbcType=VARCHAR}, 
      #{payed,jdbcType=DECIMAL}, #{depositamount,jdbcType=DECIMAL}, #{exchangedpoint,jdbcType=DECIMAL}, 
      #{thissalespoint,jdbcType=DECIMAL}, #{payno,jdbcType=VARCHAR}, #{useamount,jdbcType=BIT}, 
      #{usepoint,jdbcType=BIT}, #{province1,jdbcType=VARCHAR}, #{city1,jdbcType=VARCHAR}, 
      #{district1,jdbcType=VARCHAR}, #{address1,jdbcType=VARCHAR}, #{carriermen1,jdbcType=VARCHAR}, 
      #{mobilephone1,jdbcType=VARCHAR}, #{postname1,jdbcType=VARCHAR}, #{postno1,jdbcType=VARCHAR}, 
      #{postfee,jdbcType=DECIMAL}, #{sendtime,jdbcType=TIMESTAMP}, #{sendperson,jdbcType=VARCHAR}, 
      #{created,jdbcType=TIMESTAMP}, #{confirmer,jdbcType=VARCHAR}, #{confirmed,jdbcType=TIMESTAMP}, 
      #{conceltime,jdbcType=TIMESTAMP}, #{pricetime,jdbcType=TIMESTAMP}, #{priceperson,jdbcType=VARCHAR}, 
      #{paytime,jdbcType=TIMESTAMP}, #{receivetime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WRepair">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    insert into W_Repair
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="repairid != null">
        RepairID,
      </if>
      <if test="repairno != null">
        RepairNo,
      </if>
      <if test="vipid != null">
        Vipid,
      </if>
      <if test="eshoporderid != null">
        EShopOrderID,
      </if>
      <if test="eshoporderno != null">
        EShopOrderNo,
      </if>
      <if test="reason != null">
        Reason,
      </if>
      <if test="fee != null">
        Fee,
      </if>
      <if test="departmentid != null">
        DepartmentID,
      </if>
      <if test="province != null">
        Province,
      </if>
      <if test="city != null">
        City,
      </if>
      <if test="district != null">
        District,
      </if>
      <if test="address != null">
        Address,
      </if>
      <if test="carriermen != null">
        CarrierMen,
      </if>
      <if test="mobilephone != null">
        MobilePhone,
      </if>
      <if test="postname != null">
        PostName,
      </if>
      <if test="postno != null">
        PostNo,
      </if>
      <if test="posttime != null">
        PostTime,
      </if>
      <if test="paymenttype != null">
        PaymentType,
      </if>
      <if test="payed != null">
        Payed,
      </if>
      <if test="depositamount != null">
        DepositAmount,
      </if>
      <if test="exchangedpoint != null">
        ExchangedPoint,
      </if>
      <if test="thissalespoint != null">
        ThisSalesPoint,
      </if>
      <if test="payno != null">
        PayNo,
      </if>
      <if test="useamount != null">
        UseAmount,
      </if>
      <if test="usepoint != null">
        UsePoint,
      </if>
      <if test="province1 != null">
        Province1,
      </if>
      <if test="city1 != null">
        City1,
      </if>
      <if test="district1 != null">
        District1,
      </if>
      <if test="address1 != null">
        Address1,
      </if>
      <if test="carriermen1 != null">
        CarrierMen1,
      </if>
      <if test="mobilephone1 != null">
        MobilePhone1,
      </if>
      <if test="postname1 != null">
        PostName1,
      </if>
      <if test="postno1 != null">
        PostNo1,
      </if>
      <if test="postfee != null">
        Postfee,
      </if>
      <if test="sendtime != null">
        SendTime,
      </if>
      <if test="sendperson != null">
        SendPerson,
      </if>
      <if test="created != null">
        Created,
      </if>
      <if test="confirmer != null">
        Confirmer,
      </if>
      <if test="confirmed != null">
        Confirmed,
      </if>
      <if test="conceltime != null">
        ConcelTime,
      </if>
      <if test="pricetime != null">
        PriceTime,
      </if>
      <if test="priceperson != null">
        PricePerson,
      </if>
      <if test="paytime != null">
        PayTime,
      </if>
      <if test="receivetime != null">
        ReceiveTime,
      </if>
      <if test="status != null">
        Status,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="repairid != null">
        #{repairid,jdbcType=BIGINT},
      </if>
      <if test="repairno != null">
        #{repairno,jdbcType=VARCHAR},
      </if>
      <if test="vipid != null">
        #{vipid,jdbcType=VARCHAR},
      </if>
      <if test="eshoporderid != null">
        #{eshoporderid,jdbcType=INTEGER},
      </if>
      <if test="eshoporderno != null">
        #{eshoporderno,jdbcType=VARCHAR},
      </if>
      <if test="reason != null">
        #{reason,jdbcType=NVARCHAR},
      </if>
      <if test="fee != null">
        #{fee,jdbcType=DECIMAL},
      </if>
      <if test="departmentid != null">
        #{departmentid,jdbcType=VARCHAR},
      </if>
      <if test="province != null">
        #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        #{city,jdbcType=VARCHAR},
      </if>
      <if test="district != null">
        #{district,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="carriermen != null">
        #{carriermen,jdbcType=VARCHAR},
      </if>
      <if test="mobilephone != null">
        #{mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="postname != null">
        #{postname,jdbcType=VARCHAR},
      </if>
      <if test="postno != null">
        #{postno,jdbcType=VARCHAR},
      </if>
      <if test="posttime != null">
        #{posttime,jdbcType=TIMESTAMP},
      </if>
      <if test="paymenttype != null">
        #{paymenttype,jdbcType=VARCHAR},
      </if>
      <if test="payed != null">
        #{payed,jdbcType=DECIMAL},
      </if>
      <if test="depositamount != null">
        #{depositamount,jdbcType=DECIMAL},
      </if>
      <if test="exchangedpoint != null">
        #{exchangedpoint,jdbcType=DECIMAL},
      </if>
      <if test="thissalespoint != null">
        #{thissalespoint,jdbcType=DECIMAL},
      </if>
      <if test="payno != null">
        #{payno,jdbcType=VARCHAR},
      </if>
      <if test="useamount != null">
        #{useamount,jdbcType=BIT},
      </if>
      <if test="usepoint != null">
        #{usepoint,jdbcType=BIT},
      </if>
      <if test="province1 != null">
        #{province1,jdbcType=VARCHAR},
      </if>
      <if test="city1 != null">
        #{city1,jdbcType=VARCHAR},
      </if>
      <if test="district1 != null">
        #{district1,jdbcType=VARCHAR},
      </if>
      <if test="address1 != null">
        #{address1,jdbcType=VARCHAR},
      </if>
      <if test="carriermen1 != null">
        #{carriermen1,jdbcType=VARCHAR},
      </if>
      <if test="mobilephone1 != null">
        #{mobilephone1,jdbcType=VARCHAR},
      </if>
      <if test="postname1 != null">
        #{postname1,jdbcType=VARCHAR},
      </if>
      <if test="postno1 != null">
        #{postno1,jdbcType=VARCHAR},
      </if>
      <if test="postfee != null">
        #{postfee,jdbcType=DECIMAL},
      </if>
      <if test="sendtime != null">
        #{sendtime,jdbcType=TIMESTAMP},
      </if>
      <if test="sendperson != null">
        #{sendperson,jdbcType=VARCHAR},
      </if>
      <if test="created != null">
        #{created,jdbcType=TIMESTAMP},
      </if>
      <if test="confirmer != null">
        #{confirmer,jdbcType=VARCHAR},
      </if>
      <if test="confirmed != null">
        #{confirmed,jdbcType=TIMESTAMP},
      </if>
      <if test="conceltime != null">
        #{conceltime,jdbcType=TIMESTAMP},
      </if>
      <if test="pricetime != null">
        #{pricetime,jdbcType=TIMESTAMP},
      </if>
      <if test="priceperson != null">
        #{priceperson,jdbcType=VARCHAR},
      </if>
      <if test="paytime != null">
        #{paytime,jdbcType=TIMESTAMP},
      </if>
      <if test="receivetime != null">
        #{receivetime,jdbcType=TIMESTAMP},
      </if>
      <if test="status != null">
        #{status,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WRepairExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    select count(*) from W_Repair
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WRepair">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    update W_Repair
    <set>
      <if test="repairno != null">
        RepairNo = #{repairno,jdbcType=VARCHAR},
      </if>
      <if test="vipid != null">
        Vipid = #{vipid,jdbcType=VARCHAR},
      </if>
      <if test="eshoporderid != null">
        EShopOrderID = #{eshoporderid,jdbcType=INTEGER},
      </if>
      <if test="eshoporderno != null">
        EShopOrderNo = #{eshoporderno,jdbcType=VARCHAR},
      </if>
      <if test="reason != null">
        Reason = #{reason,jdbcType=NVARCHAR},
      </if>
      <if test="fee != null">
        Fee = #{fee,jdbcType=DECIMAL},
      </if>
      <if test="departmentid != null">
        DepartmentID = #{departmentid,jdbcType=VARCHAR},
      </if>
      <if test="province != null">
        Province = #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null">
        City = #{city,jdbcType=VARCHAR},
      </if>
      <if test="district != null">
        District = #{district,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        Address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="carriermen != null">
        CarrierMen = #{carriermen,jdbcType=VARCHAR},
      </if>
      <if test="mobilephone != null">
        MobilePhone = #{mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="postname != null">
        PostName = #{postname,jdbcType=VARCHAR},
      </if>
      <if test="postno != null">
        PostNo = #{postno,jdbcType=VARCHAR},
      </if>
      <if test="posttime != null">
        PostTime = #{posttime,jdbcType=TIMESTAMP},
      </if>
      <if test="paymenttype != null">
        PaymentType = #{paymenttype,jdbcType=VARCHAR},
      </if>
      <if test="payed != null">
        Payed = #{payed,jdbcType=DECIMAL},
      </if>
      <if test="depositamount != null">
        DepositAmount = #{depositamount,jdbcType=DECIMAL},
      </if>
      <if test="exchangedpoint != null">
        ExchangedPoint = #{exchangedpoint,jdbcType=DECIMAL},
      </if>
      <if test="thissalespoint != null">
        ThisSalesPoint = #{thissalespoint,jdbcType=DECIMAL},
      </if>
      <if test="payno != null">
        PayNo = #{payno,jdbcType=VARCHAR},
      </if>
      <if test="useamount != null">
        UseAmount = #{useamount,jdbcType=BIT},
      </if>
      <if test="usepoint != null">
        UsePoint = #{usepoint,jdbcType=BIT},
      </if>
      <if test="province1 != null">
        Province1 = #{province1,jdbcType=VARCHAR},
      </if>
      <if test="city1 != null">
        City1 = #{city1,jdbcType=VARCHAR},
      </if>
      <if test="district1 != null">
        District1 = #{district1,jdbcType=VARCHAR},
      </if>
      <if test="address1 != null">
        Address1 = #{address1,jdbcType=VARCHAR},
      </if>
      <if test="carriermen1 != null">
        CarrierMen1 = #{carriermen1,jdbcType=VARCHAR},
      </if>
      <if test="mobilephone1 != null">
        MobilePhone1 = #{mobilephone1,jdbcType=VARCHAR},
      </if>
      <if test="postname1 != null">
        PostName1 = #{postname1,jdbcType=VARCHAR},
      </if>
      <if test="postno1 != null">
        PostNo1 = #{postno1,jdbcType=VARCHAR},
      </if>
      <if test="postfee != null">
        Postfee = #{postfee,jdbcType=DECIMAL},
      </if>
      <if test="sendtime != null">
        SendTime = #{sendtime,jdbcType=TIMESTAMP},
      </if>
      <if test="sendperson != null">
        SendPerson = #{sendperson,jdbcType=VARCHAR},
      </if>
      <if test="created != null">
        Created = #{created,jdbcType=TIMESTAMP},
      </if>
      <if test="confirmer != null">
        Confirmer = #{confirmer,jdbcType=VARCHAR},
      </if>
      <if test="confirmed != null">
        Confirmed = #{confirmed,jdbcType=TIMESTAMP},
      </if>
      <if test="conceltime != null">
        ConcelTime = #{conceltime,jdbcType=TIMESTAMP},
      </if>
      <if test="pricetime != null">
        PriceTime = #{pricetime,jdbcType=TIMESTAMP},
      </if>
      <if test="priceperson != null">
        PricePerson = #{priceperson,jdbcType=VARCHAR},
      </if>
      <if test="paytime != null">
        PayTime = #{paytime,jdbcType=TIMESTAMP},
      </if>
      <if test="receivetime != null">
        ReceiveTime = #{receivetime,jdbcType=TIMESTAMP},
      </if>
      <if test="status != null">
        Status = #{status,jdbcType=TINYINT},
      </if>
    </set>
    where RepairID = #{repairid,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WRepair">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Aug 13 16:48:07 CST 2015.
    -->
    update W_Repair
    set RepairNo = #{repairno,jdbcType=VARCHAR},
      Vipid = #{vipid,jdbcType=VARCHAR},
      EShopOrderID = #{eshoporderid,jdbcType=INTEGER},
      EShopOrderNo = #{eshoporderno,jdbcType=VARCHAR},
      Reason = #{reason,jdbcType=NVARCHAR},
      Fee = #{fee,jdbcType=DECIMAL},
      DepartmentID = #{departmentid,jdbcType=VARCHAR},
      Province = #{province,jdbcType=VARCHAR},
      City = #{city,jdbcType=VARCHAR},
      District = #{district,jdbcType=VARCHAR},
      Address = #{address,jdbcType=VARCHAR},
      CarrierMen = #{carriermen,jdbcType=VARCHAR},
      MobilePhone = #{mobilephone,jdbcType=VARCHAR},
      PostName = #{postname,jdbcType=VARCHAR},
      PostNo = #{postno,jdbcType=VARCHAR},
      PostTime = #{posttime,jdbcType=TIMESTAMP},
      PaymentType = #{paymenttype,jdbcType=VARCHAR},
      Payed = #{payed,jdbcType=DECIMAL},
      DepositAmount = #{depositamount,jdbcType=DECIMAL},
      ExchangedPoint = #{exchangedpoint,jdbcType=DECIMAL},
      ThisSalesPoint = #{thissalespoint,jdbcType=DECIMAL},
      PayNo = #{payno,jdbcType=VARCHAR},
      UseAmount = #{useamount,jdbcType=BIT},
      UsePoint = #{usepoint,jdbcType=BIT},
      Province1 = #{province1,jdbcType=VARCHAR},
      City1 = #{city1,jdbcType=VARCHAR},
      District1 = #{district1,jdbcType=VARCHAR},
      Address1 = #{address1,jdbcType=VARCHAR},
      CarrierMen1 = #{carriermen1,jdbcType=VARCHAR},
      MobilePhone1 = #{mobilephone1,jdbcType=VARCHAR},
      PostName1 = #{postname1,jdbcType=VARCHAR},
      PostNo1 = #{postno1,jdbcType=VARCHAR},
      Postfee = #{postfee,jdbcType=DECIMAL},
      SendTime = #{sendtime,jdbcType=TIMESTAMP},
      SendPerson = #{sendperson,jdbcType=VARCHAR},
      Created = #{created,jdbcType=TIMESTAMP},
      Confirmer = #{confirmer,jdbcType=VARCHAR},
      Confirmed = #{confirmed,jdbcType=TIMESTAMP},
      ConcelTime = #{conceltime,jdbcType=TIMESTAMP},
      PriceTime = #{pricetime,jdbcType=TIMESTAMP},
      PricePerson = #{priceperson,jdbcType=VARCHAR},
      PayTime = #{paytime,jdbcType=TIMESTAMP},
      ReceiveTime = #{receivetime,jdbcType=TIMESTAMP},
      Status = #{status,jdbcType=TINYINT}
    where RepairID = #{repairid,jdbcType=BIGINT}
  </update>
  
  <!-- 维修单列表 -->
	<select id="repairlist" resultType="java.util.LinkedHashMap">
		select r.RepairID,r.RepairNo,r.Province,r.City,r.District,r.Address,
		CONVERT(varchar(10),r.Created, 121) + '<![CDATA[<br/>]]>' + CONVERT(varchar(10),r.Created, 108) AS CreateDate,
		isnull(v.VIP,'') + '<![CDATA[<br/>]]>' + isnull(v.MobilePhone,'') as vip,
		r.Fee,r.Reason,e.No,d.Department,isnull(r.PostName,'') + '<![CDATA[<br/>]]>' + isnull(r.PostNo,'') as post,
		case r.Status when 0 then '待审核' when 1 then '待返修' when 2 then '待定价' when 3 then '待支付' 
		when 4 then '待维修' when 5 then '待收货' when 6 then '已完成' when 7 then '已取消' when 8 then '已拒绝' 
		end as Status,r.Status as statusflag,rd.Qty
		from W_Repair as r 
		inner join (select RepairID,SUM(Quantity) as Qty from W_RepairDtl group by RepairID) as rd on r.RepairID=rd.RepairID 
		inner join VIP as v on r.Vipid=v.VIPID
		inner join EShopOrder as e on r.EShopOrderID=e.EShopOrderID 
		left join Department as d on r.DepartmentID=d.DepartmentID 
		<if test="conditions != null and conditions != ''">
			where
			${conditions}
		</if>
		order by r.Created desc
	</select>
	
	<!-- 单个维修单信息 -->
	<select id="repairinfo" resultType="java.util.LinkedHashMap">
		select r.*,CONVERT(varchar(19),r.Created, 121) as Createdate,v.VIP,v.MobilePhone as VipPhone,e.No,d.Department,
		case r.Status when 0 then '待审核' when 1 then '待返修' when 2 then '待定价' when 3 then '待支付' 
		when 4 then '待维修' when 5 then '待收货' when 6 then '已完成' when 7 then '已取消' when 8 then '已拒绝' end as repairstatus
		from W_Repair as r 
		inner join VIP as v on r.Vipid=v.VIPID
		inner join EShopOrder as e on r.EShopOrderID=e.EShopOrderID 
		left join Department as d on r.DepartmentID=d.DepartmentID 
		where
		r.RepairID=#{repairid,jdbcType=BIGINT}
	</select>
	
	<!-- 维修单商品明细 -->
	<select id="repairgoodsdtl" resultType="java.util.LinkedHashMap">
		select a.RepairID,h.Reason,
		(select top
		1 Code from W_Goods g where g.GoodsID=b.GoodsID) as Code,
		a.GoodsID,a.ColorID,a.SizeID,b.ImgPath,b.GoodName,a.Quantity,a.UnitPrice,a.Fee,b.code
		as GoodCode,c.Color,s.Size,isnull(a.Fee,0)*isnull(a.Quantity,0) as Amount
		from W_RepairDtl a
		inner join W_Goods b on a.GoodsID=b.GoodsID
		inner join Color c on c.ColorID=a.ColorID
		inner join Size s on s.SizeID=a.SizeID
		inner join W_Repair as h on a.RepairID=h.RepairID 
		where
		a.RepairID=#{repairid,jdbcType=BIGINT}
	</select>
	
	<!--维修单列表导出信息 -->
	<select id="repairOut" resultType="java.util.LinkedHashMap">
		select r.*,CONVERT(varchar(19),r.Created, 121) as Createdate,v.VIP,v.MobilePhone as VipPhone,e.No,d.Department,
		case r.Status when 0 then '待审核' when 1 then '待返修' when 2 then '待定价' when 3 then '待支付' 
		when 4 then '待维修' when 5 then '待收货' when 6 then '已完成' when 7 then '已取消' when 8 then '已拒绝' end as repairstatus
		from W_Repair as r 
		inner join VIP as v on r.Vipid=v.VIPID 
		inner join EShopOrder as e on r.EShopOrderID=e.EShopOrderID 
		left join Department as d on r.DepartmentID=d.DepartmentID 
		<if test="conditions != null and conditions != ''">
			where
			${conditions}
		</if>
		order by r.Created desc
	</select>
	
	<!--维修单明细导出信息 -->
	<select id="repairdtlOut" resultType="java.util.LinkedHashMap">
		select a.RepairID,(select top 1 Code from W_Goods g where g.GoodsID=b.GoodsID) as Code,
		a.GoodsID,b.ImgPath,b.GoodName,a.Quantity,a.UnitPrice,a.Fee,b.code as GoodCode,
		c.Color,s.Size,isnull(a.Fee,0)*isnull(a.Quantity,0) as Amount,f.RepairNo  
		from W_RepairDtl as a 
		inner join W_Repair as f on a.RepairID=f.RepairID
		inner join W_Goods as b on a.GoodsID=b.GoodsID
		inner join Color as c on c.ColorID=a.ColorID
		inner join Size as s on s.SizeID=a.SizeID
		where a.RepairID in (
		select RepairID from W_Repair as r 
		inner join VIP as v on r.Vipid=v.VIPID 
		inner join EShopOrder as e on r.EShopOrderID=e.EShopOrderID 
		left join Department as d on r.DepartmentID=d.DepartmentID 
		<if test="conditions != null and conditions != ''">
			where
			${conditions}
		</if>
		)
		order by a.RepairID desc
	</select>
</mapper>