正在显示
6 个修改的文件
包含
158 行增加
和
159 行删除
| @@ -14,17 +14,41 @@ spring: | @@ -14,17 +14,41 @@ spring: | ||
| 14 | username: 110 | 14 | username: 110 |
| 15 | password: QAHqCJf2kFYCLirM | 15 | password: QAHqCJf2kFYCLirM |
| 16 | 16 | ||
| 17 | + # redis设置 | ||
| 18 | + redis: | ||
| 19 | + database: 0 # Redis 数据库索引(默认为 0) | ||
| 20 | + host: 192.168.37.139 # Redis 服务器地址 | ||
| 21 | + port: 6379 # Redis 服务器连接端口 | ||
| 22 | + password: 123456 # Redis 服务器连接密码(默认为空) | ||
| 23 | + lettuce: | ||
| 24 | + pool: | ||
| 25 | + max-active: 8 # 连接池最大连接数(使用负值表示没有限制) 默认 8 | ||
| 26 | + max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1 | ||
| 27 | + max-idle: 8 # 连接池中的最大空闲连接 默认 8 | ||
| 28 | + min-idle: 0 # 连接池中的最小空闲连接 默认 0 | ||
| 29 | + | ||
| 17 | # rabbitmq配置 | 30 | # rabbitmq配置 |
| 18 | rabbitmq: | 31 | rabbitmq: |
| 19 | - host: 192.168.37.137 | 32 | + host: 192.168.37.139 |
| 20 | port: 5672 | 33 | port: 5672 |
| 21 | - username: rabbit | 34 | + username: zicheng |
| 22 | password: 123456 | 35 | password: 123456 |
| 23 | virtual-host: V_zicheng | 36 | virtual-host: V_zicheng |
| 24 | -# host: 192.168.1.63 | ||
| 25 | -# port: 5672 | ||
| 26 | -# username: mrz | ||
| 27 | -# password: vmvnv1v2 | 37 | + # 开启手动ack机制 |
| 38 | + # listener: | ||
| 39 | + # simple: | ||
| 40 | + # acknowledge-mode: manual | ||
| 41 | + # # 开启 confrim 机制--保证消息发送到交换机 | ||
| 42 | + # publisher-confrim-type: simple | ||
| 43 | + # # 开启 return 机制--保证消息从交换机分发到队列 | ||
| 44 | + # publisher-returns: true | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + # host: 192.168.1.63 | ||
| 49 | + # port: 5672 | ||
| 50 | + # username: mrz | ||
| 51 | + # password: vmvnv1v2 | ||
| 28 | # 多环境配置 | 52 | # 多环境配置 |
| 29 | profiles: | 53 | profiles: |
| 30 | active: dev | 54 | active: dev |
| @@ -95,3 +119,4 @@ management: | @@ -95,3 +119,4 @@ management: | ||
| 95 | info: | 119 | info: |
| 96 | version: 1.0 | 120 | version: 1.0 |
| 97 | description: "消息平台服务" | 121 | description: "消息平台服务" |
| 122 | + |
| @@ -16,4 +16,6 @@ public class Constant { | @@ -16,4 +16,6 @@ public class Constant { | ||
| 16 | public static final String EXIST_QUEUE_INFO = "该-消息队列-信息已存在,请谨慎输入"; | 16 | public static final String EXIST_QUEUE_INFO = "该-消息队列-信息已存在,请谨慎输入"; |
| 17 | 17 | ||
| 18 | public static final String EXIST_ROUTINGKEY_INFO = "该-路由键(路由键名称)-信息已存在,请谨慎输入"; | 18 | public static final String EXIST_ROUTINGKEY_INFO = "该-路由键(路由键名称)-信息已存在,请谨慎输入"; |
| 19 | + | ||
| 20 | + public static final String EXIST_UMB = "该绑定关系已经存在了"; | ||
| 19 | } | 21 | } |
| @@ -2,9 +2,12 @@ package com.sunyo.wlpt.message.bus.service.controller; | @@ -2,9 +2,12 @@ package com.sunyo.wlpt.message.bus.service.controller; | ||
| 2 | 2 | ||
| 3 | import com.github.pagehelper.PageInfo; | 3 | import com.github.pagehelper.PageInfo; |
| 4 | import com.sunyo.wlpt.message.bus.service.domain.BusQueue; | 4 | import com.sunyo.wlpt.message.bus.service.domain.BusQueue; |
| 5 | +import com.sunyo.wlpt.message.bus.service.domain.UserInfo; | ||
| 5 | import com.sunyo.wlpt.message.bus.service.response.ResultJson; | 6 | import com.sunyo.wlpt.message.bus.service.response.ResultJson; |
| 6 | import com.sunyo.wlpt.message.bus.service.service.BusQueueService; | 7 | import com.sunyo.wlpt.message.bus.service.service.BusQueueService; |
| 8 | +import com.sunyo.wlpt.message.bus.service.service.UserInfoService; | ||
| 7 | import com.sunyo.wlpt.message.bus.service.utils.IdUtils; | 9 | import com.sunyo.wlpt.message.bus.service.utils.IdUtils; |
| 10 | +import io.netty.util.internal.StringUtil; | ||
| 8 | import org.springframework.web.bind.annotation.*; | 11 | import org.springframework.web.bind.annotation.*; |
| 9 | 12 | ||
| 10 | import javax.annotation.Resource; | 13 | import javax.annotation.Resource; |
| @@ -23,6 +26,8 @@ import static com.sunyo.wlpt.message.bus.service.common.Constant.EXIST_QUEUE_INF | @@ -23,6 +26,8 @@ import static com.sunyo.wlpt.message.bus.service.common.Constant.EXIST_QUEUE_INF | ||
| 23 | public class BusQueueController { | 26 | public class BusQueueController { |
| 24 | 27 | ||
| 25 | @Resource | 28 | @Resource |
| 29 | + private UserInfoService userInfoService; | ||
| 30 | + @Resource | ||
| 26 | private BusQueueService busQueueService; | 31 | private BusQueueService busQueueService; |
| 27 | 32 | ||
| 28 | /** | 33 | /** |
| @@ -38,10 +43,16 @@ public class BusQueueController { | @@ -38,10 +43,16 @@ public class BusQueueController { | ||
| 38 | public ResultJson<PageInfo> selectBusQueueList( | 43 | public ResultJson<PageInfo> selectBusQueueList( |
| 39 | @RequestParam(value = "queueName", required = false) String queueName, | 44 | @RequestParam(value = "queueName", required = false) String queueName, |
| 40 | @RequestParam(value = "virtualHostId", required = false) String virtualHostId, | 45 | @RequestParam(value = "virtualHostId", required = false) String virtualHostId, |
| 46 | + @RequestParam(value = "username", required = false) String username, | ||
| 41 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | 47 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, |
| 42 | - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | 48 | + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) |
| 49 | + { | ||
| 43 | // 获取查询参数 | 50 | // 获取查询参数 |
| 44 | - BusQueue busQueue = BusQueue.builder().queueName(queueName).virtualHostId(virtualHostId).build(); | 51 | + BusQueue busQueue = BusQueue.builder() |
| 52 | + .queueName(queueName) | ||
| 53 | + .virtualHostId(virtualHostId) | ||
| 54 | + .username(username) | ||
| 55 | + .build(); | ||
| 45 | // 分页查询 | 56 | // 分页查询 |
| 46 | PageInfo pageInfo = busQueueService.selectBusQueueList(busQueue, pageNum, pageSize); | 57 | PageInfo pageInfo = busQueueService.selectBusQueueList(busQueue, pageNum, pageSize); |
| 47 | return pageInfo.getTotal() > 0 | 58 | return pageInfo.getTotal() > 0 |
| @@ -56,7 +67,8 @@ public class BusQueueController { | @@ -56,7 +67,8 @@ public class BusQueueController { | ||
| 56 | * @return {@link ResultJson} | 67 | * @return {@link ResultJson} |
| 57 | */ | 68 | */ |
| 58 | @DeleteMapping("/delete") | 69 | @DeleteMapping("/delete") |
| 59 | - public ResultJson deleteBusQueue(@RequestBody BusQueue busQueue) { | 70 | + public ResultJson deleteBusQueue(@RequestBody BusQueue busQueue) |
| 71 | + { | ||
| 60 | 72 | ||
| 61 | return busQueueService.deleteByPrimaryKey(busQueue.getId()) > 0 | 73 | return busQueueService.deleteByPrimaryKey(busQueue.getId()) > 0 |
| 62 | ? new ResultJson<>("200", "删除消息队列,成功") | 74 | ? new ResultJson<>("200", "删除消息队列,成功") |
| @@ -70,7 +82,8 @@ public class BusQueueController { | @@ -70,7 +82,8 @@ public class BusQueueController { | ||
| 70 | * @return {@link ResultJson} | 82 | * @return {@link ResultJson} |
| 71 | */ | 83 | */ |
| 72 | @GetMapping("/batchRemove") | 84 | @GetMapping("/batchRemove") |
| 73 | - public ResultJson batchRemoveBusQueue(String ids) { | 85 | + public ResultJson batchRemoveBusQueue(String ids) |
| 86 | + { | ||
| 74 | 87 | ||
| 75 | return busQueueService.deleteByPrimaryKey(ids) > 0 | 88 | return busQueueService.deleteByPrimaryKey(ids) > 0 |
| 76 | ? new ResultJson<>("200", "批量删除消息队列,成功") | 89 | ? new ResultJson<>("200", "批量删除消息队列,成功") |
| @@ -84,7 +97,8 @@ public class BusQueueController { | @@ -84,7 +97,8 @@ public class BusQueueController { | ||
| 84 | * @return {@link ResultJson} | 97 | * @return {@link ResultJson} |
| 85 | */ | 98 | */ |
| 86 | @PutMapping("/update") | 99 | @PutMapping("/update") |
| 87 | - public ResultJson updateBusQueue(@RequestBody BusQueue busQueue) { | 100 | + public ResultJson updateBusQueue(@RequestBody BusQueue busQueue) |
| 101 | + { | ||
| 88 | // 先校验队列名称 | 102 | // 先校验队列名称 |
| 89 | String message = validateBusQueue(busQueue); | 103 | String message = validateBusQueue(busQueue); |
| 90 | return message == null | 104 | return message == null |
| @@ -101,7 +115,8 @@ public class BusQueueController { | @@ -101,7 +115,8 @@ public class BusQueueController { | ||
| 101 | * @return {@link ResultJson} | 115 | * @return {@link ResultJson} |
| 102 | */ | 116 | */ |
| 103 | @PostMapping("/insert") | 117 | @PostMapping("/insert") |
| 104 | - public ResultJson insertBusQueue(@RequestBody BusQueue busQueue) { | 118 | + public ResultJson insertBusQueue(@RequestBody BusQueue busQueue) |
| 119 | + { | ||
| 105 | //先验证,增加的虚拟主机的核心信息(交换机名称)是否已存在 | 120 | //先验证,增加的虚拟主机的核心信息(交换机名称)是否已存在 |
| 106 | String message = validateBusQueue(busQueue); | 121 | String message = validateBusQueue(busQueue); |
| 107 | // 设置id | 122 | // 设置id |
| @@ -120,7 +135,14 @@ public class BusQueueController { | @@ -120,7 +135,14 @@ public class BusQueueController { | ||
| 120 | * @param busQueue {@link BusQueue} | 135 | * @param busQueue {@link BusQueue} |
| 121 | * @return 通过校验,无返回消息 | 136 | * @return 通过校验,无返回消息 |
| 122 | */ | 137 | */ |
| 123 | - private String validateBusQueue(BusQueue busQueue) { | 138 | + private String validateBusQueue(BusQueue busQueue) |
| 139 | + { | ||
| 140 | + if (!StringUtil.isNullOrEmpty(busQueue.getUserId())) { | ||
| 141 | + // 根据用户id,填充用户名称;违背了单一职责原则,有时间再改 | ||
| 142 | + UserInfo userInfo = userInfoService.selectByPrimaryKey(busQueue.getUserId()); | ||
| 143 | + busQueue.setUsername(userInfo.getUsername()); | ||
| 144 | + } | ||
| 145 | + | ||
| 124 | // 判断队列名称,是否为空 | 146 | // 判断队列名称,是否为空 |
| 125 | if ("".equals(busQueue.getQueueName()) || busQueue.getQueueName() == null) { | 147 | if ("".equals(busQueue.getQueueName()) || busQueue.getQueueName() == null) { |
| 126 | return "该-消息队列-信息中,没有消息队列名称"; | 148 | return "该-消息队列-信息中,没有消息队列名称"; |
| @@ -65,4 +65,12 @@ public interface UserMessageBindingMapper { | @@ -65,4 +65,12 @@ public interface UserMessageBindingMapper { | ||
| 65 | * @return List<UserMessageBinding> | 65 | * @return List<UserMessageBinding> |
| 66 | */ | 66 | */ |
| 67 | List<UserMessageBinding> selectUserMessageBindingList(UserMessageBinding userMessageBinding); | 67 | List<UserMessageBinding> selectUserMessageBindingList(UserMessageBinding userMessageBinding); |
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 在执行填充和添加之前先校验一下是否存在? | ||
| 71 | + * | ||
| 72 | + * @param userMessageBinding {@link UserMessageBinding} | ||
| 73 | + * @return 判断校验是否通过 | ||
| 74 | + */ | ||
| 75 | + List<UserMessageBinding> validateBinding(UserMessageBinding userMessageBinding); | ||
| 68 | } | 76 | } |
| @@ -6,6 +6,7 @@ import com.sunyo.wlpt.message.bus.service.domain.*; | @@ -6,6 +6,7 @@ import com.sunyo.wlpt.message.bus.service.domain.*; | ||
| 6 | import com.sunyo.wlpt.message.bus.service.mapper.UserMessageBindingMapper; | 6 | import com.sunyo.wlpt.message.bus.service.mapper.UserMessageBindingMapper; |
| 7 | import com.sunyo.wlpt.message.bus.service.service.*; | 7 | import com.sunyo.wlpt.message.bus.service.service.*; |
| 8 | import com.sunyo.wlpt.message.bus.service.utils.IdUtils; | 8 | import com.sunyo.wlpt.message.bus.service.utils.IdUtils; |
| 9 | +import lombok.extern.slf4j.Slf4j; | ||
| 9 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| 10 | import org.springframework.transaction.annotation.Propagation; | 11 | import org.springframework.transaction.annotation.Propagation; |
| 11 | import org.springframework.transaction.annotation.Transactional; | 12 | import org.springframework.transaction.annotation.Transactional; |
| @@ -13,11 +14,14 @@ import org.springframework.transaction.annotation.Transactional; | @@ -13,11 +14,14 @@ import org.springframework.transaction.annotation.Transactional; | ||
| 13 | import javax.annotation.Resource; | 14 | import javax.annotation.Resource; |
| 14 | import java.util.List; | 15 | import java.util.List; |
| 15 | 16 | ||
| 17 | +import static com.sunyo.wlpt.message.bus.service.common.Constant.EXIST_UMB; | ||
| 18 | + | ||
| 16 | /** | 19 | /** |
| 17 | * @author 子诚 | 20 | * @author 子诚 |
| 18 | * Description: | 21 | * Description: |
| 19 | * 时间:2020/6/29 17:37 | 22 | * 时间:2020/6/29 17:37 |
| 20 | */ | 23 | */ |
| 24 | +@Slf4j | ||
| 21 | @Service | 25 | @Service |
| 22 | public class UserMessageBindingServiceImpl implements UserMessageBindingService { | 26 | public class UserMessageBindingServiceImpl implements UserMessageBindingService { |
| 23 | 27 | ||
| @@ -110,7 +114,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -110,7 +114,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 110 | userMessageBinding.setExchangeId(split_exchangeId[j]); | 114 | userMessageBinding.setExchangeId(split_exchangeId[j]); |
| 111 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); | 115 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); |
| 112 | userMessageBinding.setQueueId(split_queueId[l]); | 116 | userMessageBinding.setQueueId(split_queueId[l]); |
| 113 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 117 | + int num = nextValidateAndFill(userMessageBinding); |
| 114 | if (num > 0) { | 118 | if (num > 0) { |
| 115 | index = index + num; | 119 | index = index + num; |
| 116 | } | 120 | } |
| @@ -119,7 +123,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -119,7 +123,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 119 | userMessageBinding.setUserId(split_userId[i]); | 123 | userMessageBinding.setUserId(split_userId[i]); |
| 120 | userMessageBinding.setExchangeId(split_exchangeId[j]); | 124 | userMessageBinding.setExchangeId(split_exchangeId[j]); |
| 121 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); | 125 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); |
| 122 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 126 | + int num = nextValidateAndFill(userMessageBinding); |
| 123 | if (num > 0) { | 127 | if (num > 0) { |
| 124 | index = index + num; | 128 | index = index + num; |
| 125 | } | 129 | } |
| @@ -133,7 +137,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -133,7 +137,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 133 | userMessageBinding.setUserId(split_userId[i]); | 137 | userMessageBinding.setUserId(split_userId[i]); |
| 134 | userMessageBinding.setExchangeId(split_exchangeId[j]); | 138 | userMessageBinding.setExchangeId(split_exchangeId[j]); |
| 135 | userMessageBinding.setQueueId(split_queueId[l]); | 139 | userMessageBinding.setQueueId(split_queueId[l]); |
| 136 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 140 | + int num = nextValidateAndFill(userMessageBinding); |
| 137 | if (num > 0) { | 141 | if (num > 0) { |
| 138 | index = index + num; | 142 | index = index + num; |
| 139 | } | 143 | } |
| @@ -141,7 +145,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -141,7 +145,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 141 | } else { | 145 | } else { |
| 142 | userMessageBinding.setUserId(split_userId[i]); | 146 | userMessageBinding.setUserId(split_userId[i]); |
| 143 | userMessageBinding.setExchangeId(split_exchangeId[j]); | 147 | userMessageBinding.setExchangeId(split_exchangeId[j]); |
| 144 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 148 | + int num = nextValidateAndFill(userMessageBinding); |
| 145 | if (num > 0) { | 149 | if (num > 0) { |
| 146 | index = index + num; | 150 | index = index + num; |
| 147 | } | 151 | } |
| @@ -161,7 +165,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -161,7 +165,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 161 | userMessageBinding.setUserId(split_userId[i]); | 165 | userMessageBinding.setUserId(split_userId[i]); |
| 162 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); | 166 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); |
| 163 | userMessageBinding.setQueueId(split_queueId[l]); | 167 | userMessageBinding.setQueueId(split_queueId[l]); |
| 164 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 168 | + int num = nextValidateAndFill(userMessageBinding); |
| 165 | if (num > 0) { | 169 | if (num > 0) { |
| 166 | index = index + num; | 170 | index = index + num; |
| 167 | } | 171 | } |
| @@ -169,7 +173,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -169,7 +173,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 169 | } else { | 173 | } else { |
| 170 | userMessageBinding.setUserId(split_userId[i]); | 174 | userMessageBinding.setUserId(split_userId[i]); |
| 171 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); | 175 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); |
| 172 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 176 | + int num = nextValidateAndFill(userMessageBinding); |
| 173 | if (num > 0) { | 177 | if (num > 0) { |
| 174 | index = index + num; | 178 | index = index + num; |
| 175 | } | 179 | } |
| @@ -182,14 +186,14 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -182,14 +186,14 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 182 | for (int l = 0; l < split_queueId.length; l++) { | 186 | for (int l = 0; l < split_queueId.length; l++) { |
| 183 | userMessageBinding.setUserId(split_userId[i]); | 187 | userMessageBinding.setUserId(split_userId[i]); |
| 184 | userMessageBinding.setQueueId(split_queueId[l]); | 188 | userMessageBinding.setQueueId(split_queueId[l]); |
| 185 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 189 | + int num = nextValidateAndFill(userMessageBinding); |
| 186 | if (num > 0) { | 190 | if (num > 0) { |
| 187 | index = index + num; | 191 | index = index + num; |
| 188 | } | 192 | } |
| 189 | } | 193 | } |
| 190 | } else { | 194 | } else { |
| 191 | userMessageBinding.setUserId(split_userId[i]); | 195 | userMessageBinding.setUserId(split_userId[i]); |
| 192 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 196 | + int num = nextValidateAndFill(userMessageBinding); |
| 193 | if (num > 0) { | 197 | if (num > 0) { |
| 194 | index = index + num; | 198 | index = index + num; |
| 195 | } | 199 | } |
| @@ -213,7 +217,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -213,7 +217,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 213 | userMessageBinding.setExchangeId(split_exchangeId[j]); | 217 | userMessageBinding.setExchangeId(split_exchangeId[j]); |
| 214 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); | 218 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); |
| 215 | userMessageBinding.setQueueId(split_queueId[l]); | 219 | userMessageBinding.setQueueId(split_queueId[l]); |
| 216 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 220 | + int num = nextValidateAndFill(userMessageBinding); |
| 217 | if (num > 0) { | 221 | if (num > 0) { |
| 218 | index = index + num; | 222 | index = index + num; |
| 219 | } | 223 | } |
| @@ -221,7 +225,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -221,7 +225,7 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 221 | } else { | 225 | } else { |
| 222 | userMessageBinding.setExchangeId(split_exchangeId[j]); | 226 | userMessageBinding.setExchangeId(split_exchangeId[j]); |
| 223 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); | 227 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); |
| 224 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 228 | + int num = nextValidateAndFill(userMessageBinding); |
| 225 | if (num > 0) { | 229 | if (num > 0) { |
| 226 | index = index + num; | 230 | index = index + num; |
| 227 | } | 231 | } |
| @@ -234,14 +238,14 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -234,14 +238,14 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 234 | for (int l = 0; l < split_queueId.length; l++) { | 238 | for (int l = 0; l < split_queueId.length; l++) { |
| 235 | userMessageBinding.setExchangeId(split_exchangeId[j]); | 239 | userMessageBinding.setExchangeId(split_exchangeId[j]); |
| 236 | userMessageBinding.setQueueId(split_queueId[l]); | 240 | userMessageBinding.setQueueId(split_queueId[l]); |
| 237 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 241 | + int num = nextValidateAndFill(userMessageBinding); |
| 238 | if (num > 0) { | 242 | if (num > 0) { |
| 239 | index = index + num; | 243 | index = index + num; |
| 240 | } | 244 | } |
| 241 | } | 245 | } |
| 242 | } else { | 246 | } else { |
| 243 | userMessageBinding.setExchangeId(split_exchangeId[j]); | 247 | userMessageBinding.setExchangeId(split_exchangeId[j]); |
| 244 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 248 | + int num = nextValidateAndFill(userMessageBinding); |
| 245 | if (num > 0) { | 249 | if (num > 0) { |
| 246 | index = index + num; | 250 | index = index + num; |
| 247 | } | 251 | } |
| @@ -259,14 +263,14 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -259,14 +263,14 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 259 | for (int l = 0; l < split_queueId.length; l++) { | 263 | for (int l = 0; l < split_queueId.length; l++) { |
| 260 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); | 264 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); |
| 261 | userMessageBinding.setQueueId(split_queueId[l]); | 265 | userMessageBinding.setQueueId(split_queueId[l]); |
| 262 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 266 | + int num = nextValidateAndFill(userMessageBinding); |
| 263 | if (num > 0) { | 267 | if (num > 0) { |
| 264 | index = index + num; | 268 | index = index + num; |
| 265 | } | 269 | } |
| 266 | } | 270 | } |
| 267 | } else { | 271 | } else { |
| 268 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); | 272 | userMessageBinding.setRoutingKeyId(split_routingKeyId[k]); |
| 269 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 273 | + int num = nextValidateAndFill(userMessageBinding); |
| 270 | if (num > 0) { | 274 | if (num > 0) { |
| 271 | index = index + num; | 275 | index = index + num; |
| 272 | } | 276 | } |
| @@ -278,13 +282,13 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -278,13 +282,13 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 278 | String[] split_queueId = queueId.split(splitItem); | 282 | String[] split_queueId = queueId.split(splitItem); |
| 279 | for (int l = 0; l < split_queueId.length; l++) { | 283 | for (int l = 0; l < split_queueId.length; l++) { |
| 280 | userMessageBinding.setQueueId(split_queueId[l]); | 284 | userMessageBinding.setQueueId(split_queueId[l]); |
| 281 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 285 | + int num = nextValidateAndFill(userMessageBinding); |
| 282 | if (num > 0) { | 286 | if (num > 0) { |
| 283 | index = index + num; | 287 | index = index + num; |
| 284 | } | 288 | } |
| 285 | } | 289 | } |
| 286 | } else { | 290 | } else { |
| 287 | - int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | 291 | + int num = nextValidateAndFill(userMessageBinding); |
| 288 | if (num > 0) { | 292 | if (num > 0) { |
| 289 | index = index + num; | 293 | index = index + num; |
| 290 | } | 294 | } |
| @@ -357,6 +361,38 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | @@ -357,6 +361,38 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService | ||
| 357 | 361 | ||
| 358 | return userMessageBinding; | 362 | return userMessageBinding; |
| 359 | } | 363 | } |
| 364 | + | ||
| 365 | + /** | ||
| 366 | + * 在执行填充和添加之前先校验一下是否存在? | ||
| 367 | + * | ||
| 368 | + * @param userMessageBinding {@link UserMessageBinding} | ||
| 369 | + * @return 判断校验是否通过 | ||
| 370 | + */ | ||
| 371 | + public String validateBinding(UserMessageBinding userMessageBinding) | ||
| 372 | + { | ||
| 373 | + // 校验 | ||
| 374 | + List<UserMessageBinding> list = userMessageBindingMapper.validateBinding(userMessageBinding); | ||
| 375 | + if (list.size() > 0) { | ||
| 376 | + return EXIST_UMB; | ||
| 377 | + } | ||
| 378 | + return null; | ||
| 379 | + } | ||
| 380 | + | ||
| 381 | + /** | ||
| 382 | + * 接下来的 校验-填充-添加 | ||
| 383 | + */ | ||
| 384 | + public int nextValidateAndFill(UserMessageBinding userMessageBinding) | ||
| 385 | + { | ||
| 386 | + String validate = validateBinding(userMessageBinding); | ||
| 387 | + if (EXIST_UMB.equals(validate)) { | ||
| 388 | + log.info(userMessageBinding + "--> 该绑定关系已存在"); | ||
| 389 | + return 0; | ||
| 390 | + } else if (validate == null) { | ||
| 391 | + return userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); | ||
| 392 | + } else { | ||
| 393 | + return 0; | ||
| 394 | + } | ||
| 395 | + } | ||
| 360 | } | 396 | } |
| 361 | 397 | ||
| 362 | 398 |
| @@ -27,22 +27,20 @@ | @@ -27,22 +27,20 @@ | ||
| 27 | subscriber, description, gmt_create, gmt_modified | 27 | subscriber, description, gmt_create, gmt_modified |
| 28 | </sql> | 28 | </sql> |
| 29 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> | 29 | <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> |
| 30 | - <!--@mbg.generated-->select | ||
| 31 | - | 30 | + <!--@mbg.generated--> |
| 31 | + select | ||
| 32 | <include refid="Base_Column_List"/> | 32 | <include refid="Base_Column_List"/> |
| 33 | - | ||
| 34 | from user_message_binding | 33 | from user_message_binding |
| 35 | where id = #{id,jdbcType=VARCHAR} | 34 | where id = #{id,jdbcType=VARCHAR} |
| 36 | - | ||
| 37 | </select> | 35 | </select> |
| 38 | <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> | 36 | <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> |
| 39 | <!--@mbg.generated-->delete | 37 | <!--@mbg.generated-->delete |
| 40 | from user_message_binding | 38 | from user_message_binding |
| 41 | where id = #{id,jdbcType=VARCHAR} | 39 | where id = #{id,jdbcType=VARCHAR} |
| 42 | - | ||
| 43 | </delete> | 40 | </delete> |
| 44 | <insert id="insert" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding"> | 41 | <insert id="insert" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding"> |
| 45 | - <!--@mbg.generated-->insert into user_message_binding (id, user_id, username, | 42 | + <!--@mbg.generated--> |
| 43 | + insert into user_message_binding (id, user_id, username, | ||
| 46 | server_id, `server_name`, virtual_host_id, | 44 | server_id, `server_name`, virtual_host_id, |
| 47 | virtual_host_name, exchange_id, exchange_name, | 45 | virtual_host_name, exchange_id, exchange_name, |
| 48 | queue_id, queue_name, routing_key_id, | 46 | queue_id, queue_name, routing_key_id, |
| @@ -58,271 +56,176 @@ | @@ -58,271 +56,176 @@ | ||
| 58 | #{routingKeyName,jdbcType=VARCHAR}, #{subscriber,jdbcType=VARCHAR}, | 56 | #{routingKeyName,jdbcType=VARCHAR}, #{subscriber,jdbcType=VARCHAR}, |
| 59 | #{description,jdbcType=VARCHAR}, | 57 | #{description,jdbcType=VARCHAR}, |
| 60 | #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}) | 58 | #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}) |
| 61 | - | ||
| 62 | </insert> | 59 | </insert> |
| 63 | <insert id="insertSelective" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding"> | 60 | <insert id="insertSelective" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding"> |
| 64 | - <!--@mbg.generated-->insert into user_message_binding | ||
| 65 | - | 61 | + <!--@mbg.generated--> |
| 62 | + insert into user_message_binding | ||
| 66 | <trim prefix="(" suffix=")" suffixOverrides=","> | 63 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 67 | <if test="id != null"> | 64 | <if test="id != null"> |
| 68 | id, | 65 | id, |
| 69 | - | ||
| 70 | </if> | 66 | </if> |
| 71 | <if test="userId != null"> | 67 | <if test="userId != null"> |
| 72 | - | ||
| 73 | user_id, | 68 | user_id, |
| 74 | - | ||
| 75 | </if> | 69 | </if> |
| 76 | <if test="username != null"> | 70 | <if test="username != null"> |
| 77 | - | ||
| 78 | username, | 71 | username, |
| 79 | - | ||
| 80 | </if> | 72 | </if> |
| 81 | <if test="serverId != null"> | 73 | <if test="serverId != null"> |
| 82 | - | ||
| 83 | server_id, | 74 | server_id, |
| 84 | - | ||
| 85 | </if> | 75 | </if> |
| 86 | <if test="serverName != null"> | 76 | <if test="serverName != null"> |
| 87 | - | ||
| 88 | `server_name`, | 77 | `server_name`, |
| 89 | - | ||
| 90 | </if> | 78 | </if> |
| 91 | <if test="virtualHostId != null"> | 79 | <if test="virtualHostId != null"> |
| 92 | - | ||
| 93 | virtual_host_id, | 80 | virtual_host_id, |
| 94 | - | ||
| 95 | </if> | 81 | </if> |
| 96 | <if test="virtualHostName != null"> | 82 | <if test="virtualHostName != null"> |
| 97 | - | ||
| 98 | virtual_host_name, | 83 | virtual_host_name, |
| 99 | - | ||
| 100 | </if> | 84 | </if> |
| 101 | <if test="exchangeId != null"> | 85 | <if test="exchangeId != null"> |
| 102 | - | ||
| 103 | exchange_id, | 86 | exchange_id, |
| 104 | - | ||
| 105 | </if> | 87 | </if> |
| 106 | <if test="exchangeName != null"> | 88 | <if test="exchangeName != null"> |
| 107 | - | ||
| 108 | exchange_name, | 89 | exchange_name, |
| 109 | - | ||
| 110 | </if> | 90 | </if> |
| 111 | <if test="queueId != null"> | 91 | <if test="queueId != null"> |
| 112 | - | ||
| 113 | queue_id, | 92 | queue_id, |
| 114 | - | ||
| 115 | </if> | 93 | </if> |
| 116 | <if test="queueName != null"> | 94 | <if test="queueName != null"> |
| 117 | - | ||
| 118 | queue_name, | 95 | queue_name, |
| 119 | - | ||
| 120 | </if> | 96 | </if> |
| 121 | <if test="routingKeyId != null"> | 97 | <if test="routingKeyId != null"> |
| 122 | - | ||
| 123 | routing_key_id, | 98 | routing_key_id, |
| 124 | - | ||
| 125 | </if> | 99 | </if> |
| 126 | <if test="routingKeyName != null"> | 100 | <if test="routingKeyName != null"> |
| 127 | - | ||
| 128 | routing_key_name, | 101 | routing_key_name, |
| 129 | - | ||
| 130 | </if> | 102 | </if> |
| 131 | <if test="subscriber != null"> | 103 | <if test="subscriber != null"> |
| 132 | - | ||
| 133 | subscriber, | 104 | subscriber, |
| 134 | - | ||
| 135 | </if> | 105 | </if> |
| 136 | <if test="description != null"> | 106 | <if test="description != null"> |
| 137 | - | ||
| 138 | description, | 107 | description, |
| 139 | - | ||
| 140 | </if> | 108 | </if> |
| 141 | <if test="gmtCreate != null"> | 109 | <if test="gmtCreate != null"> |
| 142 | - | ||
| 143 | gmt_create, | 110 | gmt_create, |
| 144 | - | ||
| 145 | </if> | 111 | </if> |
| 146 | <if test="gmtModified != null"> | 112 | <if test="gmtModified != null"> |
| 147 | - | ||
| 148 | gmt_modified, | 113 | gmt_modified, |
| 149 | </if> | 114 | </if> |
| 150 | </trim> | 115 | </trim> |
| 151 | <trim prefix="values (" suffix=")" suffixOverrides=","> | 116 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| 152 | <if test="id != null"> | 117 | <if test="id != null"> |
| 153 | #{id,jdbcType=VARCHAR}, | 118 | #{id,jdbcType=VARCHAR}, |
| 154 | - | ||
| 155 | </if> | 119 | </if> |
| 156 | <if test="userId != null"> | 120 | <if test="userId != null"> |
| 157 | - | ||
| 158 | #{userId,jdbcType=VARCHAR}, | 121 | #{userId,jdbcType=VARCHAR}, |
| 159 | - | ||
| 160 | </if> | 122 | </if> |
| 161 | <if test="username != null"> | 123 | <if test="username != null"> |
| 162 | - | ||
| 163 | #{username,jdbcType=VARCHAR}, | 124 | #{username,jdbcType=VARCHAR}, |
| 164 | - | ||
| 165 | </if> | 125 | </if> |
| 166 | <if test="serverId != null"> | 126 | <if test="serverId != null"> |
| 167 | - | ||
| 168 | #{serverId,jdbcType=VARCHAR}, | 127 | #{serverId,jdbcType=VARCHAR}, |
| 169 | - | ||
| 170 | </if> | 128 | </if> |
| 171 | <if test="serverName != null"> | 129 | <if test="serverName != null"> |
| 172 | - | ||
| 173 | #{serverName,jdbcType=VARCHAR}, | 130 | #{serverName,jdbcType=VARCHAR}, |
| 174 | - | ||
| 175 | </if> | 131 | </if> |
| 176 | <if test="virtualHostId != null"> | 132 | <if test="virtualHostId != null"> |
| 177 | - | ||
| 178 | #{virtualHostId,jdbcType=VARCHAR}, | 133 | #{virtualHostId,jdbcType=VARCHAR}, |
| 179 | - | ||
| 180 | </if> | 134 | </if> |
| 181 | <if test="virtualHostName != null"> | 135 | <if test="virtualHostName != null"> |
| 182 | - | ||
| 183 | #{virtualHostName,jdbcType=VARCHAR}, | 136 | #{virtualHostName,jdbcType=VARCHAR}, |
| 184 | - | ||
| 185 | </if> | 137 | </if> |
| 186 | <if test="exchangeId != null"> | 138 | <if test="exchangeId != null"> |
| 187 | - | ||
| 188 | #{exchangeId,jdbcType=VARCHAR}, | 139 | #{exchangeId,jdbcType=VARCHAR}, |
| 189 | - | ||
| 190 | </if> | 140 | </if> |
| 191 | <if test="exchangeName != null"> | 141 | <if test="exchangeName != null"> |
| 192 | - | ||
| 193 | #{exchangeName,jdbcType=VARCHAR}, | 142 | #{exchangeName,jdbcType=VARCHAR}, |
| 194 | - | ||
| 195 | </if> | 143 | </if> |
| 196 | <if test="queueId != null"> | 144 | <if test="queueId != null"> |
| 197 | - | ||
| 198 | #{queueId,jdbcType=VARCHAR}, | 145 | #{queueId,jdbcType=VARCHAR}, |
| 199 | - | ||
| 200 | </if> | 146 | </if> |
| 201 | <if test="queueName != null"> | 147 | <if test="queueName != null"> |
| 202 | - | ||
| 203 | #{queueName,jdbcType=VARCHAR}, | 148 | #{queueName,jdbcType=VARCHAR}, |
| 204 | - | ||
| 205 | </if> | 149 | </if> |
| 206 | <if test="routingKeyId != null"> | 150 | <if test="routingKeyId != null"> |
| 207 | - | ||
| 208 | #{routingKeyId,jdbcType=VARCHAR}, | 151 | #{routingKeyId,jdbcType=VARCHAR}, |
| 209 | - | ||
| 210 | </if> | 152 | </if> |
| 211 | <if test="routingKeyName != null"> | 153 | <if test="routingKeyName != null"> |
| 212 | - | ||
| 213 | #{routingKeyName,jdbcType=VARCHAR}, | 154 | #{routingKeyName,jdbcType=VARCHAR}, |
| 214 | - | ||
| 215 | </if> | 155 | </if> |
| 216 | <if test="subscriber != null"> | 156 | <if test="subscriber != null"> |
| 217 | - | ||
| 218 | #{subscriber,jdbcType=VARCHAR}, | 157 | #{subscriber,jdbcType=VARCHAR}, |
| 219 | - | ||
| 220 | </if> | 158 | </if> |
| 221 | <if test="description != null"> | 159 | <if test="description != null"> |
| 222 | - | ||
| 223 | #{description,jdbcType=VARCHAR}, | 160 | #{description,jdbcType=VARCHAR}, |
| 224 | - | ||
| 225 | </if> | 161 | </if> |
| 226 | <if test="gmtCreate != null"> | 162 | <if test="gmtCreate != null"> |
| 227 | - | ||
| 228 | #{gmtCreate,jdbcType=TIMESTAMP}, | 163 | #{gmtCreate,jdbcType=TIMESTAMP}, |
| 229 | - | ||
| 230 | </if> | 164 | </if> |
| 231 | <if test="gmtModified != null"> | 165 | <if test="gmtModified != null"> |
| 232 | - | ||
| 233 | #{gmtModified,jdbcType=TIMESTAMP}, | 166 | #{gmtModified,jdbcType=TIMESTAMP}, |
| 234 | </if> | 167 | </if> |
| 235 | </trim> | 168 | </trim> |
| 236 | </insert> | 169 | </insert> |
| 237 | <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding"> | 170 | <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding"> |
| 238 | - <!--@mbg.generated-->update user_message_binding | ||
| 239 | - | 171 | + <!--@mbg.generated--> |
| 172 | + update user_message_binding | ||
| 240 | <set> | 173 | <set> |
| 241 | <if test="userId != null"> | 174 | <if test="userId != null"> |
| 242 | user_id = #{userId,jdbcType=VARCHAR}, | 175 | user_id = #{userId,jdbcType=VARCHAR}, |
| 243 | - | ||
| 244 | </if> | 176 | </if> |
| 245 | <if test="username != null"> | 177 | <if test="username != null"> |
| 246 | - | ||
| 247 | username = #{username,jdbcType=VARCHAR}, | 178 | username = #{username,jdbcType=VARCHAR}, |
| 248 | - | ||
| 249 | </if> | 179 | </if> |
| 250 | <if test="serverId != null"> | 180 | <if test="serverId != null"> |
| 251 | - | ||
| 252 | server_id = #{serverId,jdbcType=VARCHAR}, | 181 | server_id = #{serverId,jdbcType=VARCHAR}, |
| 253 | - | ||
| 254 | </if> | 182 | </if> |
| 255 | <if test="serverName != null"> | 183 | <if test="serverName != null"> |
| 256 | - | ||
| 257 | `server_name` = #{serverName,jdbcType=VARCHAR}, | 184 | `server_name` = #{serverName,jdbcType=VARCHAR}, |
| 258 | - | ||
| 259 | </if> | 185 | </if> |
| 260 | <if test="virtualHostId != null"> | 186 | <if test="virtualHostId != null"> |
| 261 | - | ||
| 262 | virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}, | 187 | virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}, |
| 263 | - | ||
| 264 | </if> | 188 | </if> |
| 265 | <if test="virtualHostName != null"> | 189 | <if test="virtualHostName != null"> |
| 266 | - | ||
| 267 | virtual_host_name = #{virtualHostName,jdbcType=VARCHAR}, | 190 | virtual_host_name = #{virtualHostName,jdbcType=VARCHAR}, |
| 268 | - | ||
| 269 | </if> | 191 | </if> |
| 270 | <if test="exchangeId != null"> | 192 | <if test="exchangeId != null"> |
| 271 | - | ||
| 272 | exchange_id = #{exchangeId,jdbcType=VARCHAR}, | 193 | exchange_id = #{exchangeId,jdbcType=VARCHAR}, |
| 273 | - | ||
| 274 | </if> | 194 | </if> |
| 275 | <if test="exchangeName != null"> | 195 | <if test="exchangeName != null"> |
| 276 | - | ||
| 277 | exchange_name = #{exchangeName,jdbcType=VARCHAR}, | 196 | exchange_name = #{exchangeName,jdbcType=VARCHAR}, |
| 278 | - | ||
| 279 | </if> | 197 | </if> |
| 280 | <if test="queueId != null"> | 198 | <if test="queueId != null"> |
| 281 | - | ||
| 282 | queue_id = #{queueId,jdbcType=VARCHAR}, | 199 | queue_id = #{queueId,jdbcType=VARCHAR}, |
| 283 | - | ||
| 284 | </if> | 200 | </if> |
| 285 | <if test="queueName != null"> | 201 | <if test="queueName != null"> |
| 286 | - | ||
| 287 | queue_name = #{queueName,jdbcType=VARCHAR}, | 202 | queue_name = #{queueName,jdbcType=VARCHAR}, |
| 288 | - | ||
| 289 | </if> | 203 | </if> |
| 290 | <if test="routingKeyId != null"> | 204 | <if test="routingKeyId != null"> |
| 291 | - | ||
| 292 | routing_key_id = #{routingKeyId,jdbcType=VARCHAR}, | 205 | routing_key_id = #{routingKeyId,jdbcType=VARCHAR}, |
| 293 | - | ||
| 294 | </if> | 206 | </if> |
| 295 | <if test="routingKeyName != null"> | 207 | <if test="routingKeyName != null"> |
| 296 | - | ||
| 297 | routing_key_name = #{routingKeyName,jdbcType=VARCHAR}, | 208 | routing_key_name = #{routingKeyName,jdbcType=VARCHAR}, |
| 298 | - | ||
| 299 | </if> | 209 | </if> |
| 300 | <if test="subscriber != null"> | 210 | <if test="subscriber != null"> |
| 301 | - | ||
| 302 | subscriber = #{subscriber,jdbcType=VARCHAR}, | 211 | subscriber = #{subscriber,jdbcType=VARCHAR}, |
| 303 | - | ||
| 304 | </if> | 212 | </if> |
| 305 | <if test="description != null"> | 213 | <if test="description != null"> |
| 306 | - | ||
| 307 | description = #{description,jdbcType=VARCHAR}, | 214 | description = #{description,jdbcType=VARCHAR}, |
| 308 | - | ||
| 309 | </if> | 215 | </if> |
| 310 | <if test="gmtCreate != null"> | 216 | <if test="gmtCreate != null"> |
| 311 | - | ||
| 312 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, | 217 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, |
| 313 | - | ||
| 314 | </if> | 218 | </if> |
| 315 | <if test="gmtModified != null"> | 219 | <if test="gmtModified != null"> |
| 316 | - | ||
| 317 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, | 220 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}, |
| 318 | </if> | 221 | </if> |
| 319 | </set> | 222 | </set> |
| 320 | 223 | ||
| 321 | where id = #{id,jdbcType=VARCHAR} | 224 | where id = #{id,jdbcType=VARCHAR} |
| 322 | - | ||
| 323 | </update> | 225 | </update> |
| 324 | <update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding"> | 226 | <update id="updateByPrimaryKey" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding"> |
| 325 | - <!--@mbg.generated-->update user_message_binding | 227 | + <!--@mbg.generated--> |
| 228 | + update user_message_binding | ||
| 326 | set user_id = #{userId,jdbcType=VARCHAR}, | 229 | set user_id = #{userId,jdbcType=VARCHAR}, |
| 327 | username = #{username,jdbcType=VARCHAR}, | 230 | username = #{username,jdbcType=VARCHAR}, |
| 328 | server_id = #{serverId,jdbcType=VARCHAR}, | 231 | server_id = #{serverId,jdbcType=VARCHAR}, |
| @@ -340,12 +243,10 @@ | @@ -340,12 +243,10 @@ | ||
| 340 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, | 243 | gmt_create = #{gmtCreate,jdbcType=TIMESTAMP}, |
| 341 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} | 244 | gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} |
| 342 | where id = #{id,jdbcType=VARCHAR} | 245 | where id = #{id,jdbcType=VARCHAR} |
| 343 | - | ||
| 344 | </update> | 246 | </update> |
| 345 | <!-- 查询列表,选择性 --> | 247 | <!-- 查询列表,选择性 --> |
| 346 | <select id="selectUserMessageBindingList" | 248 | <select id="selectUserMessageBindingList" |
| 347 | parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding" resultMap="BaseResultMap"> | 249 | parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding" resultMap="BaseResultMap"> |
| 348 | - | ||
| 349 | select user_id, | 250 | select user_id, |
| 350 | username, | 251 | username, |
| 351 | server_id, | 252 | server_id, |
| @@ -361,60 +262,65 @@ | @@ -361,60 +262,65 @@ | ||
| 361 | GROUP_CONCAT(queue_name) as queue_name, | 262 | GROUP_CONCAT(queue_name) as queue_name, |
| 362 | GROUP_CONCAT(description) as description | 263 | GROUP_CONCAT(description) as description |
| 363 | from user_message_binding | 264 | from user_message_binding |
| 364 | - | ||
| 365 | <where> | 265 | <where> |
| 366 | <!-- 所属用户登陆名称 --> | 266 | <!-- 所属用户登陆名称 --> |
| 367 | <if test="username != null and username != ''"> | 267 | <if test="username != null and username != ''"> |
| 368 | username = #{username,jdbcType=VARCHAR} | 268 | username = #{username,jdbcType=VARCHAR} |
| 369 | - | ||
| 370 | </if> | 269 | </if> |
| 371 | <!-- 所属服务器名称 --> | 270 | <!-- 所属服务器名称 --> |
| 372 | <if test="serverName != null and serverName != ''"> | 271 | <if test="serverName != null and serverName != ''"> |
| 373 | - | ||
| 374 | AND `server_name` = #{serverName,jdbcType=VARCHAR} | 272 | AND `server_name` = #{serverName,jdbcType=VARCHAR} |
| 375 | - | ||
| 376 | </if> | 273 | </if> |
| 377 | <!-- 所属虚拟主机名称 --> | 274 | <!-- 所属虚拟主机名称 --> |
| 378 | <if test="virtualHostName != null and virtualHostName != ''"> | 275 | <if test="virtualHostName != null and virtualHostName != ''"> |
| 379 | - | ||
| 380 | AND virtual_host_name = #{virtualHostName,jdbcType=VARCHAR} | 276 | AND virtual_host_name = #{virtualHostName,jdbcType=VARCHAR} |
| 381 | - | ||
| 382 | </if> | 277 | </if> |
| 383 | <!-- 所属交换机名称 --> | 278 | <!-- 所属交换机名称 --> |
| 384 | <if test="exchangeName != null and exchangeName != ''"> | 279 | <if test="exchangeName != null and exchangeName != ''"> |
| 385 | - | ||
| 386 | AND exchange_name = #{exchangeName,jdbcType=VARCHAR} | 280 | AND exchange_name = #{exchangeName,jdbcType=VARCHAR} |
| 387 | - | ||
| 388 | </if> | 281 | </if> |
| 389 | <!-- 所属队列名称 --> | 282 | <!-- 所属队列名称 --> |
| 390 | <if test="queueName != null and queueName != ''"> | 283 | <if test="queueName != null and queueName != ''"> |
| 391 | - | ||
| 392 | AND queue_name = #{queueName,jdbcType=VARCHAR} | 284 | AND queue_name = #{queueName,jdbcType=VARCHAR} |
| 393 | - | ||
| 394 | </if> | 285 | </if> |
| 395 | <!-- 所属路由键名称 --> | 286 | <!-- 所属路由键名称 --> |
| 396 | <if test="routingKeyName != null and routingKeyName != ''"> | 287 | <if test="routingKeyName != null and routingKeyName != ''"> |
| 397 | - | ||
| 398 | AND routing_key_name = #{routingKeyName,jdbcType=VARCHAR} | 288 | AND routing_key_name = #{routingKeyName,jdbcType=VARCHAR} |
| 399 | </if> | 289 | </if> |
| 400 | - <!-- 订阅者 --> | ||
| 401 | - <!-- <if test="subscriber != null and subscriber !=''">--> | ||
| 402 | - <!-- AND subscriber = #{subscriber,jdbcType=VARCHAR}--> | ||
| 403 | - <!-- </if>--> | ||
| 404 | </where> | 290 | </where> |
| 405 | - | ||
| 406 | group by user_id, username, server_id, `server_name`, virtual_host_id, virtual_host_name, | 291 | group by user_id, username, server_id, `server_name`, virtual_host_id, virtual_host_name, |
| 407 | exchange_id, exchange_name, routing_key_id, routing_key_name | 292 | exchange_id, exchange_name, routing_key_id, routing_key_name |
| 408 | - | ||
| 409 | </select> | 293 | </select> |
| 410 | <!-- 校验是否已存在 --> | 294 | <!-- 校验是否已存在 --> |
| 411 | <select id="validateBinding" resultMap="BaseResultMap"> | 295 | <select id="validateBinding" resultMap="BaseResultMap"> |
| 412 | - | ||
| 413 | select | 296 | select |
| 414 | - | ||
| 415 | <include refid="Base_Column_List"/> | 297 | <include refid="Base_Column_List"/> |
| 416 | - | ||
| 417 | from user_message_binding | 298 | from user_message_binding |
| 418 | - | 299 | + <where> |
| 300 | + <!-- 所属用户id --> | ||
| 301 | + <if test="userId != null and userId != ''"> | ||
| 302 | + user_id = #{userId,jdbcType=VARCHAR} | ||
| 303 | + </if> | ||
| 304 | + <!-- 所属服务器id --> | ||
| 305 | + <if test="serverId != null and serverId != ''"> | ||
| 306 | + AND server_id = #{serverId,jdbcType=VARCHAR} | ||
| 307 | + </if> | ||
| 308 | + <!-- 所属虚拟主机id --> | ||
| 309 | + <if test="virtualHostId != null and virtualHostId != ''"> | ||
| 310 | + AND virtual_host_id = #{virtualHostId,jdbcType=VARCHAR} | ||
| 311 | + </if> | ||
| 312 | + <!-- 所属交换机id --> | ||
| 313 | + <if test="exchangeId != null and exchangeId != ''"> | ||
| 314 | + AND exchange_id = #{exchangeId,jdbcType=VARCHAR} | ||
| 315 | + </if> | ||
| 316 | + <!-- 所属队列id --> | ||
| 317 | + <if test="queueId != null and queueId != ''"> | ||
| 318 | + AND queue_id = #{queueId,jdbcType=VARCHAR} | ||
| 319 | + </if> | ||
| 320 | + <!-- 所属路由键id --> | ||
| 321 | + <if test="routingKeyId != null and routingKeyId != ''"> | ||
| 322 | + AND routing_key_id = #{routingKeyId,jdbcType=VARCHAR} | ||
| 323 | + </if> | ||
| 324 | + </where> | ||
| 419 | </select> | 325 | </select> |
| 420 | </mapper> | 326 | </mapper> |
-
请 注册 或 登录 后发表评论