作者 王勇

添加umb配置

@@ -39,7 +39,8 @@ public class CascadeController { @@ -39,7 +39,8 @@ public class CascadeController {
39 * @return {@link ResultJson} 39 * @return {@link ResultJson}
40 */ 40 */
41 @GetMapping("/server") 41 @GetMapping("/server")
42 - public ResultJson getServerList() { 42 + public ResultJson getServerList()
  43 + {
43 44
44 List<BusServer> busServers = busServerService.getServerList(); 45 List<BusServer> busServers = busServerService.getServerList();
45 return busServers.size() > 0 46 return busServers.size() > 0
@@ -55,7 +56,8 @@ public class CascadeController { @@ -55,7 +56,8 @@ public class CascadeController {
55 * @return {@link ResultJson} 56 * @return {@link ResultJson}
56 */ 57 */
57 @GetMapping("/host") 58 @GetMapping("/host")
58 - public ResultJson getVirtualHostList(@RequestParam(value = "serverId", required = false) String serverId) { 59 + public ResultJson getVirtualHostList(@RequestParam(value = "serverId", required = false) String serverId)
  60 + {
59 // 获取查询参数 61 // 获取查询参数
60 VirtualHost virtualHost = VirtualHost.builder().serverId(serverId).build(); 62 VirtualHost virtualHost = VirtualHost.builder().serverId(serverId).build();
61 List<VirtualHost> virtualHosts = virtualHostService.getVirtualHostList(virtualHost); 63 List<VirtualHost> virtualHosts = virtualHostService.getVirtualHostList(virtualHost);
@@ -71,7 +73,8 @@ public class CascadeController { @@ -71,7 +73,8 @@ public class CascadeController {
71 * @return 73 * @return
72 */ 74 */
73 @GetMapping("/exchange") 75 @GetMapping("/exchange")
74 - public ResultJson getExchangeList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId) { 76 + public ResultJson getExchangeList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId)
  77 + {
75 // 获取查询参数 78 // 获取查询参数
76 BusExchange busExchange = BusExchange.builder().virtualHostId(virtualHostId).build(); 79 BusExchange busExchange = BusExchange.builder().virtualHostId(virtualHostId).build();
77 List<BusExchange> busExchanges = busExchangeService.getExchangeList(busExchange); 80 List<BusExchange> busExchanges = busExchangeService.getExchangeList(busExchange);
@@ -87,9 +90,11 @@ public class CascadeController { @@ -87,9 +90,11 @@ public class CascadeController {
87 * @return {@link ResultJson} 90 * @return {@link ResultJson}
88 */ 91 */
89 @GetMapping("/queue") 92 @GetMapping("/queue")
90 - public ResultJson getQueueList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId) { 93 + public ResultJson getQueueList(@RequestParam(value = "virtualHostId", required = false) String virtualHostId,
  94 + @RequestParam(value = "userId", required = false) String userId)
  95 + {
91 // 获取查询参数 96 // 获取查询参数
92 - BusQueue busQueue = BusQueue.builder().virtualHostId(virtualHostId).build(); 97 + BusQueue busQueue = BusQueue.builder().virtualHostId(virtualHostId).userId(userId).build();
93 List<BusQueue> busQueues = busQueueService.getQueueList(busQueue); 98 List<BusQueue> busQueues = busQueueService.getQueueList(busQueue);
94 return busQueues.size() > 0 99 return busQueues.size() > 0
95 ? new ResultJson<>("200", "查询队列列表,成功", busQueues) 100 ? new ResultJson<>("200", "查询队列列表,成功", busQueues)
@@ -103,7 +108,8 @@ public class CascadeController { @@ -103,7 +108,8 @@ public class CascadeController {
103 * @return {@link ResultJson} 108 * @return {@link ResultJson}
104 */ 109 */
105 @GetMapping("/routing") 110 @GetMapping("/routing")
106 - public ResultJson getRoutingKeyList(@RequestParam(value = "exchangeId", required = false) String exchangeId) { 111 + public ResultJson getRoutingKeyList(@RequestParam(value = "exchangeId", required = false) String exchangeId)
  112 + {
107 // 获取查询参数 113 // 获取查询参数
108 RoutingKey routingKey = RoutingKey.builder().exchangeId(exchangeId).build(); 114 RoutingKey routingKey = RoutingKey.builder().exchangeId(exchangeId).build();
109 List<RoutingKey> routingKeys = routingKeyService.getRoutingKeyList(routingKey); 115 List<RoutingKey> routingKeys = routingKeyService.getRoutingKeyList(routingKey);
@@ -119,7 +125,8 @@ public class CascadeController { @@ -119,7 +125,8 @@ public class CascadeController {
119 * @return {@link ResultJson} 125 * @return {@link ResultJson}
120 */ 126 */
121 @GetMapping("/server_host") 127 @GetMapping("/server_host")
122 - public ResultJson getServerAndHostList() { 128 + public ResultJson getServerAndHostList()
  129 + {
123 130
124 List<BusServer> servers = busServerService.getServerAndHostList(); 131 List<BusServer> servers = busServerService.getServerAndHostList();
125 return servers.size() > 0 132 return servers.size() > 0
@@ -135,7 +142,8 @@ public class CascadeController { @@ -135,7 +142,8 @@ public class CascadeController {
135 * @return {@link ResultJson} 142 * @return {@link ResultJson}
136 */ 143 */
137 @GetMapping("/server_host_exchange") 144 @GetMapping("/server_host_exchange")
138 - public ResultJson getServerAndHostAndExchangeList() { 145 + public ResultJson getServerAndHostAndExchangeList()
  146 + {
139 147
140 List<BusServer> servers = busServerService.getServerAndHostAndExchangeList(); 148 List<BusServer> servers = busServerService.getServerAndHostAndExchangeList();
141 return servers.size() > 0 149 return servers.size() > 0
  1 +package com.sunyo.wlpt.message.bus.service.controller;
  2 +
  3 +import com.sunyo.wlpt.message.bus.service.domain.UserInfo;
  4 +import com.sunyo.wlpt.message.bus.service.response.ResultJson;
  5 +import com.sunyo.wlpt.message.bus.service.service.UserInfoService;
  6 +import org.springframework.web.bind.annotation.CrossOrigin;
  7 +import org.springframework.web.bind.annotation.GetMapping;
  8 +import org.springframework.web.bind.annotation.RequestMapping;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import javax.annotation.Resource;
  12 +import java.util.List;
  13 +
  14 +/**
  15 + * @author 子诚
  16 + * Description:用户的控制器
  17 + * 时间:2020/7/23 15:16
  18 + */
  19 +@CrossOrigin
  20 +@RequestMapping("bus/user")
  21 +@RestController
  22 +public class UserInfoController {
  23 +
  24 + @Resource
  25 + private UserInfoService userInfoService;
  26 +
  27 + /**
  28 + * 仅,查询用户列表
  29 + */
  30 + @GetMapping("/userList")
  31 + public ResultJson getUserInfoList()
  32 + {
  33 + List<UserInfo> userInfos = userInfoService.getUserInfoList();
  34 + return userInfos.size() > 0
  35 + ? new ResultJson<>("200", "查询用户信息列表,成功", userInfos)
  36 + : new ResultJson<>("500", "查询用户信息列表,失败");
  37 + }
  38 +}
@@ -32,7 +32,6 @@ public class UserMessageBindingController { @@ -32,7 +32,6 @@ public class UserMessageBindingController {
32 * @param exchangeName 所属交换机名称 32 * @param exchangeName 所属交换机名称
33 * @param queueName 所属队列名称 33 * @param queueName 所属队列名称
34 * @param routingKeyName 所属路由键名称 34 * @param routingKeyName 所属路由键名称
35 - * @param subscriber 订阅者  
36 * @param pageNum 当前页数 35 * @param pageNum 当前页数
37 * @param pageSize 每页数量 36 * @param pageSize 每页数量
38 * @return 列表 {@link ResultJson} 37 * @return 列表 {@link ResultJson}
@@ -45,7 +44,6 @@ public class UserMessageBindingController { @@ -45,7 +44,6 @@ public class UserMessageBindingController {
45 @RequestParam(value = "exchangeName", required = false) String exchangeName, 44 @RequestParam(value = "exchangeName", required = false) String exchangeName,
46 @RequestParam(value = "queueName", required = false) String queueName, 45 @RequestParam(value = "queueName", required = false) String queueName,
47 @RequestParam(value = "routingKeyName", required = false) String routingKeyName, 46 @RequestParam(value = "routingKeyName", required = false) String routingKeyName,
48 - @RequestParam(value = "subscriber", required = false) String subscriber,  
49 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, 47 @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
50 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) 48 @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize)
51 { 49 {
@@ -57,7 +55,6 @@ public class UserMessageBindingController { @@ -57,7 +55,6 @@ public class UserMessageBindingController {
57 .exchangeName(exchangeName) 55 .exchangeName(exchangeName)
58 .queueName(queueName) 56 .queueName(queueName)
59 .routingKeyName(routingKeyName) 57 .routingKeyName(routingKeyName)
60 - .subscriber(subscriber)  
61 .build(); 58 .build();
62 // 分页查询 59 // 分页查询
63 PageInfo pageInfo = userMessageBindingService.selectUserMessageBindingList(userMessageBinding, pageNum, pageSize); 60 PageInfo pageInfo = userMessageBindingService.selectUserMessageBindingList(userMessageBinding, pageNum, pageSize);
1 package com.sunyo.wlpt.message.bus.service.domain; 1 package com.sunyo.wlpt.message.bus.service.domain;
2 2
3 -import com.fasterxml.jackson.annotation.JsonFormat;  
4 import lombok.AllArgsConstructor; 3 import lombok.AllArgsConstructor;
5 import lombok.Builder; 4 import lombok.Builder;
6 import lombok.Data; 5 import lombok.Data;
@@ -12,15 +11,16 @@ import java.util.Date; @@ -12,15 +11,16 @@ import java.util.Date;
12 /** 11 /**
13 * @author 子诚 12 * @author 子诚
14 * Description:队列表 13 * Description:队列表
15 - * 时间:2020/7/1 10:14 14 + * 时间:2020/7/23 17:16
16 */ 15 */
  16 +
17 @Data 17 @Data
18 @Builder 18 @Builder
19 @AllArgsConstructor 19 @AllArgsConstructor
20 @NoArgsConstructor 20 @NoArgsConstructor
21 public class BusQueue implements Serializable { 21 public class BusQueue implements Serializable {
22 22
23 - private static final long serialVersionUID = 4347677784198350308L; 23 + private static final long serialVersionUID = 6999154061907346103L;
24 24
25 /** 25 /**
26 * 队列的ID 26 * 队列的ID
@@ -33,6 +33,16 @@ public class BusQueue implements Serializable { @@ -33,6 +33,16 @@ public class BusQueue implements Serializable {
33 private String queueName; 33 private String queueName;
34 34
35 /** 35 /**
  36 + * 所属用户id
  37 + */
  38 + private String userId;
  39 +
  40 + /**
  41 + * 所属用户登录名称
  42 + */
  43 + private String username;
  44 +
  45 + /**
36 * 所属虚拟主机ID 46 * 所属虚拟主机ID
37 */ 47 */
38 private String virtualHostId; 48 private String virtualHostId;
@@ -60,13 +70,11 @@ public class BusQueue implements Serializable { @@ -60,13 +70,11 @@ public class BusQueue implements Serializable {
60 /** 70 /**
61 * 队列创建时间 71 * 队列创建时间
62 */ 72 */
63 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")  
64 private Date gmtCreate; 73 private Date gmtCreate;
65 74
66 /** 75 /**
67 * 队列修改时间 76 * 队列修改时间
68 */ 77 */
69 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")  
70 private Date gmtModified; 78 private Date gmtModified;
71 79
72 /** 80 /**
@@ -75,18 +83,7 @@ public class BusQueue implements Serializable { @@ -75,18 +83,7 @@ public class BusQueue implements Serializable {
75 private String aliasName; 83 private String aliasName;
76 84
77 /** 85 /**
78 - * 一个队列对应一个虚拟 86 + * 一个队列对应一个虚拟机
79 */ 87 */
80 private VirtualHost virtualHost; 88 private VirtualHost virtualHost;
81 -  
82 - /**  
83 - * 定义有参构造器,封装 BusQueueController 的查询参数  
84 - *  
85 - * @param queueName 队列名称  
86 - * @param virtualHostId 所属虚拟主机ID  
87 - */  
88 - public BusQueue(String queueName, String virtualHostId) {  
89 - this.queueName = queueName;  
90 - this.virtualHostId = virtualHostId;  
91 - }  
92 } 89 }
1 package com.sunyo.wlpt.message.bus.service.domain; 1 package com.sunyo.wlpt.message.bus.service.domain;
2 2
3 -import com.fasterxml.jackson.annotation.JsonFormat; 3 +import io.swagger.annotations.ApiModel;
  4 +import io.swagger.annotations.ApiModelProperty;
4 import lombok.AllArgsConstructor; 5 import lombok.AllArgsConstructor;
5 import lombok.Builder; 6 import lombok.Builder;
6 import lombok.Data; 7 import lombok.Data;
@@ -12,16 +13,15 @@ import java.util.Date; @@ -12,16 +13,15 @@ import java.util.Date;
12 /** 13 /**
13 * @author 子诚 14 * @author 子诚
14 * Description:MQ账户信息表 15 * Description:MQ账户信息表
15 - * 时间:2020/6/29 17:17 16 + * 时间:2020/7/23 15:59
16 */ 17 */
  18 +
17 @Data 19 @Data
18 @Builder 20 @Builder
19 @AllArgsConstructor 21 @AllArgsConstructor
20 @NoArgsConstructor 22 @NoArgsConstructor
21 public class UserInfo implements Serializable { 23 public class UserInfo implements Serializable {
22 -  
23 - private static final long serialVersionUID = -7311881151729617686L;  
24 - 24 + private static final long serialVersionUID = 8510385519421924997L;
25 /** 25 /**
26 * 用户的ID 26 * 用户的ID
27 */ 27 */
@@ -38,20 +38,17 @@ public class UserInfo implements Serializable { @@ -38,20 +38,17 @@ public class UserInfo implements Serializable {
38 private String password; 38 private String password;
39 39
40 /** 40 /**
41 - * 用户信息相关描述 41 + * 用户相关描述
42 */ 42 */
43 private String description; 43 private String description;
44 44
45 /** 45 /**
46 * 用户信息创建时间 46 * 用户信息创建时间
47 */ 47 */
48 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")  
49 private Date gmtCreate; 48 private Date gmtCreate;
50 49
51 /** 50 /**
52 * 用户信息修改时间 51 * 用户信息修改时间
53 */ 52 */
54 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")  
55 private Date gmtModified; 53 private Date gmtModified;
56 -  
57 } 54 }
1 package com.sunyo.wlpt.message.bus.service.mapper; 1 package com.sunyo.wlpt.message.bus.service.mapper;
2 2
3 import com.sunyo.wlpt.message.bus.service.domain.BusQueue; 3 import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
4 -import org.apache.ibatis.annotations.Mapper;  
5 -  
6 -import java.util.List; 4 +import org.apache.ibatis.annotations.Mapper;import java.util.List;
7 5
8 /** 6 /**
9 * @author 子诚 7 * @author 子诚
10 * Description: 8 * Description:
11 - * 时间:2020/7/1 10:14 9 + * 时间:2020/7/23 17:16
12 */ 10 */
13 @Mapper 11 @Mapper
14 public interface BusQueueMapper { 12 public interface BusQueueMapper {
15 -  
16 /** 13 /**
17 - * 删除,根据主键 14 + * delete by primary key
18 * 15 *
19 * @param id primaryKey 16 * @param id primaryKey
20 * @return deleteCount 17 * @return deleteCount
@@ -22,7 +19,7 @@ public interface BusQueueMapper { @@ -22,7 +19,7 @@ public interface BusQueueMapper {
22 int deleteByPrimaryKey(String id); 19 int deleteByPrimaryKey(String id);
23 20
24 /** 21 /**
25 - * 新增 22 + * insert record to table
26 * 23 *
27 * @param record the record 24 * @param record the record
28 * @return insert count 25 * @return insert count
@@ -30,7 +27,7 @@ public interface BusQueueMapper { @@ -30,7 +27,7 @@ public interface BusQueueMapper {
30 int insert(BusQueue record); 27 int insert(BusQueue record);
31 28
32 /** 29 /**
33 - * 新增,选择性 30 + * insert record to table selective
34 * 31 *
35 * @param record the record 32 * @param record the record
36 * @return insert count 33 * @return insert count
@@ -38,7 +35,7 @@ public interface BusQueueMapper { @@ -38,7 +35,7 @@ public interface BusQueueMapper {
38 int insertSelective(BusQueue record); 35 int insertSelective(BusQueue record);
39 36
40 /** 37 /**
41 - * 查询,根据主键 38 + * select by primary key
42 * 39 *
43 * @param id primary key 40 * @param id primary key
44 * @return object by primary key 41 * @return object by primary key
@@ -46,7 +43,7 @@ public interface BusQueueMapper { @@ -46,7 +43,7 @@ public interface BusQueueMapper {
46 BusQueue selectByPrimaryKey(String id); 43 BusQueue selectByPrimaryKey(String id);
47 44
48 /** 45 /**
49 - * 更新,选择性,根据主键 46 + * update record selective
50 * 47 *
51 * @param record the updated record 48 * @param record the updated record
52 * @return update count 49 * @return update count
@@ -54,7 +51,7 @@ public interface BusQueueMapper { @@ -54,7 +51,7 @@ public interface BusQueueMapper {
54 int updateByPrimaryKeySelective(BusQueue record); 51 int updateByPrimaryKeySelective(BusQueue record);
55 52
56 /** 53 /**
57 - * 更新,根据主键 54 + * update record
58 * 55 *
59 * @param record the updated record 56 * @param record the updated record
60 * @return update count 57 * @return update count
1 package com.sunyo.wlpt.message.bus.service.mapper; 1 package com.sunyo.wlpt.message.bus.service.mapper;
2 2
3 import com.sunyo.wlpt.message.bus.service.domain.UserInfo; 3 import com.sunyo.wlpt.message.bus.service.domain.UserInfo;
4 -import org.apache.ibatis.annotations.Mapper; 4 +import org.apache.ibatis.annotations.Mapper;import java.util.List;
5 5
6 /** 6 /**
7 * @author 子诚 7 * @author 子诚
8 * Description: 8 * Description:
9 - * 时间:2020/6/29 17:17 9 + * 时间:2020/7/23 15:59
10 */ 10 */
11 @Mapper 11 @Mapper
12 public interface UserInfoMapper { 12 public interface UserInfoMapper {
13 -  
14 /** 13 /**
15 - * 删除,根据主键 14 + * delete by primary key
16 * 15 *
17 * @param id primaryKey 16 * @param id primaryKey
18 * @return deleteCount 17 * @return deleteCount
@@ -20,7 +19,7 @@ public interface UserInfoMapper { @@ -20,7 +19,7 @@ public interface UserInfoMapper {
20 int deleteByPrimaryKey(String id); 19 int deleteByPrimaryKey(String id);
21 20
22 /** 21 /**
23 - * 新增 22 + * insert record to table
24 * 23 *
25 * @param record the record 24 * @param record the record
26 * @return insert count 25 * @return insert count
@@ -28,7 +27,7 @@ public interface UserInfoMapper { @@ -28,7 +27,7 @@ public interface UserInfoMapper {
28 int insert(UserInfo record); 27 int insert(UserInfo record);
29 28
30 /** 29 /**
31 - * 新增,选择性 30 + * insert record to table selective
32 * 31 *
33 * @param record the record 32 * @param record the record
34 * @return insert count 33 * @return insert count
@@ -36,7 +35,7 @@ public interface UserInfoMapper { @@ -36,7 +35,7 @@ public interface UserInfoMapper {
36 int insertSelective(UserInfo record); 35 int insertSelective(UserInfo record);
37 36
38 /** 37 /**
39 - * 查询,根据主键 38 + * select by primary key
40 * 39 *
41 * @param id primary key 40 * @param id primary key
42 * @return object by primary key 41 * @return object by primary key
@@ -44,7 +43,7 @@ public interface UserInfoMapper { @@ -44,7 +43,7 @@ public interface UserInfoMapper {
44 UserInfo selectByPrimaryKey(String id); 43 UserInfo selectByPrimaryKey(String id);
45 44
46 /** 45 /**
47 - * 更新,选择性,根据主键 46 + * update record selective
48 * 47 *
49 * @param record the updated record 48 * @param record the updated record
50 * @return update count 49 * @return update count
@@ -52,10 +51,17 @@ public interface UserInfoMapper { @@ -52,10 +51,17 @@ public interface UserInfoMapper {
52 int updateByPrimaryKeySelective(UserInfo record); 51 int updateByPrimaryKeySelective(UserInfo record);
53 52
54 /** 53 /**
55 - * 更新,根据主键 54 + * update record
56 * 55 *
57 * @param record the updated record 56 * @param record the updated record
58 * @return update count 57 * @return update count
59 */ 58 */
60 int updateByPrimaryKey(UserInfo record); 59 int updateByPrimaryKey(UserInfo record);
  60 +
  61 + /**
  62 + * 仅,查询用户列表
  63 + *
  64 + * @return 用户信息集合
  65 + */
  66 + List<UserInfo> getUserInfoList();
61 } 67 }
@@ -86,3 +86,4 @@ public interface BusQueueService { @@ -86,3 +86,4 @@ public interface BusQueueService {
86 */ 86 */
87 List<BusQueue> getQueueList(BusQueue busQueue); 87 List<BusQueue> getQueueList(BusQueue busQueue);
88 } 88 }
  89 +
@@ -2,6 +2,8 @@ package com.sunyo.wlpt.message.bus.service.service; @@ -2,6 +2,8 @@ package com.sunyo.wlpt.message.bus.service.service;
2 2
3 import com.sunyo.wlpt.message.bus.service.domain.UserInfo; 3 import com.sunyo.wlpt.message.bus.service.domain.UserInfo;
4 4
  5 +import java.util.List;
  6 +
5 /** 7 /**
6 * @author 子诚 8 * @author 子诚
7 * Description: 9 * Description:
@@ -56,5 +58,14 @@ public interface UserInfoService { @@ -56,5 +58,14 @@ public interface UserInfoService {
56 * @return update count 58 * @return update count
57 */ 59 */
58 int updateByPrimaryKey(UserInfo record); 60 int updateByPrimaryKey(UserInfo record);
  61 +
  62 + /**
  63 + * 仅,查询用户列表
  64 + *
  65 + * @return 用户信息集合
  66 + */
  67 + List<UserInfo> getUserInfoList();
59 } 68 }
60 69
  70 +
  71 +
@@ -5,11 +5,13 @@ import com.github.pagehelper.PageInfo; @@ -5,11 +5,13 @@ import com.github.pagehelper.PageInfo;
5 import com.sunyo.wlpt.message.bus.service.domain.BusQueue; 5 import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
6 import com.sunyo.wlpt.message.bus.service.mapper.BusQueueMapper; 6 import com.sunyo.wlpt.message.bus.service.mapper.BusQueueMapper;
7 import com.sunyo.wlpt.message.bus.service.service.BusQueueService; 7 import com.sunyo.wlpt.message.bus.service.service.BusQueueService;
  8 +import io.netty.util.internal.StringUtil;
8 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
9 import org.springframework.transaction.annotation.Propagation; 10 import org.springframework.transaction.annotation.Propagation;
10 import org.springframework.transaction.annotation.Transactional; 11 import org.springframework.transaction.annotation.Transactional;
11 12
12 import javax.annotation.Resource; 13 import javax.annotation.Resource;
  14 +import java.util.ArrayList;
13 import java.util.List; 15 import java.util.List;
14 16
15 /** 17 /**
@@ -97,7 +99,23 @@ public class BusQueueServiceImpl implements BusQueueService { @@ -97,7 +99,23 @@ public class BusQueueServiceImpl implements BusQueueService {
97 @Override 99 @Override
98 public List<BusQueue> getQueueList(BusQueue busQueue) 100 public List<BusQueue> getQueueList(BusQueue busQueue)
99 { 101 {
  102 + List<BusQueue> list = new ArrayList<>();
  103 + String userIds = busQueue.getUserId();
  104 + String splitItem = ",";
  105 + if(!StringUtil.isNullOrEmpty(userIds)){
  106 + if (userIds.contains(splitItem)) {
  107 + String[] split = userIds.split(splitItem);
  108 + for (String userId : split) {
  109 + busQueue.setUserId(userId);
  110 + List<BusQueue> queueList = busQueueMapper.getQueueList(busQueue);
  111 + if (queueList.size() > 0) {
  112 + list.addAll(queueList);
  113 + }
  114 + }
  115 + return list;
  116 + }
  117 + }
100 return busQueueMapper.getQueueList(busQueue); 118 return busQueueMapper.getQueueList(busQueue);
101 } 119 }
102 -  
103 } 120 }
  121 +
@@ -10,6 +10,7 @@ import org.springframework.transaction.annotation.Propagation; @@ -10,6 +10,7 @@ import org.springframework.transaction.annotation.Propagation;
10 import org.springframework.transaction.annotation.Transactional; 10 import org.springframework.transaction.annotation.Transactional;
11 11
12 import javax.annotation.Resource; 12 import javax.annotation.Resource;
  13 +import java.util.ArrayList;
13 import java.util.List; 14 import java.util.List;
14 15
15 /** 16 /**
@@ -97,7 +98,20 @@ public class RoutingKeyServiceImpl implements RoutingKeyService { @@ -97,7 +98,20 @@ public class RoutingKeyServiceImpl implements RoutingKeyService {
97 @Override 98 @Override
98 public List<RoutingKey> getRoutingKeyList(RoutingKey routingKey) 99 public List<RoutingKey> getRoutingKeyList(RoutingKey routingKey)
99 { 100 {
  101 + List<RoutingKey> list = new ArrayList<>();
  102 + String exchangeIds = routingKey.getExchangeId();
  103 + String splitItem = ",";
  104 + if (exchangeIds.contains(splitItem)) {
  105 + String[] split = exchangeIds.split(splitItem);
  106 + for (int i = 0; i < split.length; i++) {
  107 + routingKey.setExchangeId(split[i]);
  108 + List<RoutingKey> routingKeyList = routingKeyMapper.getRoutingKeyList(routingKey);
  109 + if (routingKeyList.size() > 0) {
  110 + list.addAll(routingKeyList);
  111 + }
  112 + }
  113 + return list;
  114 + }
100 return routingKeyMapper.getRoutingKeyList(routingKey); 115 return routingKeyMapper.getRoutingKeyList(routingKey);
101 } 116 }
102 -  
103 } 117 }
1 package com.sunyo.wlpt.message.bus.service.service.impl; 1 package com.sunyo.wlpt.message.bus.service.service.impl;
2 2
3 -import org.springframework.stereotype.Service;  
4 -import javax.annotation.Resource;  
5 -import com.sunyo.wlpt.message.bus.service.mapper.UserInfoMapper;  
6 import com.sunyo.wlpt.message.bus.service.domain.UserInfo; 3 import com.sunyo.wlpt.message.bus.service.domain.UserInfo;
  4 +import com.sunyo.wlpt.message.bus.service.mapper.UserInfoMapper;
7 import com.sunyo.wlpt.message.bus.service.service.UserInfoService; 5 import com.sunyo.wlpt.message.bus.service.service.UserInfoService;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +import javax.annotation.Resource;
  9 +import java.util.List;
8 10
9 /** 11 /**
10 * @author 子诚 12 * @author 子诚
@@ -18,34 +20,48 @@ public class UserInfoServiceImpl implements UserInfoService { @@ -18,34 +20,48 @@ public class UserInfoServiceImpl implements UserInfoService {
18 private UserInfoMapper userInfoMapper; 20 private UserInfoMapper userInfoMapper;
19 21
20 @Override 22 @Override
21 - public int deleteByPrimaryKey(String id) { 23 + public int deleteByPrimaryKey(String id)
  24 + {
22 return userInfoMapper.deleteByPrimaryKey(id); 25 return userInfoMapper.deleteByPrimaryKey(id);
23 } 26 }
24 27
25 @Override 28 @Override
26 - public int insert(UserInfo record) { 29 + public int insert(UserInfo record)
  30 + {
27 return userInfoMapper.insert(record); 31 return userInfoMapper.insert(record);
28 } 32 }
29 33
30 @Override 34 @Override
31 - public int insertSelective(UserInfo record) { 35 + public int insertSelective(UserInfo record)
  36 + {
32 return userInfoMapper.insertSelective(record); 37 return userInfoMapper.insertSelective(record);
33 } 38 }
34 39
35 @Override 40 @Override
36 - public UserInfo selectByPrimaryKey(String id) { 41 + public UserInfo selectByPrimaryKey(String id)
  42 + {
37 return userInfoMapper.selectByPrimaryKey(id); 43 return userInfoMapper.selectByPrimaryKey(id);
38 } 44 }
39 45
40 @Override 46 @Override
41 - public int updateByPrimaryKeySelective(UserInfo record) { 47 + public int updateByPrimaryKeySelective(UserInfo record)
  48 + {
42 return userInfoMapper.updateByPrimaryKeySelective(record); 49 return userInfoMapper.updateByPrimaryKeySelective(record);
43 } 50 }
44 51
45 @Override 52 @Override
46 - public int updateByPrimaryKey(UserInfo record) { 53 + public int updateByPrimaryKey(UserInfo record)
  54 + {
47 return userInfoMapper.updateByPrimaryKey(record); 55 return userInfoMapper.updateByPrimaryKey(record);
48 } 56 }
49 57
  58 + @Override
  59 + public List<UserInfo> getUserInfoList()
  60 + {
  61 + return userInfoMapper.getUserInfoList();
  62 + }
  63 +
50 } 64 }
51 65
  66 +
  67 +
@@ -22,6 +22,9 @@ import java.util.List; @@ -22,6 +22,9 @@ import java.util.List;
22 public class UserMessageBindingServiceImpl implements UserMessageBindingService { 22 public class UserMessageBindingServiceImpl implements UserMessageBindingService {
23 23
24 @Resource 24 @Resource
  25 + private UserInfoService userInfoService;
  26 +
  27 + @Resource
25 private BusServerService busServerService; 28 private BusServerService busServerService;
26 29
27 @Resource 30 @Resource
@@ -82,25 +85,214 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService @@ -82,25 +85,214 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService
82 { 85 {
83 int index = 0; 86 int index = 0;
84 String queueId = userMessageBinding.getQueueId(); 87 String queueId = userMessageBinding.getQueueId();
  88 + String exchangeId = userMessageBinding.getExchangeId();
  89 + String routingKeyId = userMessageBinding.getRoutingKeyId();
  90 + String userId = userMessageBinding.getUserId();
85 String splitItem = ","; 91 String splitItem = ",";
  92 +
  93 + // 循环最外层,userId
  94 + if (userId.contains(splitItem)) {
  95 + String[] split_userId = userId.split(splitItem);
  96 + for (int i = 0; i < split_userId.length; i++) {
  97 + // 循环第二层,exchangeId
  98 + if (exchangeId.contains(splitItem)) {
  99 + String[] split_exchangeId = exchangeId.split(splitItem);
  100 + for (int j = 0; j < split_exchangeId.length; j++) {
  101 + // 循环第三层,routingKeyId
  102 + if (routingKeyId.contains(splitItem)) {
  103 + String[] split_routingKeyId = routingKeyId.split(splitItem);
  104 + for (int k = 0; k < split_routingKeyId.length; k++) {
  105 + // 循环第四层,queueId
86 if (queueId.contains(splitItem)) { 106 if (queueId.contains(splitItem)) {
87 - String[] split = queueId.split(splitItem);  
88 - for (int i = 0; i < split.length; i++) {  
89 - // 设置id  
90 - userMessageBinding.setId(IdUtils.generateId());  
91 - userMessageBinding.setQueueId(split[i]); 107 + String[] split_queueId = queueId.split(splitItem);
  108 + for (int l = 0; l < split_queueId.length; l++) {
  109 + userMessageBinding.setUserId(split_userId[i]);
  110 + userMessageBinding.setExchangeId(split_exchangeId[j]);
  111 + userMessageBinding.setRoutingKeyId(split_routingKeyId[k]);
  112 + userMessageBinding.setQueueId(split_queueId[l]);
92 int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); 113 int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
93 if (num > 0) { 114 if (num > 0) {
94 index = index + num; 115 index = index + num;
95 } 116 }
96 } 117 }
97 - if (index == split.length) {  
98 - return 1;  
99 } else { 118 } else {
100 - return 0; 119 + userMessageBinding.setUserId(split_userId[i]);
  120 + userMessageBinding.setExchangeId(split_exchangeId[j]);
  121 + userMessageBinding.setRoutingKeyId(split_routingKeyId[k]);
  122 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  123 + if (num > 0) {
  124 + index = index + num;
101 } 125 }
102 } 126 }
103 - return userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding)); 127 + }
  128 + } else {
  129 + // 循环第四层,queueId
  130 + if (queueId.contains(splitItem)) {
  131 + String[] split_queueId = queueId.split(splitItem);
  132 + for (int l = 0; l < split_queueId.length; l++) {
  133 + userMessageBinding.setUserId(split_userId[i]);
  134 + userMessageBinding.setExchangeId(split_exchangeId[j]);
  135 + userMessageBinding.setQueueId(split_queueId[l]);
  136 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  137 + if (num > 0) {
  138 + index = index + num;
  139 + }
  140 + }
  141 + } else {
  142 + userMessageBinding.setUserId(split_userId[i]);
  143 + userMessageBinding.setExchangeId(split_exchangeId[j]);
  144 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  145 + if (num > 0) {
  146 + index = index + num;
  147 + }
  148 +
  149 + }
  150 + }
  151 + }
  152 + } else {
  153 + // 循环第三层,routingKeyId
  154 + if (routingKeyId.contains(splitItem)) {
  155 + String[] split_routingKeyId = routingKeyId.split(splitItem);
  156 + for (int k = 0; k < split_routingKeyId.length; k++) {
  157 + // 循环第四层,queueId
  158 + if (queueId.contains(splitItem)) {
  159 + String[] split_queueId = queueId.split(splitItem);
  160 + for (int l = 0; l < split_queueId.length; l++) {
  161 + userMessageBinding.setUserId(split_userId[i]);
  162 + userMessageBinding.setRoutingKeyId(split_routingKeyId[k]);
  163 + userMessageBinding.setQueueId(split_queueId[l]);
  164 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  165 + if (num > 0) {
  166 + index = index + num;
  167 + }
  168 + }
  169 + } else {
  170 + userMessageBinding.setUserId(split_userId[i]);
  171 + userMessageBinding.setRoutingKeyId(split_routingKeyId[k]);
  172 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  173 + if (num > 0) {
  174 + index = index + num;
  175 + }
  176 + }
  177 + }
  178 + } else {
  179 + // 循环第四层,queueId
  180 + if (queueId.contains(splitItem)) {
  181 + String[] split_queueId = queueId.split(splitItem);
  182 + for (int l = 0; l < split_queueId.length; l++) {
  183 + userMessageBinding.setUserId(split_userId[i]);
  184 + userMessageBinding.setQueueId(split_queueId[l]);
  185 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  186 + if (num > 0) {
  187 + index = index + num;
  188 + }
  189 + }
  190 + } else {
  191 + userMessageBinding.setUserId(split_userId[i]);
  192 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  193 + if (num > 0) {
  194 + index = index + num;
  195 + }
  196 + }
  197 + }
  198 + }
  199 + }
  200 + } else {
  201 + // 循环第二层,exchangeId
  202 + if (exchangeId.contains(splitItem)) {
  203 + String[] split_exchangeId = exchangeId.split(splitItem);
  204 + for (int j = 0; j < split_exchangeId.length; j++) {
  205 + // 循环第三层,routingKeyId
  206 + if (routingKeyId.contains(splitItem)) {
  207 + String[] split_routingKeyId = routingKeyId.split(splitItem);
  208 + for (int k = 0; k < split_routingKeyId.length; k++) {
  209 + // 循环第四层,queueId
  210 + if (queueId.contains(splitItem)) {
  211 + String[] split_queueId = queueId.split(splitItem);
  212 + for (int l = 0; l < split_queueId.length; l++) {
  213 + userMessageBinding.setExchangeId(split_exchangeId[j]);
  214 + userMessageBinding.setRoutingKeyId(split_routingKeyId[k]);
  215 + userMessageBinding.setQueueId(split_queueId[l]);
  216 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  217 + if (num > 0) {
  218 + index = index + num;
  219 + }
  220 + }
  221 + } else {
  222 + userMessageBinding.setExchangeId(split_exchangeId[j]);
  223 + userMessageBinding.setRoutingKeyId(split_routingKeyId[k]);
  224 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  225 + if (num > 0) {
  226 + index = index + num;
  227 + }
  228 + }
  229 + }
  230 + } else {
  231 + // 循环第四层,queueId
  232 + if (queueId.contains(splitItem)) {
  233 + String[] split_queueId = queueId.split(splitItem);
  234 + for (int l = 0; l < split_queueId.length; l++) {
  235 + userMessageBinding.setExchangeId(split_exchangeId[j]);
  236 + userMessageBinding.setQueueId(split_queueId[l]);
  237 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  238 + if (num > 0) {
  239 + index = index + num;
  240 + }
  241 + }
  242 + } else {
  243 + userMessageBinding.setExchangeId(split_exchangeId[j]);
  244 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  245 + if (num > 0) {
  246 + index = index + num;
  247 + }
  248 + }
  249 + }
  250 + }
  251 + } else {
  252 + // 循环第三层,routingKeyId
  253 + if (routingKeyId.contains(splitItem)) {
  254 + String[] split_routingKeyId = routingKeyId.split(splitItem);
  255 + for (int k = 0; k < split_routingKeyId.length; k++) {
  256 + // 循环第四层,queueId
  257 + if (queueId.contains(splitItem)) {
  258 + String[] split_queueId = queueId.split(splitItem);
  259 + for (int l = 0; l < split_queueId.length; l++) {
  260 + userMessageBinding.setRoutingKeyId(split_routingKeyId[k]);
  261 + userMessageBinding.setQueueId(split_queueId[l]);
  262 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  263 + if (num > 0) {
  264 + index = index + num;
  265 + }
  266 + }
  267 + } else {
  268 + userMessageBinding.setRoutingKeyId(split_routingKeyId[k]);
  269 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  270 + if (num > 0) {
  271 + index = index + num;
  272 + }
  273 + }
  274 + }
  275 + } else {
  276 + // 循环第四层,queueId
  277 + if (queueId.contains(splitItem)) {
  278 + String[] split_queueId = queueId.split(splitItem);
  279 + for (int l = 0; l < split_queueId.length; l++) {
  280 + userMessageBinding.setQueueId(split_queueId[l]);
  281 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  282 + if (num > 0) {
  283 + index = index + num;
  284 + }
  285 + }
  286 + } else {
  287 + int num = userMessageBindingMapper.insertSelective(umb_fillName(userMessageBinding));
  288 + if (num > 0) {
  289 + index = index + num;
  290 + }
  291 + }
  292 + }
  293 + }
  294 + }
  295 + return index;
104 } 296 }
105 297
106 @Override 298 @Override
@@ -136,6 +328,13 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService @@ -136,6 +328,13 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService
136 */ 328 */
137 public UserMessageBinding umb_fillName(UserMessageBinding userMessageBinding) 329 public UserMessageBinding umb_fillName(UserMessageBinding userMessageBinding)
138 { 330 {
  331 + // 增加之设置id
  332 + userMessageBinding.setId(IdUtils.generateId());
  333 +
  334 + // 填充,用户名称
  335 + UserInfo userInfo = userInfoService.selectByPrimaryKey(userMessageBinding.getUserId());
  336 + userMessageBinding.setUsername(userInfo.getUsername());
  337 +
139 // 填充,服务器名称 338 // 填充,服务器名称
140 BusServer busServer = busServerService.selectByPrimaryKey(userMessageBinding.getServerId()); 339 BusServer busServer = busServerService.selectByPrimaryKey(userMessageBinding.getServerId());
141 userMessageBinding.setServerName(busServer.getServerName()); 340 userMessageBinding.setServerName(busServer.getServerName());
@@ -158,7 +357,6 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService @@ -158,7 +357,6 @@ public class UserMessageBindingServiceImpl implements UserMessageBindingService
158 357
159 return userMessageBinding; 358 return userMessageBinding;
160 } 359 }
161 -  
162 } 360 }
163 361
164 362
@@ -4,83 +4,30 @@ @@ -4,83 +4,30 @@
4 <resultMap id="BaseResultMap" type="com.sunyo.wlpt.message.bus.service.domain.BusQueue"> 4 <resultMap id="BaseResultMap" type="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
5 <!--@mbg.generated--> 5 <!--@mbg.generated-->
6 <!--@Table bus_queue--> 6 <!--@Table bus_queue-->
7 - <id column="id" jdbcType="VARCHAR" property="id"/>  
8 - <result column="queue_name" jdbcType="VARCHAR" property="queueName"/>  
9 - <result column="virtual_host_id" jdbcType="VARCHAR" property="virtualHostId"/>  
10 - <result column="durability" jdbcType="BOOLEAN" property="durability"/>  
11 - <result column="auto_delete" jdbcType="BOOLEAN" property="autoDelete"/>  
12 - <result column="arguments" jdbcType="VARCHAR" property="arguments"/>  
13 - <result column="description" jdbcType="VARCHAR" property="description"/>  
14 - <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>  
15 - <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/>  
16 - </resultMap>  
17 -  
18 - <!-- 该Mapper映射关系的作用,是队列与虚拟主机的1:1的关系映射 -->  
19 - <resultMap id="QueueAndHostMap" extends="BaseResultMap"  
20 - type="com.sunyo.wlpt.message.bus.service.domain.BusQueue">  
21 - <association property="virtualHost" javaType="com.sunyo.wlpt.message.bus.service.domain.VirtualHost">  
22 - <id column="id" property="id"></id>  
23 - <result column="virtual_host_name" property="virtualHostName"/>  
24 - </association> 7 + <id column="id" jdbcType="VARCHAR" property="id" />
  8 + <result column="queue_name" jdbcType="VARCHAR" property="queueName" />
  9 + <result column="user_id" jdbcType="VARCHAR" property="userId" />
  10 + <result column="username" jdbcType="VARCHAR" property="username" />
  11 + <result column="virtual_host_id" jdbcType="VARCHAR" property="virtualHostId" />
  12 + <result column="durability" jdbcType="BOOLEAN" property="durability" />
  13 + <result column="auto_delete" jdbcType="BOOLEAN" property="autoDelete" />
  14 + <result column="arguments" jdbcType="VARCHAR" property="arguments" />
  15 + <result column="description" jdbcType="VARCHAR" property="description" />
  16 + <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
  17 + <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
25 </resultMap> 18 </resultMap>
26 <sql id="Base_Column_List"> 19 <sql id="Base_Column_List">
27 <!--@mbg.generated--> 20 <!--@mbg.generated-->
28 - id, queue_name, virtual_host_id, durability, auto_delete, arguments, description,  
29 - gmt_create, gmt_modified 21 + id, queue_name, user_id, username, virtual_host_id, durability, auto_delete, arguments,
  22 + description, gmt_create, gmt_modified
30 </sql> 23 </sql>
31 <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> 24 <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
32 <!--@mbg.generated--> 25 <!--@mbg.generated-->
33 select 26 select
34 - <include refid="Base_Column_List"/> 27 + <include refid="Base_Column_List" />
35 from bus_queue 28 from bus_queue
36 where id = #{id,jdbcType=VARCHAR} 29 where id = #{id,jdbcType=VARCHAR}
37 </select> 30 </select>
38 - <!-- 获取消息队列,列表 -->  
39 - <select id="selectBusQueueList" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue"  
40 - resultMap="QueueAndHostMap">  
41 - select  
42 - q.id, q.queue_name, q.virtual_host_id, q.durability, q.auto_delete, q.arguments, q.description,  
43 - q.gmt_create, q.gmt_modified,v.virtual_host_name  
44 - from bus_queue as q,virtual_host v  
45 - <where>  
46 - <!-- 所属虚拟主机Id -->  
47 - <if test="virtualHostId != null and virtualHostId !=''">  
48 - virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}  
49 - </if>  
50 - <!-- 消息队列名称 -->  
51 - <if test="queueName != null and queueName !=''">  
52 - and queue_name = #{queueName,jdbcType=VARCHAR}  
53 - </if>  
54 - and v.id = q.virtual_host_id  
55 - </where>  
56 - </select>  
57 - <!-- 校验消息队列是否已存在-->  
58 - <select id="validateBusQueue" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue"  
59 - resultMap="BaseResultMap">  
60 - select  
61 - <include refid="Base_Column_List"/>  
62 - from bus_queue  
63 - <where>  
64 - <!-- 消息队列名称 -->  
65 - <if test="queueName != null and queueName !=''">  
66 - queue_name = #{queueName,jdbcType=VARCHAR}  
67 - </if>  
68 - </where>  
69 - </select>  
70 -  
71 - <!-- 仅,查询队列列表 -->  
72 - <select id="getQueueList" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue"  
73 - resultMap="BaseResultMap">  
74 - select  
75 - <include refid="Base_Column_List"/>  
76 - from bus_queue  
77 - <where>  
78 - <!-- 所属虚拟主机Id -->  
79 - <if test="virtualHostId != null and virtualHostId !=''">  
80 - virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}  
81 - </if>  
82 - </where>  
83 - </select>  
84 <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> 31 <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
85 <!--@mbg.generated--> 32 <!--@mbg.generated-->
86 delete from bus_queue 33 delete from bus_queue
@@ -88,14 +35,14 @@ @@ -88,14 +35,14 @@
88 </delete> 35 </delete>
89 <insert id="insert" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue"> 36 <insert id="insert" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
90 <!--@mbg.generated--> 37 <!--@mbg.generated-->
91 - insert into bus_queue (id, queue_name, virtual_host_id,  
92 - durability, auto_delete, arguments,  
93 - description, gmt_create, gmt_modified  
94 - )  
95 - values (#{id,jdbcType=VARCHAR}, #{queueName,jdbcType=VARCHAR}, #{virtualHostId,jdbcType=VARCHAR},  
96 - #{durability,jdbcType=BOOLEAN}, #{autoDelete,jdbcType=BOOLEAN}, #{arguments,jdbcType=VARCHAR},  
97 - #{description,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}  
98 - ) 38 + insert into bus_queue (id, queue_name, user_id,
  39 + username, virtual_host_id, durability,
  40 + auto_delete, arguments, description,
  41 + gmt_create, gmt_modified)
  42 + values (#{id,jdbcType=VARCHAR}, #{queueName,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR},
  43 + #{username,jdbcType=VARCHAR}, #{virtualHostId,jdbcType=VARCHAR}, #{durability,jdbcType=BOOLEAN},
  44 + #{autoDelete,jdbcType=BOOLEAN}, #{arguments,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
  45 + #{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})
99 </insert> 46 </insert>
100 <insert id="insertSelective" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue"> 47 <insert id="insertSelective" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
101 <!--@mbg.generated--> 48 <!--@mbg.generated-->
@@ -107,6 +54,12 @@ @@ -107,6 +54,12 @@
107 <if test="queueName != null"> 54 <if test="queueName != null">
108 queue_name, 55 queue_name,
109 </if> 56 </if>
  57 + <if test="userId != null">
  58 + user_id,
  59 + </if>
  60 + <if test="username != null">
  61 + username,
  62 + </if>
110 <if test="virtualHostId != null"> 63 <if test="virtualHostId != null">
111 virtual_host_id, 64 virtual_host_id,
112 </if> 65 </if>
@@ -136,6 +89,12 @@ @@ -136,6 +89,12 @@
136 <if test="queueName != null"> 89 <if test="queueName != null">
137 #{queueName,jdbcType=VARCHAR}, 90 #{queueName,jdbcType=VARCHAR},
138 </if> 91 </if>
  92 + <if test="userId != null">
  93 + #{userId,jdbcType=VARCHAR},
  94 + </if>
  95 + <if test="username != null">
  96 + #{username,jdbcType=VARCHAR},
  97 + </if>
139 <if test="virtualHostId != null"> 98 <if test="virtualHostId != null">
140 #{virtualHostId,jdbcType=VARCHAR}, 99 #{virtualHostId,jdbcType=VARCHAR},
141 </if> 100 </if>
@@ -166,6 +125,12 @@ @@ -166,6 +125,12 @@
166 <if test="queueName != null"> 125 <if test="queueName != null">
167 queue_name = #{queueName,jdbcType=VARCHAR}, 126 queue_name = #{queueName,jdbcType=VARCHAR},
168 </if> 127 </if>
  128 + <if test="userId != null">
  129 + user_id = #{userId,jdbcType=VARCHAR},
  130 + </if>
  131 + <if test="username != null">
  132 + username = #{username,jdbcType=VARCHAR},
  133 + </if>
169 <if test="virtualHostId != null"> 134 <if test="virtualHostId != null">
170 virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}, 135 virtual_host_id = #{virtualHostId,jdbcType=VARCHAR},
171 </if> 136 </if>
@@ -194,6 +159,8 @@ @@ -194,6 +159,8 @@
194 <!--@mbg.generated--> 159 <!--@mbg.generated-->
195 update bus_queue 160 update bus_queue
196 set queue_name = #{queueName,jdbcType=VARCHAR}, 161 set queue_name = #{queueName,jdbcType=VARCHAR},
  162 + user_id = #{userId,jdbcType=VARCHAR},
  163 + username = #{username,jdbcType=VARCHAR},
197 virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}, 164 virtual_host_id = #{virtualHostId,jdbcType=VARCHAR},
198 durability = #{durability,jdbcType=BOOLEAN}, 165 durability = #{durability,jdbcType=BOOLEAN},
199 auto_delete = #{autoDelete,jdbcType=BOOLEAN}, 166 auto_delete = #{autoDelete,jdbcType=BOOLEAN},
@@ -204,4 +171,58 @@ @@ -204,4 +171,58 @@
204 where id = #{id,jdbcType=VARCHAR} 171 where id = #{id,jdbcType=VARCHAR}
205 </update> 172 </update>
206 173
  174 + <!-- 该Mapper映射关系的作用,是队列与虚拟主机的1:1的关系映射 -->
  175 + <resultMap extends="BaseResultMap" id="QueueAndHostMap" type="com.sunyo.wlpt.message.bus.service.domain.BusQueue">
  176 + <association javaType="com.sunyo.wlpt.message.bus.service.domain.VirtualHost" property="virtualHost">
  177 + <id column="id" property="id" />
  178 + <result column="virtual_host_name" property="virtualHostName" />
  179 + </association>
  180 + </resultMap>
  181 + <!-- 获取消息队列,列表 -->
  182 + <select id="selectBusQueueList" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue" resultMap="QueueAndHostMap">
  183 + select
  184 + q.id, q.queue_name, q.virtual_host_id, q.durability, q.auto_delete, q.arguments, q.description,q.user_id,q.username,
  185 + q.gmt_create, q.gmt_modified,v.virtual_host_name
  186 + from bus_queue as q,virtual_host v
  187 + <where>
  188 + <!-- 所属虚拟主机Id -->
  189 + <if test="virtualHostId != null and virtualHostId !=''">
  190 + virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}
  191 + </if>
  192 + <!-- 消息队列名称 -->
  193 + <if test="queueName != null and queueName !=''">
  194 + and queue_name = #{queueName,jdbcType=VARCHAR}
  195 + </if>
  196 + and v.id = q.virtual_host_id
  197 + </where>
  198 + </select>
  199 + <!-- 校验消息队列是否已存在-->
  200 + <select id="validateBusQueue" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue" resultMap="BaseResultMap">
  201 + select
  202 + <include refid="Base_Column_List" />
  203 + from bus_queue
  204 + <where>
  205 + <!-- 消息队列名称 -->
  206 + <if test="queueName != null and queueName !=''">
  207 + queue_name = #{queueName,jdbcType=VARCHAR}
  208 + </if>
  209 + </where>
  210 + </select>
  211 +
  212 + <!-- 仅,查询队列列表 -->
  213 + <select id="getQueueList" parameterType="com.sunyo.wlpt.message.bus.service.domain.BusQueue" resultMap="BaseResultMap">
  214 + select
  215 + <include refid="Base_Column_List" />
  216 + from bus_queue
  217 + <where>
  218 + <!-- 所属虚拟主机Id -->
  219 + <if test="virtualHostId != null and virtualHostId !=''">
  220 + virtual_host_id = #{virtualHostId,jdbcType=VARCHAR}
  221 + </if>
  222 + <if test="userId != null and userId !=''">
  223 + and user_id = #{userId,jdbcType=VARCHAR}
  224 + </if>
  225 + </where>
  226 + </select>
  227 +
207 </mapper> 228 </mapper>
@@ -4,12 +4,12 @@ @@ -4,12 +4,12 @@
4 <resultMap id="BaseResultMap" type="com.sunyo.wlpt.message.bus.service.domain.UserInfo"> 4 <resultMap id="BaseResultMap" type="com.sunyo.wlpt.message.bus.service.domain.UserInfo">
5 <!--@mbg.generated--> 5 <!--@mbg.generated-->
6 <!--@Table user_info--> 6 <!--@Table user_info-->
7 - <id column="id" jdbcType="VARCHAR" property="id"/>  
8 - <result column="username" jdbcType="VARCHAR" property="username"/>  
9 - <result column="password" jdbcType="VARCHAR" property="password"/>  
10 - <result column="description" jdbcType="VARCHAR" property="description"/>  
11 - <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>  
12 - <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/> 7 + <id column="id" jdbcType="VARCHAR" property="id" />
  8 + <result column="username" jdbcType="VARCHAR" property="username" />
  9 + <result column="password" jdbcType="VARCHAR" property="password" />
  10 + <result column="description" jdbcType="VARCHAR" property="description" />
  11 + <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
  12 + <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
13 </resultMap> 13 </resultMap>
14 <sql id="Base_Column_List"> 14 <sql id="Base_Column_List">
15 <!--@mbg.generated--> 15 <!--@mbg.generated-->
@@ -18,10 +18,18 @@ @@ -18,10 +18,18 @@
18 <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap"> 18 <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
19 <!--@mbg.generated--> 19 <!--@mbg.generated-->
20 select 20 select
21 - <include refid="Base_Column_List"/> 21 + <include refid="Base_Column_List" />
22 from user_info 22 from user_info
23 where id = #{id,jdbcType=VARCHAR} 23 where id = #{id,jdbcType=VARCHAR}
24 </select> 24 </select>
  25 +
  26 + <select id="getUserInfoList" resultMap="BaseResultMap">
  27 + <!--@mbg.generated-->
  28 + select
  29 + id, username, description, gmt_create, gmt_modified
  30 + from user_info
  31 + </select>
  32 +
25 <delete id="deleteByPrimaryKey" parameterType="java.lang.String"> 33 <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
26 <!--@mbg.generated--> 34 <!--@mbg.generated-->
27 delete from user_info 35 delete from user_info
@@ -244,7 +244,10 @@ @@ -244,7 +244,10 @@
244 <!-- 查询列表,选择性 --> 244 <!-- 查询列表,选择性 -->
245 <select id="selectUserMessageBindingList" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding" resultMap="BaseResultMap"> 245 <select id="selectUserMessageBindingList" parameterType="com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding" resultMap="BaseResultMap">
246 select 246 select
247 - <include refid="Base_Column_List" /> 247 + user_id, username, server_id, `server_name`, virtual_host_id, virtual_host_name,
  248 + exchange_id, exchange_name, routing_key_id, routing_key_name,
  249 + GROUP_CONCAT(id) as id, GROUP_CONCAT(queue_id) as queue_id, GROUP_CONCAT(queue_name) as queue_name,
  250 + GROUP_CONCAT(description) as description
248 from user_message_binding 251 from user_message_binding
249 <where> 252 <where>
250 <!-- 所属用户登陆名称 --> 253 <!-- 所属用户登陆名称 -->
@@ -272,10 +275,12 @@ @@ -272,10 +275,12 @@
272 AND routing_key_name = #{routingKeyName,jdbcType=VARCHAR} 275 AND routing_key_name = #{routingKeyName,jdbcType=VARCHAR}
273 </if> 276 </if>
274 <!-- 订阅者 --> 277 <!-- 订阅者 -->
275 - <if test="subscriber != null and subscriber !=''">  
276 - AND subscriber = #{subscriber,jdbcType=VARCHAR}  
277 - </if> 278 +<!-- <if test="subscriber != null and subscriber !=''">-->
  279 +<!-- AND subscriber = #{subscriber,jdbcType=VARCHAR}-->
  280 +<!-- </if>-->
278 </where> 281 </where>
  282 + group by user_id, username, server_id, `server_name`, virtual_host_id, virtual_host_name,
  283 + exchange_id, exchange_name, routing_key_id, routing_key_name
279 </select> 284 </select>
280 285
281 </mapper> 286 </mapper>