BusQueueMapper.xml
10.3 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<?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.sunyo.wlpt.message.bus.service.mapper.BusQueueMapper">
<cache-ref namespace="com.sunyo.wlpt.message.bus.service.mapper.VirtualHostMapper"/>
<resultMap id="BaseResultMap" type="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
<!--@mbg.generated-->
<!--@Table bus_queue-->
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="queue_name" jdbcType="VARCHAR" property="queueName"/>
<result column="user_id" jdbcType="VARCHAR" property="userId"/>
<result column="username" jdbcType="VARCHAR" property="username"/>
<result column="virtual_host_id" jdbcType="VARCHAR" property="virtualHostId"/>
<result column="durability" jdbcType="BOOLEAN" property="durability"/>
<result column="auto_delete" jdbcType="BOOLEAN" property="autoDelete"/>
<result column="arguments" jdbcType="VARCHAR" property="arguments"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/>
</resultMap>
<!-- 该Mapper映射关系的作用,是队列与虚拟主机的1:1的关系映射 -->
<resultMap extends="BaseResultMap" id="QueueAndHostMap" type="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
<association javaType="com.sunyo.wlpt.message.bus.service.domain.VirtualHost" property="virtualHost">
<id column="id" property="id"/>
<result column="virtual_host_name" property="virtualHostName"/>
</association>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, queue_name, user_id, username, virtual_host_id, durability, auto_delete, arguments,
description, gmt_create, gmt_modified
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
<!--@mbg.generated-->
select
<include refid="Base_Column_List"/>
from bus_queue
where id = #{id,jdbcType=VARCHAR}
</select>
<select id="selectByVirtualHostId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from bus_queue
where virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
<!--@mbg.generated-->
delete
from bus_queue
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByVirtualHostId" parameterType="java.lang.String">
<!--@mbg.generated-->
delete
from bus_queue
where virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
<!--@mbg.generated-->
insert into bus_queue (id, queue_name, user_id,
username, virtual_host_id, durability,
auto_delete, arguments, description,
gmt_create, gmt_modified)
values (#{id,jdbcType=VARCHAR}, #{queueName,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
#{username,jdbcType=VARCHAR}, #{virtualHostId,jdbcType=VARCHAR}, #{durability,jdbcType=BOOLEAN},
#{autoDelete,jdbcType=BOOLEAN}, #{arguments,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
<!--@mbg.generated-->
insert into bus_queue
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="queueName != null">
queue_name,
</if>
<if test="userId != null">
user_id,
</if>
<if test="username != null">
username,
</if>
<if test="virtualHostId != null">
virtual_host_id,
</if>
<if test="durability != null">
durability,
</if>
<if test="autoDelete != null">
auto_delete,
</if>
<if test="arguments != null">
arguments,
</if>
<if test="description != null">
description,
</if>
<if test="gmtCreate != null">
gmt_create,
</if>
<if test="gmtModified != null">
gmt_modified,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="queueName != null">
#{queueName,jdbcType=VARCHAR},
</if>
<if test="userId != null">
#{userId,jdbcType=VARCHAR},
</if>
<if test="username != null">
#{username,jdbcType=VARCHAR},
</if>
<if test="virtualHostId != null">
#{virtualHostId,jdbcType=VARCHAR},
</if>
<if test="durability != null">
#{durability,jdbcType=BOOLEAN},
</if>
<if test="autoDelete != null">
#{autoDelete,jdbcType=BOOLEAN},
</if>
<if test="arguments != null">
#{arguments,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="gmtCreate != null">
#{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
#{gmtModified,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
<!--@mbg.generated-->
update bus_queue
<set>
<if test="queueName != null">
queue_name = #{queueName,jdbcType=VARCHAR},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="username != null">
username = #{username,jdbcType=VARCHAR},
</if>
<if test="virtualHostId != null">
virtual_host_id = #{virtualHostId,jdbcType=VARCHAR},
</if>
<if test="durability != null">
durability = #{durability,jdbcType=BOOLEAN},
</if>
<if test="autoDelete != null">
auto_delete = #{autoDelete,jdbcType=BOOLEAN},
</if>
<if test="arguments != null">
arguments = #{arguments,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
<if test="gmtCreate != null">
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
</if>
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
<!--@mbg.generated-->
update bus_queue
set queue_name = #{queueName,jdbcType=VARCHAR},
user_id = #{userId,jdbcType=VARCHAR},
username = #{username,jdbcType=VARCHAR},
virtual_host_id = #{virtualHostId,jdbcType=VARCHAR},
durability = #{durability,jdbcType=BOOLEAN},
auto_delete = #{autoDelete,jdbcType=BOOLEAN},
arguments = #{arguments,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=VARCHAR}
</update>
<!-- 获取消息队列,列表 -->
<select id="selectBusQueueList" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue"
resultMap="QueueAndHostMap">
select q.id,
q.queue_name,
q.virtual_host_id,
q.durability,
q.auto_delete,
q.arguments,
q.description,
q.user_id,
q.username,
q.gmt_create,
q.gmt_modified,
v.virtual_host_name
from bus_queue as q,
virtual_host v
<where>
<!-- 所属虚拟主机Id -->
<if test="virtualHostId != null and virtualHostId != ''">
virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}
</if>
<!-- 用户名称 -->
<if test="username != null and username != ''">
and username = #{username,jdbcType=VARCHAR}
</if>
<!-- 消息队列名称 -->
<if test="queueName != null and queueName != ''">
and queue_name = #{queueName,jdbcType=VARCHAR}
</if>
and v.id = q.virtual_host_id
</where>
</select>
<!-- 校验消息队列是否已存在-->
<select id="validateBusQueue" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from bus_queue
<where>
<!-- 消息队列名称 -->
<if test="queueName != null and queueName != ''">
queue_name = #{queueName,jdbcType=VARCHAR}
</if>
</where>
</select>
<!-- 仅,查询队列列表 -->
<select id="getQueueList" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from bus_queue
<where>
<!-- 所属虚拟主机Id -->
<if test="virtualHostId != null and virtualHostId != ''">
virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}
</if>
<if test="username != null and username != ''">
and username = #{username,jdbcType=VARCHAR}
</if>
</where>
</select>
<select id="selectByUsername" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from bus_queue
where username = #{username,jdbcType=VARCHAR}
</select>
</mapper>