作者 王勇

init commit

... ... @@ -26,6 +26,7 @@ public class RoutingKeyController {
/**
* 分页查询,路由键列表
*
* @param exchangeId 所属虚拟机ID
* @param routingKeyName 路由键名称
* @param pageNum 当前页数
* @param pageSize 每页数量
... ... @@ -33,12 +34,15 @@ public class RoutingKeyController {
*/
@GetMapping("/list")
public ResultJson<PageInfo> selectRoutingKeyList(
@RequestParam(value = "exchangeId", required = false) String exchangeId,
@RequestParam(value = "routingKeyName", required = false) String routingKeyName,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
ResultJson<PageInfo> result = new ResultJson<>();
RoutingKey routingKey = new RoutingKey();
// 获取参数,虚拟机id
routingKey.setExchangeId(exchangeId);
// 获取参数,路由键名称
routingKey.setRoutingKeyName(routingKeyName);
// 分页查询
... ...
... ... @@ -37,7 +37,7 @@ public class BusExchange implements Serializable {
private String virtualHostId;
/**
* 交换机类型:Direct exchange、Fanout exchange、Topic exchange、Headers exchange
* 交换机类型:Direct、Fanout、Topic、Headers
*/
private String exchangeType;
... ... @@ -79,4 +79,9 @@ public class BusExchange implements Serializable {
private Date gmtModified;
private VirtualHost virtualHost;
/**
* 交换机名称的别名
*/
private String aliasName;
}
... ...
... ... @@ -51,4 +51,14 @@ public class RoutingKey implements Serializable {
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
/**
* 路由键名称的别名
*/
private String aliasName;
/**
* 一个路由键对应一个交换机
*/
private BusExchange busExchange;
}
... ...
... ... @@ -6,6 +6,7 @@
<!--@Table bus_exchange-->
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="exchange_name" jdbcType="VARCHAR" property="exchangeName"/>
<result column="exchange_name" jdbcType="VARCHAR" property="aliasName"/>
<result column="virtual_host_id" jdbcType="VARCHAR" property="virtualHostId"/>
<result column="exchange_type" jdbcType="VARCHAR" property="exchangeType"/>
<result column="durability" jdbcType="BOOLEAN" property="durability"/>
... ...
... ... @@ -6,11 +6,22 @@
<!--@Table routing_key-->
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="routing_key_name" jdbcType="VARCHAR" property="routingKeyName"/>
<result column="routing_key_name" jdbcType="VARCHAR" property="aliasName"/>
<result column="exchange_id" jdbcType="VARCHAR" property="exchangeId"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/>
</resultMap>
<!-- 该Mapper映射关系的作用,是 路由键 与 交换机 的 1:1 的关系映射 -->
<resultMap id="RoutingKeyAndExchangeMap" extends="BaseResultMap"
type="com.sunyo.wlpt.message.bus.service.domain.RoutingKey">
<association property="busExchange" javaType="com.sunyo.wlpt.message.bus.service.domain.BusExchange">
<id column="id" property="id"></id>
<result column="exchange_name" property="exchangeName"/>
</association>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, routing_key_name, exchange_id, description, gmt_create, gmt_modified
... ... @@ -27,13 +38,18 @@
<select id="selectRoutingKeyList" parameterType="com.sunyo.wlpt.message.bus.service.domain.RoutingKey"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from routing_key
r.id, r.routing_key_name, r.exchange_id, r.description, r.gmt_create, r.gmt_modified, e.exchange_name
from routing_key as r,bus_exchange as e
<where>
<!-- 所属交换机ID -->
<if test="exchangeId != null and exchangeId !=''">
exchange_id = #{exchangeId,jdbcType=VARCHAR}
</if>
<!-- 路由键名称 -->
<if test="routingKeyName != null and routingKeyName !=''">
routing_key_name = #{routingKeyName,jdbcType=VARCHAR}
and routing_key_name = #{routingKeyName,jdbcType=VARCHAR}
</if>
and r.exchange_id = e.id
</where>
</select>
<!-- 校验路由键是否已存在 -->
... ...