UserEventDao.xml
4.53 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?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.diligrp.assistant.logging.dao.UserEventDao">
<resultMap id="UserEventMap" type="com.diligrp.assistant.logging.model.UserEventDo">
<id column="id" property="id"/>
<result column="group_id" property="groupId"/>
<result column="module_id" property="moduleId"/>
<result column="action" property="action"/>
<result column="object_id" property="objectId"/>
<result column="object_name" property="objectName"/>
<result column="event" property="event"/>
<result column="when" property="when"/>
<result column="user_id" property="userId"/>
<result column="user_name" property="userName"/>
<result column="source" property="source"/>
<result column="created_time" property="createdTime"/>
</resultMap>
<insert id="insertUserEvent" parameterType="com.diligrp.assistant.sms.model.SmsTemplateDo">
INSERT INTO logging_user_event
(`group_id`, `module_id`, `action`, `object_id`, `object_name`, `event`, `when`, `user_id`, `user_name`, `source`, `created_time`)
VALUES
(#{groupId}, #{moduleId}, #{action}, #{objectId}, #{objectName}, #{event}, #{when}, #{userId}, #{userName}, #{source}, #{createdTime})
</insert>
<insert id="insertUserEvents">
INSERT INTO logging_user_event
(`group_id`, `module_id`, `action`, `object_id`, `object_name`, `event`, `when`, `user_id`, `user_name`, `source`, `created_time`)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.groupId}, #{item.moduleId}, #{item.action}, #{item.objectId}, #{item.objectName}, #{item.event}, #{item.when}, #{item.userId}, #{item.userName}, #{item.source}, #{item.createdTime})
</foreach>
</insert>
<select id="countUserEvents" parameterType="com.diligrp.assistant.logging.domain.EventPageQuery" resultType="long">
SELECT
COUNT(*)
FROM
logging_user_event
<where>
<if test="groupId != null">
AND `group_id` = #{groupId}
</if>
<if test="moduleId != null">
AND `module_id` = #{moduleId}
</if>
<if test="action != null">
AND `action` = #{action}
</if>
<if test="objectId != null">
AND `object_id` = #{objectId}
</if>
<if test="objectName != null">
AND `object_name` = #{objectName}
</if>
<if test="userId != null">
AND `user_id` = #{userId}
</if>
<if test="userName != null">
AND `user_name` = #{userName}
</if>
<if test="source != null">
AND `source` = #{source}
</if>
<if test="startTime != null">
<![CDATA[AND `when` >= #{startTime}]]>
</if>
<if test="endTime != null">
<![CDATA[AND `when` <= #{endTime}]]>
</if>
</where>
</select>
<select id="listUserEvents" parameterType="com.diligrp.assistant.logging.domain.EventPageQuery" resultMap="UserEventMap">
SELECT
*
FROM
logging_user_event
<where>
<if test="groupId != null">
AND `group_id` = #{groupId}
</if>
<if test="moduleId != null">
AND `module_id` = #{moduleId}
</if>
<if test="action != null">
AND `action` = #{action}
</if>
<if test="objectId != null">
AND `object_id` = #{objectId}
</if>
<if test="objectName != null">
AND `object_name` = #{objectName}
</if>
<if test="userId != null">
AND `user_id` = #{userId}
</if>
<if test="userName != null">
AND `user_name` = #{userName}
</if>
<if test="source != null">
AND `source` = #{source}
</if>
<if test="startTime != null">
<![CDATA[AND `when` >= #{startTime}]]>
</if>
<if test="endTime != null">
<![CDATA[AND `when` <= #{endTime}]]>
</if>
</where>
ORDER BY id DESC
LIMIT #{start}, #{limit}
</select>
</mapper>