正在显示
5 个修改的文件
包含
40 行增加
和
21 行删除
| @@ -159,4 +159,11 @@ public interface UserMessageBindingMapper { | @@ -159,4 +159,11 @@ public interface UserMessageBindingMapper { | ||
| 159 | */ | 159 | */ | 
| 160 | List<UserMessageBinding> validateXmlBinding(XmlData xmlData); | 160 | List<UserMessageBinding> validateXmlBinding(XmlData xmlData); | 
| 161 | 161 | ||
| 162 | + /** | ||
| 163 | + * 进行校验该MQ上的绑定关系,是否存在 | ||
| 164 | + * | ||
| 165 | + * @param userMessageBinding {@link UserMessageBinding} | ||
| 166 | + * @return 配置关系,集合 | ||
| 167 | + */ | ||
| 168 | + List<UserMessageBinding> validateRabbitBinding(UserMessageBinding userMessageBinding); | ||
| 162 | } | 169 | } | 
| @@ -66,7 +66,9 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -66,7 +66,9 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 66 | for (int i = 0; i < split.length; i++) { | 66 | for (int i = 0; i < split.length; i++) { | 
| 67 | UserMessageBinding userMessageBinding = selectByPrimaryKey(split[i]); | 67 | UserMessageBinding userMessageBinding = selectByPrimaryKey(split[i]); | 
| 68 | int num = userMessageBindingMapper.deleteByPrimaryKey(split[i]); | 68 | int num = userMessageBindingMapper.deleteByPrimaryKey(split[i]); | 
| 69 | + if (validateRabbitBinding(userMessageBinding).size() == 0) { | ||
| 69 | deleteBinding(userMessageBinding); | 70 | deleteBinding(userMessageBinding); | 
| 71 | + } | ||
| 70 | if (num > 0) { | 72 | if (num > 0) { | 
| 71 | index = index + num; | 73 | index = index + num; | 
| 72 | } | 74 | } | 
| @@ -83,12 +85,25 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -83,12 +85,25 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 83 | } else { | 85 | } else { | 
| 84 | UserMessageBinding userMessageBinding = selectByPrimaryKey(id); | 86 | UserMessageBinding userMessageBinding = selectByPrimaryKey(id); | 
| 85 | int num = userMessageBindingMapper.deleteByPrimaryKey(id); | 87 | int num = userMessageBindingMapper.deleteByPrimaryKey(id); | 
| 88 | + if (validateRabbitBinding(userMessageBinding).size() == 0) { | ||
| 86 | deleteBinding(userMessageBinding); | 89 | deleteBinding(userMessageBinding); | 
| 90 | + } | ||
| 87 | return num; | 91 | return num; | 
| 88 | } | 92 | } | 
| 89 | } | 93 | } | 
| 90 | 94 | ||
| 91 | /** | 95 | /** | 
| 96 | + * 进行校验该MQ上的绑定关系,是否存在 | ||
| 97 | + * | ||
| 98 | + * @param userMessageBinding {@link UserMessageBinding} | ||
| 99 | + * @return 配置关系,集合 | ||
| 100 | + */ | ||
| 101 | + public List<UserMessageBinding> validateRabbitBinding(UserMessageBinding userMessageBinding) | ||
| 102 | + { | ||
| 103 | + return userMessageBindingMapper.validateRabbitBinding(userMessageBinding); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + /** | ||
| 92 | * 解除MQ服务器上的绑定关系 | 107 | * 解除MQ服务器上的绑定关系 | 
| 93 | */ | 108 | */ | 
| 94 | public void deleteBinding(UserMessageBinding userMessageBinding) throws IOException, TimeoutException | 109 | public void deleteBinding(UserMessageBinding userMessageBinding) throws IOException, TimeoutException | 
| @@ -364,9 +364,9 @@ | @@ -364,9 +364,9 @@ | ||
| 364 | from user_message_binding | 364 | from user_message_binding | 
| 365 | <where> | 365 | <where> | 
| 366 | <!-- 所属用户id --> | 366 | <!-- 所属用户id --> | 
| 367 | -<!-- <if test="userId != null and userId != ''">--> | ||
| 368 | -<!-- user_id = #{userId,jdbcType=VARCHAR}--> | ||
| 369 | -<!-- </if>--> | 367 | + <!-- <if test="userId != null and userId != ''">--> | 
| 368 | + <!-- user_id = #{userId,jdbcType=VARCHAR}--> | ||
| 369 | + <!-- </if>--> | ||
| 370 | <if test="username != null and username != ''"> | 370 | <if test="username != null and username != ''"> | 
| 371 | AND username = #{username,jdbcType=VARCHAR} | 371 | AND username = #{username,jdbcType=VARCHAR} | 
| 372 | </if> | 372 | </if> | 
| @@ -399,8 +399,8 @@ | @@ -399,8 +399,8 @@ | ||
| 399 | from user_message_binding | 399 | from user_message_binding | 
| 400 | <where> | 400 | <where> | 
| 401 | <!-- 所属用户id --> | 401 | <!-- 所属用户id --> | 
| 402 | - <if test="userId != null and userId != ''"> | ||
| 403 | - user_id = #{userId,jdbcType=VARCHAR} | 402 | + <if test="username != null and username != ''"> | 
| 403 | + username = #{username,jdbcType=VARCHAR} | ||
| 404 | </if> | 404 | </if> | 
| 405 | <!-- 所属服务器id --> | 405 | <!-- 所属服务器id --> | 
| 406 | <if test="serverId != null and serverId != ''"> | 406 | <if test="serverId != null and serverId != ''"> | 
| @@ -449,4 +449,16 @@ | @@ -449,4 +449,16 @@ | ||
| 449 | </if> | 449 | </if> | 
| 450 | </where> | 450 | </where> | 
| 451 | </select> | 451 | </select> | 
| 452 | + | ||
| 453 | + <select id="validateRabbitBinding" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding" | ||
| 454 | + resultMap="BaseResultMap"> | ||
| 455 | + select | ||
| 456 | + <include refid="Base_Column_List"/> | ||
| 457 | + from user_message_binding | ||
| 458 | + <where> | ||
| 459 | + queue_name = #{queueName,jdbcType=VARCHAR} | ||
| 460 | + AND exchange_name = #{exchangeName,jdbcType=VARCHAR} | ||
| 461 | + AND routing_key_name = #{routingKeyName,jdbcType=VARCHAR} | ||
| 462 | + </where> | ||
| 463 | + </select> | ||
| 452 | </mapper> | 464 | </mapper> | 
xml/test.xml
已删除
100644 → 0
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | -<MSG> | ||
| 3 | - <META> | ||
| 4 | - <SNDR>zicheng</SNDR> | ||
| 5 | - <RCVR></RCVR> | ||
| 6 | - <DDTM>2020728151024</DDTM> | ||
| 7 | - <TYPE>E_zicheng</TYPE> | ||
| 8 | - <STYP>R_zicheng</STYP> | ||
| 9 | - <SEQN>12345</SEQN> | ||
| 10 | - <TOKN>token</TOKN> | ||
| 11 | - <VSHT>V_zicheng</VSHT> | ||
| 12 | - <SERV>S_server</SERV> | ||
| 13 | - </META> | ||
| 14 | - <BODY>测试一下,发送xml,进行解析</BODY> | ||
| 15 | -</MSG><!-- 根标签,结束 --> | 
- 
请 注册 或 登录 后发表评论
