<?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.WPaymentsdeptMapper" >
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WPaymentsdept" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    <id column="PromotionsID" property="promotionsid" jdbcType="INTEGER" />
    <id column="DepartmentID" property="departmentid" jdbcType="VARCHAR" />
    <result column="Created" property="created" jdbcType="TIMESTAMP" />
  </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 Oct 17 19:25:30 CST 2017.
    -->
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" 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 Oct 17 19:25:30 CST 2017.
    -->
    PromotionsID, DepartmentID, Created
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.fuxi.ws.data.entity.WPaymentsdeptExample" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    select
    <if test="distinct" >
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_PaymentsDept
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="com.fuxi.ws.data.entity.WPaymentsdeptKey" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_PaymentsDept
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
      and DepartmentID = #{departmentid,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WPaymentsdeptKey" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    delete from W_PaymentsDept
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
      and DepartmentID = #{departmentid,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WPaymentsdept" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    insert into W_PaymentsDept (PromotionsID, DepartmentID, Created
      )
    values (#{promotionsid,jdbcType=INTEGER}, #{departmentid,jdbcType=VARCHAR}, #{created,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WPaymentsdept" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    insert into W_PaymentsDept
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="promotionsid != null" >
        PromotionsID,
      </if>
      <if test="departmentid != null" >
        DepartmentID,
      </if>
      <if test="created != null" >
        Created,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="promotionsid != null" >
        #{promotionsid,jdbcType=INTEGER},
      </if>
      <if test="departmentid != null" >
        #{departmentid,jdbcType=VARCHAR},
      </if>
      <if test="created != null" >
        #{created,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WPaymentsdeptExample" resultType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    select count(*) from W_PaymentsDept
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WPaymentsdept" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    update W_PaymentsDept
    <set >
      <if test="created != null" >
        Created = #{created,jdbcType=TIMESTAMP},
      </if>
    </set>
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
      and DepartmentID = #{departmentid,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WPaymentsdept" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 17 19:25:30 CST 2017.
    -->
    update W_PaymentsDept
    set Created = #{created,jdbcType=TIMESTAMP}
    where PromotionsID = #{promotionsid,jdbcType=INTEGER}
      and DepartmentID = #{departmentid,jdbcType=VARCHAR}
  </update>
    <select id="wPaymentsshopslist" resultType="java.util.LinkedHashMap">
		select a.PromotionsID,a.DepartmentID,b.Code,b.Department
		from W_PaymentsDept as a (nolock) 
		inner join Department as b (nolock) on a.DepartmentID=b.DepartmentID
		where a.PromotionsID=#{promotionsid,jdbcType=INTEGER} 
	</select>
</mapper>