PointsChangeMapper.xml
6.78 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?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="cn.runsa.crmapp.points.mapper.PointsChangeMapper">
<resultMap id="BaseResultMap" type="cn.runsa.crmapp.points.entity.PointsChange">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<result column="PNT_ID" jdbcType="BIGINT" property="pntId" />
<result column="TYPE" jdbcType="VARCHAR" property="type" />
<result column="PNT_VAL" jdbcType="DOUBLE" property="pntVal" />
<result column="FACT_PNT" jdbcType="DOUBLE" property="factPnt" />
<result column="CST_ID" jdbcType="BIGINT" property="cstId" />
<result column="BLC_IN" jdbcType="BIGINT" property="blcIn" />
<result column="BLC_OUT" jdbcType="BIGINT" property="blcOut" />
<result column="S_TIME" jdbcType="TIMESTAMP" property="sTime" />
<result column="E_TIME" jdbcType="TIMESTAMP" property="eTime" />
<result column="CHL_ID" jdbcType="VARCHAR" property="chlId" />
<result column="CHL_INST" jdbcType="VARCHAR" property="chlInst" />
<result column="LOCKED" jdbcType="BIT" property="locked" />
<result column="U_V" jdbcType="DECIMAL" property="uV" />
<result column="REC_TIME" jdbcType="TIMESTAMP" property="recTime" />
</resultMap>
<insert id="insert" parameterType="cn.runsa.crmapp.points.entity.PointsChange">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into crm_points_change (`PNT_ID`, `TYPE`, `PNT_VAL`,
`FACT_PNT`, `CST_ID`, `BLC_IN`,
`BLC_OUT`, `S_TIME`, `E_TIME`,
`CHL_ID`, `CHL_INST`, `LOCKED`,
`U_V`, `REC_TIME`)
values (#{pntId,jdbcType=BIGINT}, #{type,jdbcType=VARCHAR}, #{pntVal,jdbcType=DOUBLE},
#{factPnt,jdbcType=DOUBLE}, #{cstId,jdbcType=BIGINT}, #{blcIn,jdbcType=BIGINT},
#{blcOut,jdbcType=BIGINT}, #{sTime,jdbcType=TIMESTAMP}, #{eTime,jdbcType=TIMESTAMP},
#{chlId,jdbcType=VARCHAR}, #{chlInst,jdbcType=VARCHAR}, #{locked,jdbcType=BIT},
#{uV,jdbcType=DECIMAL}, #{recTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cn.runsa.crmapp.points.entity.PointsChange">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
insert into crm_points_change
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="pntId != null">
`PNT_ID`,
</if>
<if test="type != null">
`TYPE`,
</if>
<if test="pntVal != null">
`PNT_VAL`,
</if>
<if test="factPnt != null">
`FACT_PNT`,
</if>
<if test="cstId != null">
`CST_ID`,
</if>
<if test="blcIn != null">
`BLC_IN`,
</if>
<if test="blcOut != null">
`BLC_OUT`,
</if>
<if test="sTime != null">
`S_TIME`,
</if>
<if test="eTime != null">
`E_TIME`,
</if>
<if test="chlId != null">
`CHL_ID`,
</if>
<if test="chlInst != null">
`CHL_INST`,
</if>
<if test="locked != null">
`LOCKED`,
</if>
<if test="uV != null">
`U_V`,
</if>
<if test="recTime != null">
`REC_TIME`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="pntId != null">
#{pntId,jdbcType=BIGINT},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="pntVal != null">
#{pntVal,jdbcType=DOUBLE},
</if>
<if test="factPnt != null">
#{factPnt,jdbcType=DOUBLE},
</if>
<if test="cstId != null">
#{cstId,jdbcType=BIGINT},
</if>
<if test="blcIn != null">
#{blcIn,jdbcType=BIGINT},
</if>
<if test="blcOut != null">
#{blcOut,jdbcType=BIGINT},
</if>
<if test="sTime != null">
#{sTime,jdbcType=TIMESTAMP},
</if>
<if test="eTime != null">
#{eTime,jdbcType=TIMESTAMP},
</if>
<if test="chlId != null">
#{chlId,jdbcType=VARCHAR},
</if>
<if test="chlInst != null">
#{chlInst,jdbcType=VARCHAR},
</if>
<if test="locked != null">
#{locked,jdbcType=BIT},
</if>
<if test="uV != null">
#{uV,jdbcType=DECIMAL},
</if>
<if test="recTime != null">
#{recTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<insert id="insertList">
insert into crm_points_change (`PNT_ID`, `TYPE`, `PNT_VAL`, `CST_ID`, `BLC_IN`, `BLC_OUT`,`S_TIME`, `E_TIME`, `CHL_ID`, `CHL_INST`, `LOCKED`,`U_V`,`REC_TIME`)
values
<foreach collection="list" item="it" separator=",">
(#{it.pntId,jdbcType=BIGINT}, #{it.type,jdbcType=VARCHAR},
#{it.pntVal,jdbcType=DOUBLE},
#{it.cstId,jdbcType=BIGINT}, #{it.blcIn,jdbcType=BIGINT}, #{it.blcOut,jdbcType=BIGINT},
#{it.sTime,jdbcType=TIMESTAMP}, #{it.eTime,jdbcType=TIMESTAMP}, #{it.chlId,jdbcType=VARCHAR},
#{it.chlInst,jdbcType=VARCHAR}, #{it.locked,jdbcType=BIT},#{it.uV,jdbcType=DECIMAL},#{it.recTime,jdbcType=TIMESTAMP})
</foreach>
</insert>
<select id="selectChangeList" resultType="map">
SELECT a.PNT_VAL AS pntVal,a.REC_TIME AS recTime,a.E_TIME AS eTime,a.`TYPE` AS `type`,b.VAR_NAME AS `typeName`,a.`CHL_ID` AS chlId,r.`BIZ_NO` AS `bizNo`,m.`MKT_NAME` AS mktName,e.`EVT_NAME` AS evtName
FROM crm_points_change a
LEFT JOIN crm_variable b
ON (b.VAR_SCOPE='POINTS_CHANGE_TYPE' AND a.TYPE=b.VAR_CODE)
LEFT JOIN crm_points_receipt r
ON (a.`CHL_ID` = 'INTERFACE' AND a.`CHL_INST` = r.`ID`)
LEFT JOIN crm_market m
ON (a.`CHL_ID` = 'ACTIVITY' AND a.`CHL_INST` = m.`MKT_ID`)
LEFT JOIN crm_event e
ON (a.`CHL_ID` = 'EVENT' AND a.`CHL_INST` = e.`EVT_ID`)
WHERE
a.CST_ID=#{cstId}
ORDER BY a.REC_TIME desc limit #{start},#{length}
</select>
<select id="selectLockedList" resultMap="BaseResultMap" parameterType="cn.runsa.crmapp.points.entity.PointsChange">
select `PNT_ID`, `TYPE`, `PNT_VAL`, `CST_ID`, `BLC_IN`,
`BLC_OUT`, `S_TIME`, `E_TIME`,
`CHL_ID`, `CHL_INST`, `LOCKED`,
`U_V`, `REC_TIME`
from crm_points_change
where CHL_ID = #{chlId,jdbcType=VARCHAR} and CHL_INST = #{chlInst,jdbcType=VARCHAR} and LOCKED = true
</select>
<delete id="delete" parameterType="cn.runsa.crmapp.points.entity.PointsChange">
delete from crm_points_change where CHL_ID = #{chlId,jdbcType=VARCHAR} and CHL_INST = #{chlInst,jdbcType=VARCHAR} and LOCKED = true
</delete>
<update id="updateLock" parameterType="cn.runsa.crmapp.points.entity.PointsChange">
update crm_points_change set LOCKED = false where CHL_ID = #{chlId,jdbcType=VARCHAR} and CHL_INST = #{chlInst,jdbcType=VARCHAR} and LOCKED = true
</update>
</mapper>