<?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.WSupplierMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WSupplier">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 16 11:33:30 CST 2016.
    -->
    <id column="SupplierID" jdbcType="INTEGER" property="supplierid" />
    <result column="SupplierNo" jdbcType="VARCHAR" property="supplierno" />
    <result column="SupplierName" jdbcType="VARCHAR" property="suppliername" />
    <result column="ShortName" jdbcType="VARCHAR" property="shortname" />
    <result column="Province" jdbcType="VARCHAR" property="province" />
    <result column="City" jdbcType="VARCHAR" property="city" />
    <result column="County" jdbcType="VARCHAR" property="county" />
    <result column="Address" jdbcType="VARCHAR" property="address" />
    <result column="Manager" jdbcType="NVARCHAR" property="manager" />
    <result column="ManagerMobile" jdbcType="NVARCHAR" property="managermobile" />
    <result column="DepartmentID" jdbcType="VARCHAR" property="departmentid" />
    <result column="SettleType" jdbcType="TINYINT" property="settletype" />
    <result column="Discount" jdbcType="DECIMAL" property="discount" />
    <result column="StopFlag" jdbcType="TINYINT" property="stopflag" />
    <result column="Created" jdbcType="TIMESTAMP" property="created" />
    <result column="Creater" jdbcType="VARCHAR" property="creater" />
    <result column="Modified" jdbcType="TIMESTAMP" property="modified" />
    <result column="Modifier" jdbcType="VARCHAR" property="modifier" />
  </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 Nov 16 11:33:30 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 Nov 16 11:33:30 CST 2016.
    -->
    SupplierID, SupplierNo, SupplierName, ShortName, Province, City, County, Address, 
    Manager, ManagerMobile, DepartmentID, SettleType, Discount, StopFlag, Created, Creater, 
    Modified, Modifier
  </sql>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.WSupplierExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 16 11:33:30 CST 2016.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_Supplier
    <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 Wed Nov 16 11:33:30 CST 2016.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_Supplier
    where SupplierID = #{supplierid,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 Wed Nov 16 11:33:30 CST 2016.
    -->
    delete from W_Supplier
    where SupplierID = #{supplierid,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WSupplier">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 16 11:33:30 CST 2016.
    -->
    insert into W_Supplier (SupplierID, SupplierNo, SupplierName, 
      ShortName, Province, City, 
      County, Address, Manager, 
      ManagerMobile, DepartmentID, SettleType, 
      Discount, StopFlag, Created, 
      Creater, Modified, Modifier
      )
    values (#{supplierid,jdbcType=INTEGER}, #{supplierno,jdbcType=VARCHAR}, #{suppliername,jdbcType=VARCHAR}, 
      #{shortname,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, 
      #{county,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, #{manager,jdbcType=NVARCHAR}, 
      #{managermobile,jdbcType=NVARCHAR}, #{departmentid,jdbcType=VARCHAR}, #{settletype,jdbcType=TINYINT}, 
      #{discount,jdbcType=DECIMAL}, #{stopflag,jdbcType=TINYINT}, #{created,jdbcType=TIMESTAMP}, 
      #{creater,jdbcType=VARCHAR}, #{modified,jdbcType=TIMESTAMP}, #{modifier,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WSupplier">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 16 11:33:30 CST 2016.
    -->
    insert into W_Supplier
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="supplierid != null">
        SupplierID,
      </if>
      <if test="supplierno != null">
        SupplierNo,
      </if>
      <if test="suppliername != null">
        SupplierName,
      </if>
      <if test="shortname != null">
        ShortName,
      </if>
      <if test="province != null">
        Province,
      </if>
      <if test="city != null">
        City,
      </if>
      <if test="county != null">
        County,
      </if>
      <if test="address != null">
        Address,
      </if>
      <if test="manager != null">
        Manager,
      </if>
      <if test="managermobile != null">
        ManagerMobile,
      </if>
      <if test="departmentid != null">
        DepartmentID,
      </if>
      <if test="settletype != null">
        SettleType,
      </if>
      <if test="discount != null">
        Discount,
      </if>
      <if test="stopflag != null">
        StopFlag,
      </if>
      <if test="created != null">
        Created,
      </if>
      <if test="creater != null">
        Creater,
      </if>
      <if test="modified != null">
        Modified,
      </if>
      <if test="modifier != null">
        Modifier,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="supplierid != null">
        #{supplierid,jdbcType=INTEGER},
      </if>
      <if test="supplierno != null">
        #{supplierno,jdbcType=VARCHAR},
      </if>
      <if test="suppliername != null">
        #{suppliername,jdbcType=VARCHAR},
      </if>
      <if test="shortname != null">
        #{shortname,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="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="manager != null">
        #{manager,jdbcType=NVARCHAR},
      </if>
      <if test="managermobile != null">
        #{managermobile,jdbcType=NVARCHAR},
      </if>
      <if test="departmentid != null">
        #{departmentid,jdbcType=VARCHAR},
      </if>
      <if test="settletype != null">
        #{settletype,jdbcType=TINYINT},
      </if>
      <if test="discount != null">
        #{discount,jdbcType=DECIMAL},
      </if>
      <if test="stopflag != null">
        #{stopflag,jdbcType=TINYINT},
      </if>
      <if test="created != null">
        #{created,jdbcType=TIMESTAMP},
      </if>
      <if test="creater != null">
        #{creater,jdbcType=VARCHAR},
      </if>
      <if test="modified != null">
        #{modified,jdbcType=TIMESTAMP},
      </if>
      <if test="modifier != null">
        #{modifier,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WSupplierExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 16 11:33:30 CST 2016.
    -->
    select count(*) from W_Supplier
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WSupplier">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 16 11:33:30 CST 2016.
    -->
    update W_Supplier
    <set>
      <if test="supplierno != null">
        SupplierNo = #{supplierno,jdbcType=VARCHAR},
      </if>
      <if test="suppliername != null">
        SupplierName = #{suppliername,jdbcType=VARCHAR},
      </if>
      <if test="shortname != null">
        ShortName = #{shortname,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="address != null">
        Address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="manager != null">
        Manager = #{manager,jdbcType=NVARCHAR},
      </if>
      <if test="managermobile != null">
        ManagerMobile = #{managermobile,jdbcType=NVARCHAR},
      </if>
      <if test="departmentid != null">
        DepartmentID = #{departmentid,jdbcType=VARCHAR},
      </if>
      <if test="settletype != null">
        SettleType = #{settletype,jdbcType=TINYINT},
      </if>
      <if test="discount != null">
        Discount = #{discount,jdbcType=DECIMAL},
      </if>
      <if test="stopflag != null">
        StopFlag = #{stopflag,jdbcType=TINYINT},
      </if>
      <if test="created != null">
        Created = #{created,jdbcType=TIMESTAMP},
      </if>
      <if test="creater != null">
        Creater = #{creater,jdbcType=VARCHAR},
      </if>
      <if test="modified != null">
        Modified = #{modified,jdbcType=TIMESTAMP},
      </if>
      <if test="modifier != null">
        Modifier = #{modifier,jdbcType=VARCHAR},
      </if>
    </set>
    where SupplierID = #{supplierid,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WSupplier">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Wed Nov 16 11:33:30 CST 2016.
    -->
    update W_Supplier
    set SupplierNo = #{supplierno,jdbcType=VARCHAR},
      SupplierName = #{suppliername,jdbcType=VARCHAR},
      ShortName = #{shortname,jdbcType=VARCHAR},
      Province = #{province,jdbcType=VARCHAR},
      City = #{city,jdbcType=VARCHAR},
      County = #{county,jdbcType=VARCHAR},
      Address = #{address,jdbcType=VARCHAR},
      Manager = #{manager,jdbcType=NVARCHAR},
      ManagerMobile = #{managermobile,jdbcType=NVARCHAR},
      DepartmentID = #{departmentid,jdbcType=VARCHAR},
      SettleType = #{settletype,jdbcType=TINYINT},
      Discount = #{discount,jdbcType=DECIMAL},
      StopFlag = #{stopflag,jdbcType=TINYINT},
      Created = #{created,jdbcType=TIMESTAMP},
      Creater = #{creater,jdbcType=VARCHAR},
      Modified = #{modified,jdbcType=TIMESTAMP},
      Modifier = #{modifier,jdbcType=VARCHAR}
    where SupplierID = #{supplierid,jdbcType=INTEGER}
  </update>
  
  <!-- 供应商列表  -->
  <select id="supplierlist" resultType="java.util.LinkedHashMap">
		select a.*,b.Department 
		from W_Supplier as a (nolock) 
		inner join Department as b (nolock) on a.DepartmentID=b.DepartmentID 
		<if test="conditions != null and conditions != ''">
			where
			${conditions}
		</if>
		order by a.SupplierNo,a.SupplierName,a.ShortName
	</select>
	
	<!-- 供应商列表  -->
  <select id="getsupplier" resultType="java.util.LinkedHashMap">
		select SupplierID,a.ShortName,SupplierName,SettleType
		from W_Supplier as a (nolock) 
		where a.StopFlag=0		
		order by a.ShortName
	</select>
	
	<!-- 供应商编号  -->
  <select id="selectSupNo" resultType="java.util.LinkedHashMap">
		select SupplierID,SupplierNo,SupplierName
		from W_Supplier as a (nolock) 
	</select>
	
	<select id="account" resultType="java.util.LinkedHashMap">
		${paramSQL}
	</select>
	
	<select id="accountOutput" resultType="java.util.LinkedHashMap">
		${paramSQL}
	</select>
</mapper>