| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?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.ssm.mapper.system.SysLogMapper" >
- <resultMap id="BaseResultMap" type="com.ssm.model.system.SysLog" >
- <id column="ID" property="id" jdbcType="INTEGER" />
- <result column="UserID" property="userId" jdbcType="INTEGER" />
- <result column="CreatedDate" property="createdDate" jdbcType="TIMESTAMP" />
- <result column="Origin" property="origin" jdbcType="VARCHAR" />
- <result column="LogLevel" property="logLevel" jdbcType="VARCHAR" />
- <result column="LogMessage" property="logMessage" jdbcType="VARCHAR" />
- <result column="StackTrace" property="stackTrace" jdbcType="VARCHAR" />
- <result column="cd" property="cd" jdbcType="VARCHAR" />
- <result column="UserName" property="username" jdbcType="VARCHAR" />
- <result column="startDate" property="startDate" jdbcType="TIMESTAMP" />
- <result column="endDate" property="endDate" jdbcType="TIMESTAMP" />
- <result column="Params" property="params" jdbcType="VARCHAR" />
- <result column="IpAddress" property="ipAddress" jdbcType="VARCHAR" />
- </resultMap>
-
- <insert id="insert" parameterType="com.ssm.model.system.SysLog" >
- insert into SysLog (
- UserID, CreatedDate, Origin, LogLevel, LogMessage, StackTrace, Params, IpAddress)
- values (
- #{userId,jdbcType=INTEGER}, #{createdDate,jdbcType=TIMESTAMP}, #{origin,jdbcType=VARCHAR},
- #{logLevel,jdbcType=VARCHAR}, #{logMessage,jdbcType=VARCHAR}, #{stackTrace,jdbcType=VARCHAR},
- #{params, jdbcType=VARCHAR}, #{ipAddress, jdbcType=VARCHAR})
- </insert>
- <sql id="Base_Column_List">
- ID, Origin, LogLevel, LogMessage, StackTrace,UserName
- </sql>
- <select id="selectlog" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List" />
-
- ,date_format(CreatedDate, '%Y-%m-%d %H:%i:%s') as cd from SysLog LEFT JOIN SysUser on SysLog.UserID=SysUser.UserID
- where 1 = 1
- <if test="username != null and username != '' ">
- and SysUser.UserName like '%${username}%'
- </if>
- <if test="origin != null and origin != '' ">
- and SysLog.origin like '%${origin}%'
- </if>
-
- <if test="startDate != null and startDate != '' ">
- <![CDATA[ and SysLog.CreatedDate >= #{startDate} ]]>
- </if>
-
- <if test="endDate != null and endDate != '' ">
- <![CDATA[ and SysLog.CreatedDate <= #{endDate} ]]>
- </if>
- ORDER BY SysLog.CreatedDate Desc
- </select>
-
- <select id="selectById" resultMap="BaseResultMap">
- select SysLog.*, SysUser.UserName from SysLog LEFT JOIN SysUser on SysLog.UserID=SysUser.UserID
- where SysLog.ID = #{id}
- </select>
-
- </mapper>
|