OrderLogMapper.xml
2.31 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
<?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.b2c.orders.dao.impl.OrderLogDaoBean">
<resultMap id="OrderLogRM" type="OrderLog">
<id property="id" column="id" />
<result property="action" column="action" />
<result property="actionTime" column="action_time" />
<result property="userId" column="user_id" />
<result property="userType" column="user_type" />
<result property="orderId" column="order_id" />
<result property="description" column="description" />
</resultMap>
<sql id="selectCondition">
<if test="param != null">
<if test="param.id != null and param.id != ''">
and id = #{param.id}
</if>
<if test="param.action != null and param.action != ''">
and action = #{param.action}
</if>
<if test="param.actionBeginTime != null and param.actionBeginTime != ''">
<![CDATA[and action_time >= #{param.actionBeginTime}]]>
</if>
<if test="param.actionEndTime != null and param.actionEndTime != ''">
<![CDATA[and action_time <= #{param.actionEndTime}]]>
</if>
<if test="param.userId != null and param.userId != ''">
and user_id = #{param.userId}
</if>
<if test="param.userType != null and param.userType != ''">
and user_type = #{param.userType}
</if>
</if>
</sql>
<insert id="save" parameterType="OrderLog">
<![CDATA[
INSERT INTO t_order_log(
id,
action,
user_id,
user_type,
order_id,
description
) VALUES(
#{id},
#{action},
#{userId},
#{userType},
#{orderId},
#{description}
)
]]>
</insert>
<select id="countByCondition" parameterType="Query" resultType="Long">
<![CDATA[
SELECT count(1) FROM t_order_log where 1=1
]]>
<include refid="selectCondition" />
</select>
<select id="listByCondition" parameterType="Query" resultMap="OrderLogRM">
<![CDATA[
SELECT
id
,action
,action_time
,user_id
,user_type
,order_id
,description
FROM t_order_log where 1=1
]]>
<include refid="selectCondition" />
order by id desc
<![CDATA[
limit #{startRow},#{pageSize}
]]>
</select>
</mapper>