<?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.WRoleMapper">
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WRole">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Dec 08 11:03:20 CST 2016.
    -->
    <id column="RoleID" jdbcType="INTEGER" property="roleid" />
    <result column="RoleName" jdbcType="NVARCHAR" property="rolename" />
    <result column="Memo" jdbcType="NVARCHAR" property="memo" />
    <result column="RoleType" jdbcType="TINYINT" property="roletype" />
  </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 Dec 08 11:03:20 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 Thu Dec 08 11:03:20 CST 2016.
    -->
    RoleID, RoleName, Memo, RoleType
  </sql>
  <select id="selectByExample" parameterType="com.fuxi.ws.data.entity.WRoleExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Dec 08 11:03:20 CST 2016.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_Role
    <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 Thu Dec 08 11:03:20 CST 2016.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_Role
    where RoleID = #{roleid,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 Thu Dec 08 11:03:20 CST 2016.
    -->
    delete from W_Role
    where RoleID = #{roleid,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WRole">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Dec 08 11:03:20 CST 2016.
    -->
    insert into W_Role (RoleID, RoleName, Memo, 
      RoleType)
    values (#{roleid,jdbcType=INTEGER}, #{rolename,jdbcType=NVARCHAR}, #{memo,jdbcType=NVARCHAR}, 
      #{roletype,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WRole">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Dec 08 11:03:20 CST 2016.
    -->
    insert into W_Role
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="roleid != null">
        RoleID,
      </if>
      <if test="rolename != null">
        RoleName,
      </if>
      <if test="memo != null">
        Memo,
      </if>
      <if test="roletype != null">
        RoleType,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="roleid != null">
        #{roleid,jdbcType=INTEGER},
      </if>
      <if test="rolename != null">
        #{rolename,jdbcType=NVARCHAR},
      </if>
      <if test="memo != null">
        #{memo,jdbcType=NVARCHAR},
      </if>
      <if test="roletype != null">
        #{roletype,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WRoleExample" resultType="java.lang.Integer">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Dec 08 11:03:20 CST 2016.
    -->
    select count(*) from W_Role
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WRole">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Dec 08 11:03:20 CST 2016.
    -->
    update W_Role
    <set>
      <if test="rolename != null">
        RoleName = #{rolename,jdbcType=NVARCHAR},
      </if>
      <if test="memo != null">
        Memo = #{memo,jdbcType=NVARCHAR},
      </if>
      <if test="roletype != null">
        RoleType = #{roletype,jdbcType=TINYINT},
      </if>
    </set>
    where RoleID = #{roleid,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WRole">
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Dec 08 11:03:20 CST 2016.
    -->
    update W_Role
    set RoleName = #{rolename,jdbcType=NVARCHAR},
      Memo = #{memo,jdbcType=NVARCHAR},
      RoleType = #{roletype,jdbcType=TINYINT}
    where RoleID = #{roleid,jdbcType=INTEGER}
  </update>
</mapper>