<?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.saye.hospitalgd.mapper.system.LoggerMapper">

    <resultMap id="BaseResultMap" type="com.saye.hospitalgd.model.Logger">
        <id column="loggerId" property="loggerId" jdbcType="VARCHAR"/>
        <result column="logType" property="logType" jdbcType="VARCHAR"/>
        <result column="information" property="information" javaType="String" jdbcType="CLOB"/>
        <result column="create_time" property="create_time" jdbcType="VARCHAR"/>
        <result column="user_id" property="user_id" jdbcType="VARCHAR"/>
        <result column="ip" property="ip" jdbcType="VARCHAR"/>
    </resultMap>

    <select id="findLoggers" resultMap="BaseResultMap">
        select loggerId,logType,information,create_time,user_id,ip from logger
        <where>
            1=1
            <if test="loggerType!=null and loggerType!='' ">
                and logType=#{loggerType}
            </if>
            <if test="startTime!=null and startTime!='' ">
                and create_time&gt;=#{startTime}
            </if>
            <if test="endTime!=null and endTime!='' ">
                and create_time&lt;=#{endTime}
            </if>
        </where>
        order by create_time desc
    </select>


    <insert id="addLog" parameterType="HashMap">
        insert into logger(LOGTYPE, INFORMATION, CREATE_TIME, USER_ID, IP)
        values (#{logtype}, #{information}, #{create_time}, #{user_id}, #{ip})
    </insert>
</mapper>