PolicyMapper.xml
6.79 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
180
181
<?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.common.mapper.PolicyMapper">
<resultMap id="BaseResultMap" type="cn.runsa.crmapp.common.entity.Policy">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="PLC_ID" jdbcType="BIGINT" property="plcId" />
<result column="TPL_ID" jdbcType="VARCHAR" property="tplId" />
<result column="REC_TIME" jdbcType="TIMESTAMP" property="recTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.runsa.crmapp.common.entity.Policy">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<result column="PLC_DESC" jdbcType="LONGVARCHAR" property="plcDesc" />
<result column="PLC_FRONT_DATA" jdbcType="LONGVARCHAR" property="plcFrontData" />
<result column="PLC_INNER_DATA" jdbcType="LONGVARCHAR" property="plcInnerData" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
`PLC_ID`, `TPL_ID`, `REC_TIME`
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
`PLC_DESC`, `PLC_FRONT_DATA`, `PLC_INNER_DATA`
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from crm_policy
where `PLC_ID` = #{plcId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from crm_policy
where `PLC_ID` = #{plcId,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="cn.runsa.crmapp.common.entity.Policy">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="plcId" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into crm_policy (`PLC_ID`, `TPL_ID`, `REC_TIME`,
`PLC_DESC`, `PLC_FRONT_DATA`, `PLC_INNER_DATA`
)
values (#{plcId,jdbcType=BIGINT}, #{tplId,jdbcType=VARCHAR}, #{recTime,jdbcType=TIMESTAMP},
#{plcDesc,jdbcType=LONGVARCHAR}, #{plcFrontData,jdbcType=LONGVARCHAR}, #{plcInnerData,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="cn.runsa.crmapp.common.entity.Policy">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="plcId" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into crm_policy
<trim prefix="(" suffix=")" suffixOverrides=",">
`PLC_ID`,
<if test="tplId != null">
`TPL_ID`,
</if>
<if test="recTime != null">
`REC_TIME`,
</if>
<if test="plcDesc != null">
`PLC_DESC`,
</if>
<if test="plcFrontData != null">
`PLC_FRONT_DATA`,
</if>
<if test="plcInnerData != null">
`PLC_INNER_DATA`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{plcId,jdbcType=BIGINT},
<if test="tplId != null">
#{tplId,jdbcType=VARCHAR},
</if>
<if test="recTime != null">
#{recTime,jdbcType=TIMESTAMP},
</if>
<if test="plcDesc != null">
#{plcDesc,jdbcType=LONGVARCHAR},
</if>
<if test="plcFrontData != null">
#{plcFrontData,jdbcType=LONGVARCHAR},
</if>
<if test="plcInnerData != null">
#{plcInnerData,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.runsa.crmapp.common.entity.Policy">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update crm_policy
<set>
<if test="tplId != null">
`TPL_ID` = #{tplId,jdbcType=VARCHAR},
</if>
<if test="recTime != null">
`REC_TIME` = #{recTime,jdbcType=TIMESTAMP},
</if>
<if test="plcDesc != null">
`PLC_DESC` = #{plcDesc,jdbcType=LONGVARCHAR},
</if>
<if test="plcFrontData != null">
`PLC_FRONT_DATA` = #{plcFrontData,jdbcType=LONGVARCHAR},
</if>
<if test="plcInnerData != null">
`PLC_INNER_DATA` = #{plcInnerData,jdbcType=LONGVARCHAR},
</if>
</set>
where `PLC_ID` = #{plcId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.runsa.crmapp.common.entity.Policy">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update crm_policy
set `TPL_ID` = #{tplId,jdbcType=VARCHAR},
`REC_TIME` = #{recTime,jdbcType=TIMESTAMP},
`PLC_DESC` = #{plcDesc,jdbcType=LONGVARCHAR},
`PLC_FRONT_DATA` = #{plcFrontData,jdbcType=LONGVARCHAR},
`PLC_INNER_DATA` = #{plcInnerData,jdbcType=LONGVARCHAR}
where `PLC_ID` = #{plcId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="cn.runsa.crmapp.common.entity.Policy">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update crm_policy
set `TPL_ID` = #{tplId,jdbcType=VARCHAR},
`REC_TIME` = #{recTime,jdbcType=TIMESTAMP}
where `PLC_ID` = #{plcId,jdbcType=BIGINT}
</update>
<select id="selectPolicyExecution" parameterType="java.lang.Long" resultType="cn.runsa.crmapp.common.entity.support.PolicyExecutionData">
SELECT p.`PLC_ID` AS plcId,p.`PLC_INNER_DATA` AS plcInnerData,t.`EXE_TYPE` AS exeType,t.`EXE_NAME` AS exeName,t.`EXECUTER` AS executer
FROM crm_policy p
INNER JOIN crm_template t
ON p.`TPL_ID` = t.`TPL_ID`
AND p.`PLC_ID` = #{id};
</select>
<select id="selectPolicyByRank" resultType="cn.runsa.crmapp.common.entity.Policy">
SELECT
t3.PLC_ID as plcId,t3.TPL_ID as tplId,t3.PLC_FRONT_DATA as plcFrontData
FROM crm_customer_rank t1 LEFT JOIN crm_rank_policy_change t2
on t1.ACT_ID = t2.ACT_ID and t1.RAK_ID = t2.RANK_FROM
LEFT JOIN crm_policy t3
on t2.PLC_ID = t3.PLC_ID
where t1.ACT_ID = #{actId,jdbcType=BIGINT} and RAK_ID = #{rakId,jdbcType=VARCHAR};
</select>
</mapper>