<?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="im.zhaojun.system.mapper.SysLogMapper">

    <resultMap id="BaseResultMap" type="im.zhaojun.system.model.SysLog">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="username" jdbcType="VARCHAR" property="username"/>
        <result column="operation" jdbcType="VARCHAR" property="operation"/>
        <result column="time" jdbcType="INTEGER" property="time"/>
        <result column="method" jdbcType="VARCHAR" property="method"/>
        <result column="params" jdbcType="VARCHAR" property="params"/>
        <result column="ip" jdbcType="VARCHAR" property="ip"/>
        <result column="create_time" jdbcType="VARCHAR" property="createTime"/>
    </resultMap>

    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        id, username, `operation`, `time`, `method`, params, ip, create_time
    </sql>

    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        select
        <include refid="Base_Column_List"/>
        from sys_log
        where id = #{id,jdbcType=INTEGER}
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        delete from sys_log
        where id = #{id,jdbcType=INTEGER}
    </delete>

    <insert id="insert"  parameterType="im.zhaojun.system.model.SysLog">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        insert into sys_log (username, `operation`, `time`,
        `method`, params, ip,
        create_time)
        values (#{username,jdbcType=VARCHAR}, #{operation,jdbcType=VARCHAR}, #{time,jdbcType=INTEGER},
        #{method,jdbcType=VARCHAR}, #{params,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR},
        #{createTime,jdbcType=VARCHAR})
    </insert>

    <update id="updateByPrimaryKey" parameterType="im.zhaojun.system.model.SysLog">
        <!--
          WARNING - @mbg.generated
          This element is automatically generated by MyBatis Generator, do not modify.
        -->
        update sys_log
        set username = #{username,jdbcType=VARCHAR},
        `operation` = #{operation,jdbcType=VARCHAR},
        `time` = #{time,jdbcType=INTEGER},
        `method` = #{method,jdbcType=VARCHAR},
        params = #{params,jdbcType=VARCHAR},
        ip = #{ip,jdbcType=VARCHAR},
        create_time = #{createTime,jdbcType=VARCHAR}
        where id = #{id,jdbcType=INTEGER}
    </update>

    <select id="selectAll" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from sys_log order by create_time desc
    </select>

    <select id="count" resultType="int">
        select count(*)
        from sys_log;
    </select>

</mapper>