正在显示
5 个修改的文件
包含
40 行增加
和
4 行删除
@@ -26,6 +26,7 @@ public class RoutingKeyController { | @@ -26,6 +26,7 @@ public class RoutingKeyController { | ||
26 | /** | 26 | /** |
27 | * 分页查询,路由键列表 | 27 | * 分页查询,路由键列表 |
28 | * | 28 | * |
29 | + * @param exchangeId 所属虚拟机ID | ||
29 | * @param routingKeyName 路由键名称 | 30 | * @param routingKeyName 路由键名称 |
30 | * @param pageNum 当前页数 | 31 | * @param pageNum 当前页数 |
31 | * @param pageSize 每页数量 | 32 | * @param pageSize 每页数量 |
@@ -33,12 +34,15 @@ public class RoutingKeyController { | @@ -33,12 +34,15 @@ public class RoutingKeyController { | ||
33 | */ | 34 | */ |
34 | @GetMapping("/list") | 35 | @GetMapping("/list") |
35 | public ResultJson<PageInfo> selectRoutingKeyList( | 36 | public ResultJson<PageInfo> selectRoutingKeyList( |
37 | + @RequestParam(value = "exchangeId", required = false) String exchangeId, | ||
36 | @RequestParam(value = "routingKeyName", required = false) String routingKeyName, | 38 | @RequestParam(value = "routingKeyName", required = false) String routingKeyName, |
37 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, | 39 | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, |
38 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { | 40 | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
39 | ResultJson<PageInfo> result = new ResultJson<>(); | 41 | ResultJson<PageInfo> result = new ResultJson<>(); |
40 | 42 | ||
41 | RoutingKey routingKey = new RoutingKey(); | 43 | RoutingKey routingKey = new RoutingKey(); |
44 | + // 获取参数,虚拟机id | ||
45 | + routingKey.setExchangeId(exchangeId); | ||
42 | // 获取参数,路由键名称 | 46 | // 获取参数,路由键名称 |
43 | routingKey.setRoutingKeyName(routingKeyName); | 47 | routingKey.setRoutingKeyName(routingKeyName); |
44 | // 分页查询 | 48 | // 分页查询 |
@@ -37,7 +37,7 @@ public class BusExchange implements Serializable { | @@ -37,7 +37,7 @@ public class BusExchange implements Serializable { | ||
37 | private String virtualHostId; | 37 | private String virtualHostId; |
38 | 38 | ||
39 | /** | 39 | /** |
40 | - * 交换机类型:Direct exchange、Fanout exchange、Topic exchange、Headers exchange | 40 | + * 交换机类型:Direct、Fanout、Topic、Headers |
41 | */ | 41 | */ |
42 | private String exchangeType; | 42 | private String exchangeType; |
43 | 43 | ||
@@ -79,4 +79,9 @@ public class BusExchange implements Serializable { | @@ -79,4 +79,9 @@ public class BusExchange implements Serializable { | ||
79 | private Date gmtModified; | 79 | private Date gmtModified; |
80 | 80 | ||
81 | private VirtualHost virtualHost; | 81 | private VirtualHost virtualHost; |
82 | + | ||
83 | + /** | ||
84 | + * 交换机名称的别名 | ||
85 | + */ | ||
86 | + private String aliasName; | ||
82 | } | 87 | } |
@@ -51,4 +51,14 @@ public class RoutingKey implements Serializable { | @@ -51,4 +51,14 @@ public class RoutingKey implements Serializable { | ||
51 | */ | 51 | */ |
52 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | 52 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
53 | private Date gmtModified; | 53 | private Date gmtModified; |
54 | + | ||
55 | + /** | ||
56 | + * 路由键名称的别名 | ||
57 | + */ | ||
58 | + private String aliasName; | ||
59 | + | ||
60 | + /** | ||
61 | + * 一个路由键对应一个交换机 | ||
62 | + */ | ||
63 | + private BusExchange busExchange; | ||
54 | } | 64 | } |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | <!--@Table bus_exchange--> | 6 | <!--@Table bus_exchange--> |
7 | <id column="id" jdbcType="VARCHAR" property="id"/> | 7 | <id column="id" jdbcType="VARCHAR" property="id"/> |
8 | <result column="exchange_name" jdbcType="VARCHAR" property="exchangeName"/> | 8 | <result column="exchange_name" jdbcType="VARCHAR" property="exchangeName"/> |
9 | + <result column="exchange_name" jdbcType="VARCHAR" property="aliasName"/> | ||
9 | <result column="virtual_host_id" jdbcType="VARCHAR" property="virtualHostId"/> | 10 | <result column="virtual_host_id" jdbcType="VARCHAR" property="virtualHostId"/> |
10 | <result column="exchange_type" jdbcType="VARCHAR" property="exchangeType"/> | 11 | <result column="exchange_type" jdbcType="VARCHAR" property="exchangeType"/> |
11 | <result column="durability" jdbcType="BOOLEAN" property="durability"/> | 12 | <result column="durability" jdbcType="BOOLEAN" property="durability"/> |
@@ -6,11 +6,22 @@ | @@ -6,11 +6,22 @@ | ||
6 | <!--@Table routing_key--> | 6 | <!--@Table routing_key--> |
7 | <id column="id" jdbcType="VARCHAR" property="id"/> | 7 | <id column="id" jdbcType="VARCHAR" property="id"/> |
8 | <result column="routing_key_name" jdbcType="VARCHAR" property="routingKeyName"/> | 8 | <result column="routing_key_name" jdbcType="VARCHAR" property="routingKeyName"/> |
9 | + <result column="routing_key_name" jdbcType="VARCHAR" property="aliasName"/> | ||
9 | <result column="exchange_id" jdbcType="VARCHAR" property="exchangeId"/> | 10 | <result column="exchange_id" jdbcType="VARCHAR" property="exchangeId"/> |
10 | <result column="description" jdbcType="VARCHAR" property="description"/> | 11 | <result column="description" jdbcType="VARCHAR" property="description"/> |
11 | <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/> | 12 | <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/> |
12 | <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/> | 13 | <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/> |
13 | </resultMap> | 14 | </resultMap> |
15 | + | ||
16 | + <!-- 该Mapper映射关系的作用,是 路由键 与 交换机 的 1:1 的关系映射 --> | ||
17 | + <resultMap id="RoutingKeyAndExchangeMap" extends="BaseResultMap" | ||
18 | + type="com.sunyo.wlpt.message.bus.service.domain.RoutingKey"> | ||
19 | + <association property="busExchange" javaType="com.sunyo.wlpt.message.bus.service.domain.BusExchange"> | ||
20 | + <id column="id" property="id"></id> | ||
21 | + <result column="exchange_name" property="exchangeName"/> | ||
22 | + </association> | ||
23 | + </resultMap> | ||
24 | + | ||
14 | <sql id="Base_Column_List"> | 25 | <sql id="Base_Column_List"> |
15 | <!--@mbg.generated--> | 26 | <!--@mbg.generated--> |
16 | id, routing_key_name, exchange_id, description, gmt_create, gmt_modified | 27 | id, routing_key_name, exchange_id, description, gmt_create, gmt_modified |
@@ -27,13 +38,18 @@ | @@ -27,13 +38,18 @@ | ||
27 | <select id="selectRoutingKeyList" parameterType="com.sunyo.wlpt.message.bus.service.domain.RoutingKey" | 38 | <select id="selectRoutingKeyList" parameterType="com.sunyo.wlpt.message.bus.service.domain.RoutingKey" |
28 | resultMap="BaseResultMap"> | 39 | resultMap="BaseResultMap"> |
29 | select | 40 | select |
30 | - <include refid="Base_Column_List"/> | ||
31 | - from routing_key | 41 | + r.id, r.routing_key_name, r.exchange_id, r.description, r.gmt_create, r.gmt_modified, e.exchange_name |
42 | + from routing_key as r,bus_exchange as e | ||
32 | <where> | 43 | <where> |
44 | + <!-- 所属交换机ID --> | ||
45 | + <if test="exchangeId != null and exchangeId !=''"> | ||
46 | + exchange_id = #{exchangeId,jdbcType=VARCHAR} | ||
47 | + </if> | ||
33 | <!-- 路由键名称 --> | 48 | <!-- 路由键名称 --> |
34 | <if test="routingKeyName != null and routingKeyName !=''"> | 49 | <if test="routingKeyName != null and routingKeyName !=''"> |
35 | - routing_key_name = #{routingKeyName,jdbcType=VARCHAR} | 50 | + and routing_key_name = #{routingKeyName,jdbcType=VARCHAR} |
36 | </if> | 51 | </if> |
52 | + and r.exchange_id = e.id | ||
37 | </where> | 53 | </where> |
38 | </select> | 54 | </select> |
39 | <!-- 校验路由键是否已存在 --> | 55 | <!-- 校验路由键是否已存在 --> |
-
请 注册 或 登录 后发表评论