UserOperateLogMapper.xml
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?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.monitor.mysql.mapper.UserOperateLogMapper" >
<resultMap id="BaseResultMap" type="com.model.UserOperateLog" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="user_name" property="userName" jdbcType="VARCHAR" />
<result column="operate" property="operate" jdbcType="VARCHAR" />
<result column="operate_desc" property="operateDesc" jdbcType="VARCHAR" />
<result column="params" property="params" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, user_name, operate,operate_desc,params,create_time
</sql>
<select id="selectCount" resultType="java.lang.Integer">
select
count(1)
from user_operate_logs
where 1=1
<if test="params.beginTime !=null && params.beginTime !=''">
and create_time >= #{params.beginTime,jdbcType=TIMESTAMP}
</if>
<if test="params.endTime !=null && params.endTime !=''">
and create_time <= #{params.endTime,jdbcType=TIMESTAMP}
</if>
</select>
<select id="selectByPage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from user_operate_logs
where 1=1
<if test="params.beginTime !=null && params.beginTime !=''">
and create_time >= #{params.beginTime,jdbcType=TIMESTAMP}
</if>
<if test="params.endTime !=null && params.endTime !=''">
and create_time <= #{params.endTime,jdbcType=TIMESTAMP}
</if>
order by id desc
limit #{startIndex},#{pageSize}
</select>
<insert id="insert" parameterType="com.model.UserOperateLog" >
insert into user_operate_logs
(user_name, operate,operate_desc,params,create_time)
values
(#{userName,jdbcType=VARCHAR},#{operate,jdbcType=VARCHAR},#{operateDesc,jdbcType=VARCHAR},
#{params,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP})
</insert>
</mapper>