<?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.WReportsourceMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WReportsource">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    <id column="PosSalesID" jdbcType="VARCHAR" property="possalesid" />
    <id column="GoodsID" jdbcType="VARCHAR" property="goodsid" />
    <result column="Code" jdbcType="VARCHAR" property="code" />
    <result column="GoodName" jdbcType="NVARCHAR" property="goodname" />
    <result column="Created" jdbcType="TIMESTAMP" property="created" />
    <result column="OrderNo" jdbcType="VARCHAR" property="orderno" />
    <result column="SaleQty" jdbcType="INTEGER" property="saleqty" />
    <result column="ReturnQty" jdbcType="INTEGER" property="returnqty" />
    <result column="TotalSale" jdbcType="DECIMAL" property="totalsale" />
    <result column="TotalReturn" jdbcType="DECIMAL" property="totalreturn" />
    <result column="AllotSales" jdbcType="DECIMAL" property="allotsales" />
    <result column="VIPID" jdbcType="VARCHAR" property="vipid" />
    <result column="VipName" jdbcType="VARCHAR" property="vipname" />
    <result column="OwnerDeptID" jdbcType="VARCHAR" property="ownerdeptid" />
    <result column="OwnerDeptName" jdbcType="VARCHAR" property="ownerdeptname" />
    <result column="Employee" jdbcType="VARCHAR" property="employee" />
    <result column="EmplName" jdbcType="VARCHAR" property="emplname" />
    <result column="EmployeeRate" jdbcType="DECIMAL" property="employeerate" />
    <result column="EmployeeAmt" jdbcType="DECIMAL" property="employeeamt" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 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 Wed Aug 24 12:43:44 CST 2016.
    -->
    PosSalesID, GoodsID, Code, GoodName, Created, OrderNo, SaleQty, ReturnQty, TotalSale, 
    TotalReturn, AllotSales, VIPID, VipName, OwnerDeptID, OwnerDeptName, Employee, EmplName, 
    EmployeeRate, EmployeeAmt
  </sql>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.WReportsourceExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_ReportSource
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WReportsourceKey" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_ReportSource
    where PosSalesID = #{possalesid,jdbcType=VARCHAR}
      and GoodsID = #{goodsid,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WReportsourceKey">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    delete from W_ReportSource
    where PosSalesID = #{possalesid,jdbcType=VARCHAR}
      and GoodsID = #{goodsid,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WReportsource">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    insert into W_ReportSource (PosSalesID, GoodsID, Code, 
      GoodName, Created, OrderNo, 
      SaleQty, ReturnQty, TotalSale, 
      TotalReturn, AllotSales, VIPID, 
      VipName, OwnerDeptID, OwnerDeptName, 
      Employee, EmplName, EmployeeRate, 
      EmployeeAmt)
    values (#{possalesid,jdbcType=VARCHAR}, #{goodsid,jdbcType=VARCHAR}, #{code,jdbcType=VARCHAR}, 
      #{goodname,jdbcType=NVARCHAR}, #{created,jdbcType=TIMESTAMP}, #{orderno,jdbcType=VARCHAR}, 
      #{saleqty,jdbcType=INTEGER}, #{returnqty,jdbcType=INTEGER}, #{totalsale,jdbcType=DECIMAL}, 
      #{totalreturn,jdbcType=DECIMAL}, #{allotsales,jdbcType=DECIMAL}, #{vipid,jdbcType=VARCHAR}, 
      #{vipname,jdbcType=VARCHAR}, #{ownerdeptid,jdbcType=VARCHAR}, #{ownerdeptname,jdbcType=VARCHAR}, 
      #{employee,jdbcType=VARCHAR}, #{emplname,jdbcType=VARCHAR}, #{employeerate,jdbcType=DECIMAL}, 
      #{employeeamt,jdbcType=DECIMAL})
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WReportsource">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    insert into W_ReportSource
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="possalesid != null">
        PosSalesID,
      </if>
      <if test="goodsid != null">
        GoodsID,
      </if>
      <if test="code != null">
        Code,
      </if>
      <if test="goodname != null">
        GoodName,
      </if>
      <if test="created != null">
        Created,
      </if>
      <if test="orderno != null">
        OrderNo,
      </if>
      <if test="saleqty != null">
        SaleQty,
      </if>
      <if test="returnqty != null">
        ReturnQty,
      </if>
      <if test="totalsale != null">
        TotalSale,
      </if>
      <if test="totalreturn != null">
        TotalReturn,
      </if>
      <if test="allotsales != null">
        AllotSales,
      </if>
      <if test="vipid != null">
        VIPID,
      </if>
      <if test="vipname != null">
        VipName,
      </if>
      <if test="ownerdeptid != null">
        OwnerDeptID,
      </if>
      <if test="ownerdeptname != null">
        OwnerDeptName,
      </if>
      <if test="employee != null">
        Employee,
      </if>
      <if test="emplname != null">
        EmplName,
      </if>
      <if test="employeerate != null">
        EmployeeRate,
      </if>
      <if test="employeeamt != null">
        EmployeeAmt,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="possalesid != null">
        #{possalesid,jdbcType=VARCHAR},
      </if>
      <if test="goodsid != null">
        #{goodsid,jdbcType=VARCHAR},
      </if>
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="goodname != null">
        #{goodname,jdbcType=NVARCHAR},
      </if>
      <if test="created != null">
        #{created,jdbcType=TIMESTAMP},
      </if>
      <if test="orderno != null">
        #{orderno,jdbcType=VARCHAR},
      </if>
      <if test="saleqty != null">
        #{saleqty,jdbcType=INTEGER},
      </if>
      <if test="returnqty != null">
        #{returnqty,jdbcType=INTEGER},
      </if>
      <if test="totalsale != null">
        #{totalsale,jdbcType=DECIMAL},
      </if>
      <if test="totalreturn != null">
        #{totalreturn,jdbcType=DECIMAL},
      </if>
      <if test="allotsales != null">
        #{allotsales,jdbcType=DECIMAL},
      </if>
      <if test="vipid != null">
        #{vipid,jdbcType=VARCHAR},
      </if>
      <if test="vipname != null">
        #{vipname,jdbcType=VARCHAR},
      </if>
      <if test="ownerdeptid != null">
        #{ownerdeptid,jdbcType=VARCHAR},
      </if>
      <if test="ownerdeptname != null">
        #{ownerdeptname,jdbcType=VARCHAR},
      </if>
      <if test="employee != null">
        #{employee,jdbcType=VARCHAR},
      </if>
      <if test="emplname != null">
        #{emplname,jdbcType=VARCHAR},
      </if>
      <if test="employeerate != null">
        #{employeerate,jdbcType=DECIMAL},
      </if>
      <if test="employeeamt != null">
        #{employeeamt,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WReportsourceExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    select count(*) from W_ReportSource
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WReportsource">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    update W_ReportSource
    <set>
      <if test="code != null">
        Code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="goodname != null">
        GoodName = #{goodname,jdbcType=NVARCHAR},
      </if>
      <if test="created != null">
        Created = #{created,jdbcType=TIMESTAMP},
      </if>
      <if test="orderno != null">
        OrderNo = #{orderno,jdbcType=VARCHAR},
      </if>
      <if test="saleqty != null">
        SaleQty = #{saleqty,jdbcType=INTEGER},
      </if>
      <if test="returnqty != null">
        ReturnQty = #{returnqty,jdbcType=INTEGER},
      </if>
      <if test="totalsale != null">
        TotalSale = #{totalsale,jdbcType=DECIMAL},
      </if>
      <if test="totalreturn != null">
        TotalReturn = #{totalreturn,jdbcType=DECIMAL},
      </if>
      <if test="allotsales != null">
        AllotSales = #{allotsales,jdbcType=DECIMAL},
      </if>
      <if test="vipid != null">
        VIPID = #{vipid,jdbcType=VARCHAR},
      </if>
      <if test="vipname != null">
        VipName = #{vipname,jdbcType=VARCHAR},
      </if>
      <if test="ownerdeptid != null">
        OwnerDeptID = #{ownerdeptid,jdbcType=VARCHAR},
      </if>
      <if test="ownerdeptname != null">
        OwnerDeptName = #{ownerdeptname,jdbcType=VARCHAR},
      </if>
      <if test="employee != null">
        Employee = #{employee,jdbcType=VARCHAR},
      </if>
      <if test="emplname != null">
        EmplName = #{emplname,jdbcType=VARCHAR},
      </if>
      <if test="employeerate != null">
        EmployeeRate = #{employeerate,jdbcType=DECIMAL},
      </if>
      <if test="employeeamt != null">
        EmployeeAmt = #{employeeamt,jdbcType=DECIMAL},
      </if>
    </set>
    where PosSalesID = #{possalesid,jdbcType=VARCHAR}
      and GoodsID = #{goodsid,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WReportsource">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Aug 24 12:43:44 CST 2016.
    -->
    update W_ReportSource
    set Code = #{code,jdbcType=VARCHAR},
      GoodName = #{goodname,jdbcType=NVARCHAR},
      Created = #{created,jdbcType=TIMESTAMP},
      OrderNo = #{orderno,jdbcType=VARCHAR},
      SaleQty = #{saleqty,jdbcType=INTEGER},
      ReturnQty = #{returnqty,jdbcType=INTEGER},
      TotalSale = #{totalsale,jdbcType=DECIMAL},
      TotalReturn = #{totalreturn,jdbcType=DECIMAL},
      AllotSales = #{allotsales,jdbcType=DECIMAL},
      VIPID = #{vipid,jdbcType=VARCHAR},
      VipName = #{vipname,jdbcType=VARCHAR},
      OwnerDeptID = #{ownerdeptid,jdbcType=VARCHAR},
      OwnerDeptName = #{ownerdeptname,jdbcType=VARCHAR},
      Employee = #{employee,jdbcType=VARCHAR},
      EmplName = #{emplname,jdbcType=VARCHAR},
      EmployeeRate = #{employeerate,jdbcType=DECIMAL},
      EmployeeAmt = #{employeeamt,jdbcType=DECIMAL}
    where PosSalesID = #{possalesid,jdbcType=VARCHAR}
      and GoodsID = #{goodsid,jdbcType=VARCHAR}
  </update>

	<select id="loadingData" resultType="java.util.LinkedHashMap">
		${ sql }
	</select>
</mapper>