<?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.WLogsMapper" >
  <resultMap id="BaseResultMap" type="com.fuxi.ws.data.entity.WLogs" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 02 16:20:31 CST 2016.
    -->
    <id column="LogsID" property="logsid" jdbcType="BIGINT" />
    <result column="LogDate" property="logdate" jdbcType="TIMESTAMP" />
    <result column="LogType" property="logtype" jdbcType="TINYINT" />
    <result column="UserID" property="userid" jdbcType="INTEGER" />
    <result column="UserName" property="username" jdbcType="NVARCHAR" />
    <result column="PoperatingID" property="poperatingid" jdbcType="INTEGER" />
    <result column="Poperating" property="poperating" jdbcType="NVARCHAR" />
    <result column="OperatingID" property="operatingid" jdbcType="INTEGER" />
    <result column="Operating" property="operating" jdbcType="NVARCHAR" />
    <result column="OperContent" property="opercontent" jdbcType="NVARCHAR" />
  </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 Jun 02 16:20:31 CST 2016.
    -->
    <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 Thu Jun 02 16:20:31 CST 2016.
    -->
    LogsID, LogDate, LogType, UserID, UserName, PoperatingID, Poperating, OperatingID, 
    Operating, OperContent
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.fuxi.ws.data.entity.WLogsExample" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 02 16:20:31 CST 2016.
    -->
    select
    <if test="distinct" >
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from W_Logs
    <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="java.lang.Long" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 02 16:20:31 CST 2016.
    -->
    select 
    <include refid="Base_Column_List" />
    from W_Logs
    where LogsID = #{logsid,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 Jun 02 16:20:31 CST 2016.
    -->
    delete from W_Logs
    where LogsID = #{logsid,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.fuxi.ws.data.entity.WLogs" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 02 16:20:31 CST 2016.
    -->
    insert into W_Logs (LogDate, LogType, 
      UserID, UserName, PoperatingID, 
      Poperating, OperatingID, Operating, 
      OperContent)
    values (#{logdate,jdbcType=TIMESTAMP}, #{logtype,jdbcType=TINYINT}, 
      #{userid,jdbcType=INTEGER}, #{username,jdbcType=NVARCHAR}, #{poperatingid,jdbcType=INTEGER}, 
      #{poperating,jdbcType=NVARCHAR}, #{operatingid,jdbcType=INTEGER}, #{operating,jdbcType=NVARCHAR}, 
      #{opercontent,jdbcType=NVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.fuxi.ws.data.entity.WLogs" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 02 16:20:31 CST 2016.
    -->
    insert into W_Logs
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="logsid != null" >
        LogsID,
      </if>
      <if test="logdate != null" >
        LogDate,
      </if>
      <if test="logtype != null" >
        LogType,
      </if>
      <if test="userid != null" >
        UserID,
      </if>
      <if test="username != null" >
        UserName,
      </if>
      <if test="poperatingid != null" >
        PoperatingID,
      </if>
      <if test="poperating != null" >
        Poperating,
      </if>
      <if test="operatingid != null" >
        OperatingID,
      </if>
      <if test="operating != null" >
        Operating,
      </if>
      <if test="opercontent != null" >
        OperContent,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="logsid != null" >
        #{logsid,jdbcType=BIGINT},
      </if>
      <if test="logdate != null" >
        #{logdate,jdbcType=TIMESTAMP},
      </if>
      <if test="logtype != null" >
        #{logtype,jdbcType=TINYINT},
      </if>
      <if test="userid != null" >
        #{userid,jdbcType=INTEGER},
      </if>
      <if test="username != null" >
        #{username,jdbcType=NVARCHAR},
      </if>
      <if test="poperatingid != null" >
        #{poperatingid,jdbcType=INTEGER},
      </if>
      <if test="poperating != null" >
        #{poperating,jdbcType=NVARCHAR},
      </if>
      <if test="operatingid != null" >
        #{operatingid,jdbcType=INTEGER},
      </if>
      <if test="operating != null" >
        #{operating,jdbcType=NVARCHAR},
      </if>
      <if test="opercontent != null" >
        #{opercontent,jdbcType=NVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.fuxi.ws.data.entity.WLogsExample" resultType="java.lang.Integer" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 02 16:20:31 CST 2016.
    -->
    select count(*) from W_Logs
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByPrimaryKeySelective" parameterType="com.fuxi.ws.data.entity.WLogs" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 02 16:20:31 CST 2016.
    -->
    update W_Logs
    <set >
      <if test="logdate != null" >
        LogDate = #{logdate,jdbcType=TIMESTAMP},
      </if>
      <if test="logtype != null" >
        LogType = #{logtype,jdbcType=TINYINT},
      </if>
      <if test="userid != null" >
        UserID = #{userid,jdbcType=INTEGER},
      </if>
      <if test="username != null" >
        UserName = #{username,jdbcType=NVARCHAR},
      </if>
      <if test="poperatingid != null" >
        PoperatingID = #{poperatingid,jdbcType=INTEGER},
      </if>
      <if test="poperating != null" >
        Poperating = #{poperating,jdbcType=NVARCHAR},
      </if>
      <if test="operatingid != null" >
        OperatingID = #{operatingid,jdbcType=INTEGER},
      </if>
      <if test="operating != null" >
        Operating = #{operating,jdbcType=NVARCHAR},
      </if>
      <if test="opercontent != null" >
        OperContent = #{opercontent,jdbcType=NVARCHAR},
      </if>
    </set>
    where LogsID = #{logsid,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fuxi.ws.data.entity.WLogs" >
    <!--
      WARNING - @mbggenerated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu Jun 02 16:20:31 CST 2016.
    -->
    update W_Logs
    set LogDate = #{logdate,jdbcType=TIMESTAMP},
      LogType = #{logtype,jdbcType=TINYINT},
      UserID = #{userid,jdbcType=INTEGER},
      UserName = #{username,jdbcType=NVARCHAR},
      PoperatingID = #{poperatingid,jdbcType=INTEGER},
      Poperating = #{poperating,jdbcType=NVARCHAR},
      OperatingID = #{operatingid,jdbcType=INTEGER},
      Operating = #{operating,jdbcType=NVARCHAR},
      OperContent = #{opercontent,jdbcType=NVARCHAR}
    where LogsID = #{logsid,jdbcType=BIGINT}
  </update>
  
    <select id="selectLogData" resultType="java.util.LinkedHashMap">
  	select CONVERT(varchar(10),a.LogDate,121) + '<![CDATA[<br/>]]>' + CONVERT(VARCHAR(10),a.LogDate,108) AS LogDate , 
		b.UserNo, a.UserName as UserName, a.Poperating, a.Operating, a.OperContent
	from W_Logs a left join W_User b
		on a.UserID = b.UserID
	<if test="conditions != null and conditions != '' ">
		where ${conditions}
	</if>
	order by a.LogDate desc
  </select>
  
</mapper>