作者 王勇

init commit

正在显示 53 个修改的文件 包含 4829 行增加0 行删除

要显示太多修改。

为保证性能只显示 53 of 53+ 个文件。

HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
... ...
server:
port: 9030
# spring 配置
spring:
application:
name: message-bus-service
# 数据源配置
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://118.31.66.166:3306/bus_service?characterEncoding=utf8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
username: 110
password: QAHqCJf2kFYCLirM
# rabbitmq配置
rabbitmq:
host: 192.168.1.63
port: 5672
username: mrz
password: vmvnv1v2
# 多环境配置
profiles:
active: dev
# Jackson配置
jackson:
default-property-inclusion: ALWAYS
time-zone: GMT+8
date-format: yyyy-MM-dd HH:mm:ss
# Spring Security配置
security:
user:
name: admin
password: 123456
# zipkin 链路追踪配置
zipkin:
base-url: http://192.168.1.63:9411
sleuth:
sampler:
probability: 1
# mybatis 配置
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.sunyo.wlpt.message.bus.service.domain
# 日志配置
logging:
config: config/logback-dev.xml
level:
com.sunyo.wlpt.message.bus.service.mapper: debug
logback:
appname: message-bus-service
logdir: ./log
#eureka 配置
eureka:
instance:
status-page-url: http://${eureka.instance.hostname}:${server.port}/index
prefer-ip-address: true
instance-id: ${spring.cloud.client.ip-address}:${server.port}
hostname: ${spring.cloud.client.ip-address}
metadata-map:
user:
name: "admin"
password: "123456"
client:
healthcheck:
enabled: true
service-url:
defaultZone: http://192.168.1.53:12345/eureka/
# boot admin
management:
endpoints:
enabled-by-default: true
web:
exposure:
include: "*"
endpoint:
health:
show-details: always
shutdown:
enabled: true
# 基础信息配置
info:
version: 1.0
description: "消息平台服务"
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!--参考文档链接:https://blog.csdn.net/qq_34912478/article/details/80877132-->
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true -->
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="10 seconds">
<!--<include resource="org/springframework/boot/logging/logback/base.xml" />-->
<contextName>logback</contextName>
<!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义变量后,可以使“${}”来使用变量。 -->
<property name="log.path" value="./logs" />
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>debug</level>
</filter>
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 windows系统这里设置成GBK-->
<charset>UTF-8</charset>
</encoder>
</appender>
<!--输出到文件-->
<!-- 时间滚动输出 level为 DEBUG 日志 -->
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_debug.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志归档 -->
<fileNamePattern>${log.path}/debug/log-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录debug级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>debug</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 INFO 日志 -->
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_info.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 每天日志归档路径以及格式 -->
<fileNamePattern>${log.path}/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录info级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>info</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 WARN 日志 -->
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_warn.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/warn/log-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录warn级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>warn</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_error.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 时间滚动输出 level为 trace 日志 -->
<appender name="TRACE_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${log.path}/log_trace.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${log.path}/trace/log-trace-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文件只记录trace级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>TRACE</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!--
<logger>用来设置某一个包或者具体的某一个类的日志打印级别、
以及指定<appender>。<logger>仅有一个name属性,
一个可选的level和一个可选的addtivity属性。
name:用来指定受此logger约束的某一个包或者具体的某一个类。
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。
如果未设置此属性,那么当前logger将会继承上级的级别。
addtivity:是否向上级logger传递打印信息。默认是true。
-->
<!--<logger name="org.springframework.web" level="info"/>-->
<!--<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>-->
<!--
使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作:
第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息
第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别:
-->
<!--
root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
不能设置为INHERITED或者同义词NULL。默认是DEBUG
可以包含零个或多个元素,标识这个appender将会添加到这个logger。
-->
<!--<logger name="com.tianbo.analysis" level="trace">-->
<!--<appender-ref ref="CONSOLE" />-->
<!--<appender-ref ref="TRACE_FILE" />-->
<!--<appender-ref ref="DEBUG_FILE" />-->
<!--<appender-ref ref="INFO_FILE" />-->
<!--<appender-ref ref="WARN_FILE" />-->
<!--<appender-ref ref="ERROR_FILE" />-->
<!--</logger>-->
<!--开发环境:打印控制台-->
<springProfile name="dev">
<logger name="org.springframework" level="info"/>
<logger name="com.sunyo.wlpt.nmms.mapper" level="debug">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
</logger>
<logger name="org.apache.tomcat" level="info" />
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="TRACE_FILE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</springProfile>
<!--生产环境:输出到文件-->
<springProfile name="pro">
<logger name="org.springframework" level="INFO"/>
<root level="info">
<appender-ref ref="CONSOLE" />
<appender-ref ref="DEBUG_FILE" />
<appender-ref ref="INFO_FILE" />
<appender-ref ref="ERROR_FILE" />
<appender-ref ref="WARN_FILE" />
<appender-ref ref="TRACE_FILE" />
</root>
</springProfile>
</configuration>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="ture" scanPeriod="60 seconds" debug="false">
<springProperty scope="context" name="appname" source="logback.appname"/>
<springProperty scope="context" name="logdir" source="logback.logdir"/>
<!--文件名-->
<contextName>${appname}</contextName>
<!--输出到控制面板-->
<appender name="consoleLog1" class="ch.qos.logback.core.ConsoleAppender">
<!-- layout输出方式输出-->
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d [%thread] %-5level %logger{36} - %msg%n</pattern>
</layout>
</appender>
<!--输出到控制面板-->
<appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!--输出info级别日志-->
<appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!--过滤 Error-->
<level>ERROR</level>
<!--匹配到就禁止-->
<onMatch>DENY</onMatch>
<!--没有匹配到就允许-->
<onMismatch>ACCEPT</onMismatch>
</filter>
<!--<File>../logs</File>-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${logdir}/info.${appname}.%d{yyyy-MM-dd}.log</FileNamePattern>
<maxHistory>100</maxHistory>
<totalSizeCap>100MB</totalSizeCap>
</rollingPolicy>
<encoder>
<charset>UTF-8</charset>
<pattern>%d [%thread] %-5level %logger{36} %line - %msg%n</pattern>
</encoder>
</appender>
<!--输出Error级别日志-->
<!--<appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">-->
<!--<filter class="ch.qos.logback.classic.filter.LevelFilter">-->
<!--&lt;!&ndash;过滤 Error &ndash;&gt;-->
<!--<level>ERROR</level>-->
<!--</filter>-->
<!--&lt;!&ndash;<File>../logs</File>&ndash;&gt;-->
<!--<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">-->
<!--<FileNamePattern>${logdir}/error.${appname}.%d{yyyy-MM-dd}.log</FileNamePattern>-->
<!--<maxHistory>100</maxHistory>-->
<!--<totalSizeCap>100MB</totalSizeCap>-->
<!--</rollingPolicy>-->
<!--<encoder>-->
<!--<charset>UTF-8</charset>-->
<!--<pattern>%d [%thread] %-5level %logger{36} %line - %msg%n</pattern>-->
<!--</encoder>-->
<!--</appender>-->
<!--监控下列类的所有日志,定义输出级别-->
<logger name="java.sql.PreparedStatement" level="DEBUG" additivity="false">
<appender-ref ref="consoleLog"/>
</logger>    
<logger name="java.sql.Connection" level="DEBUG" additivity="false"> 
<appender-ref ref="consoleLog"/>
</logger>  
<logger name="java.sql.Statement" level="DEBUG" additivity="false">
<appender-ref ref="consoleLog"/>
</logger>    
<logger name="com.ibatis" level="DEBUG" additivity="false">
<appender-ref ref="consoleLog"/>
</logger>    
<logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG" additivity="false">
<appender-ref ref="consoleLog"/>
</logger>    
<logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG" additivity="false">
<appender-ref ref="consoleLog"/>
</logger>    
<logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" level="DEBUG" additivity="false">
<appender-ref ref="consoleLog"/>
</logger> 
<!--输出-->
<root level="INFO">
<appender-ref ref="consoleLog"/>
<!--<appender-ref ref="consoleLog"/>-->
<appender-ref ref="fileInfoLog"/>
<!--<appender-ref ref="fileErrorLog"/>-->
</root>
</configuration>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sunyo.wlpt.message.bus.service</groupId>
<artifactId>message_bus_service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>message_bus_service</name>
<description>消息总线服务</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.1.7.RELEASE</spring-boot.version>
<spring-cloud.version>Greenwich.SR2</spring-cloud.version>
</properties>
<dependencies>
<!-- SpringBoot start -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<!-- SpringBoot end -->
<!-- SpringCloud start -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-zipkin</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.2.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- SpringCloud end -->
<!-- database start -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.12</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.9</version>
</dependency>
<!-- database end -->
<!-- tools start -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.22</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.10.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- tools end -->
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestone</id>
<name>Spring Milestone</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshot</id>
<name>Spring Snapshot</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestone</id>
<name>Spring Milestone</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-snapshot</id>
<name>Spring Snapshot</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
... ...
package com.sunyo.wlpt.message.bus.service;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* @author 子诚
*/
@SpringBootApplication
@MapperScan("com.sunyo.wlpt.message.bus.service.mapper")
@EnableFeignClients
@EnableEurekaClient
@EnableTransactionManagement
public class MessageBusServiceApplication {
public static void main(String[] args) {
SpringApplication.run(MessageBusServiceApplication.class, args);
}
}
... ...
package com.sunyo.wlpt.message.bus.service.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
/**
* @author 子诚
* Description:SpringSecurity 权限配置框架
* 时间:2020/7/5 13:38
*/
@EnableWebSecurity
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
//http.authorizeRequests().antMatchers("/","/bus/**").permitAll().and().csrf().disable();
}
}
... ...
package com.sunyo.wlpt.message.bus.service.controller;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
import com.sunyo.wlpt.message.bus.service.service.BusExchangeService;
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author 子诚
* Description:关于MQ交换机的控制器
* 时间:2020/7/1 16:13
*/
@CrossOrigin
@RequestMapping("bus/exchange")
@RestController
public class BusExchangeController {
@Resource
private BusExchangeService busExchangeService;
/**
* 分页查询,交换机列表
*
* @param exchangeName 交换机名称
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return 成功返回交换机列表
*/
@GetMapping("/list")
public ResultJson<PageInfo> selectBusExchangeList(
@RequestParam(value = "exchangeName", required = false) String exchangeName,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
ResultJson<PageInfo> result = new ResultJson<>();
BusExchange busExchange = new BusExchange();
// 获取参数,交换机名称
busExchange.setExchangeName(exchangeName);
// 分页查询
PageInfo pageInfo = busExchangeService.selectBusExchangeList(busExchange, pageNum, pageSize);
if (pageInfo.getTotal() > 0) {
result.setCode("200");
result.setData(pageInfo);
result.setMsg("查询MQ交换机列表,成功!");
} else {
result.setCode("500");
result.setMsg("查询MQ交换机列表,失败!");
}
return result;
}
/**
* 删除交换机
*
* @param busExchange {@link BusExchange}
* @return {@link ResultJson}
*/
@DeleteMapping("/delete")
public ResultJson deleteBusExchange(@RequestBody BusExchange busExchange) {
ResultJson result = new ResultJson<>();
int num = busExchangeService.deleteByPrimaryKey(busExchange.getId());
if (num > 0) {
result.setCode("200");
result.setMsg("删除MQ交换机,成功");
} else {
result.setCode("500");
result.setMsg("删除MQ交换机,失败");
}
return result;
}
/**
* 批量删除
*
* @param ids 需被删除的服务器的id以','相连接的字符串
* @return {@link ResultJson}
*/
@GetMapping("/batchRemove")
public ResultJson batchRemoveBusExchange(String ids) {
ResultJson result = new ResultJson<>();
int num = busExchangeService.deleteByPrimaryKey(ids);
if (num > 0) {
result.setCode("200");
result.setMsg("批量删除交换机,成功!");
} else {
result.setCode("500");
result.setMsg("批量删除交换机,失败!");
}
return result;
}
/**
* 编辑交换机信息
*
* @param busExchange {@link BusExchange}
* @return {@link ResultJson}
*/
@PutMapping("/update")
public ResultJson updateBusExchange(@RequestBody BusExchange busExchange) {
// 先验证,修改好的核心信息(交换机名称)是否已存在
String message = validateBusExchange(busExchange);
// 验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
int num = busExchangeService.updateByPrimaryKeySelective(busExchange);
if (num > 0) {
result.setCode("200");
result.setMsg("编辑交换机信息,成功");
} else {
result.setCode("500");
result.setMsg("编辑交换机信息,失败");
}
return result;
}
return new ResultJson("400", message != null ? message : "编辑交换机信息,失败!");
}
/**
* 新增交换机
*
* @param busExchange {@link BusExchange}
* @return {@link ResultJson}
*/
@PostMapping("/insert")
public ResultJson insertBusExchange(@RequestBody BusExchange busExchange) {
//先验证,增加的虚拟主机的核心信息(交换机名称)是否已存在
String message = validateBusExchange(busExchange);
//验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
// 设置id
busExchange.setId(IdUtils.generateId());
int num = busExchangeService.insertSelective(busExchange);
if (num > 0) {
result.setCode("200");
result.setMsg("添加交换机信息,成功!");
} else {
result.setCode("500");
result.setMsg("添加交换机信息,失败!");
}
return result;
}
return new ResultJson("400", message != null ? message : "添加交换机信息,失败!");
}
/**
* 校验交换机,添加和修改之前,是否已存在
*
* @param busExchange {@link BusExchange}
* @return 通过,无返回消息
*/
private String validateBusExchange(BusExchange busExchange) {
// 判断交换机名称,是否为空
if ("".equals(busExchange.getExchangeName()) || busExchange.getExchangeName() == null) {
return "该交换机信息中,没有交换机名称";
}
// 如果id不为空,则是 update 操作
if (busExchange.getId() != null && busExchange.getId().length() != 0) {
// 根据 id 查询出原来的 消息队列 信息
BusExchange oldBusExchange = busExchangeService.selectByPrimaryKey(busExchange.getId());
// 如果修改后的 exchangeName,和原来的 exchangeName 不一致,则校验 该 exchangeName 是否已存在
if (!oldBusExchange.getExchangeName().equals(busExchange.getExchangeName())) {
// 根据 exchangeName,进行查询校验
List<BusExchange> info = busExchangeService.validateBusExchange(busExchange);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-交换机(交换机名称)-信息已存在,请谨慎输入";
}
return null;
}
// exchangeName 一致,则代表着没有修改 exchangeName,校验通过
return null;
}
// 如果id为空,则是 insert 操作
else {
// 根据 exchangeName,进行查询校验
List<BusExchange> info = busExchangeService.validateBusExchange(busExchange);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-交换机(交换机名称)-信息已存在,请谨慎输入";
}
return null;
}
}
}
... ...
package com.sunyo.wlpt.message.bus.service.controller;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
import com.sunyo.wlpt.message.bus.service.service.BusQueueService;
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author 子诚
* Description:关于消息队列的控制器
* 时间:2020/7/1 19:05
*/
@CrossOrigin
@RequestMapping("bus/queue")
@RestController
public class BusQueueController {
@Resource
private BusQueueService busQueueService;
/**
* 分页查询,消息队列-列表
*
* @param queueName 消息队列名称
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return 成功返回,消息队列-列表
*/
@GetMapping("/list")
public ResultJson<PageInfo> selectBusQueueList(
@RequestParam(value = "queueName", required = false) String queueName,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
ResultJson<PageInfo> result = new ResultJson<>();
BusQueue busQueue = new BusQueue();
// 获取参数,队列名称
busQueue.setQueueName(queueName);
// 分页查询
PageInfo pageInfo = busQueueService.selectBusQueueList(busQueue, pageNum, pageSize);
if (pageInfo.getTotal() > 0) {
result.setCode("200");
result.setData(pageInfo);
result.setMsg("查询-消息队列-列表,成功!");
} else {
result.setCode("500");
result.setMsg("查询-消息队列-列表,失败!");
}
return result;
}
/**
* 删除队列
*
* @param busQueue {@link BusQueue}
* @return {@link ResultJson}
*/
@DeleteMapping("/delete")
public ResultJson deleteBusQueue(@RequestBody BusQueue busQueue) {
ResultJson result = new ResultJson<>();
int num = busQueueService.deleteByPrimaryKey(busQueue.getId());
if (num > 0) {
result.setCode("200");
result.setMsg("删除-消息队列,成功");
} else {
result.setCode("500");
result.setMsg("删除-消息交换机,失败");
}
return result;
}
/**
* 批量删除
*
* @param ids 需被删除的服务器的id以','相连接的字符串
* @return {@link ResultJson}
*/
@GetMapping("/batchRemove")
public ResultJson batchRemoveBusQueue(String ids) {
ResultJson result = new ResultJson<>();
int num = busQueueService.deleteByPrimaryKey(ids);
if (num > 0) {
result.setCode("200");
result.setMsg("批量删除消息队列,成功!");
} else {
result.setCode("500");
result.setMsg("批量删除消息队列,失败!");
}
return result;
}
/**
* 编辑-消息队列-信息
*
* @param busQueue {@link BusQueue}
* @return {@link ResultJson}
*/
@PutMapping("/update")
public ResultJson updateBusQueue(@RequestBody BusQueue busQueue) {
// 先校验队列名称
String message = validateBusQueue(busQueue);
// 验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
int num = busQueueService.updateByPrimaryKeySelective(busQueue);
if (num > 0) {
result.setCode("200");
result.setMsg("编辑-消息队列-信息,成功");
} else {
result.setCode("500");
result.setMsg("编辑-消息队列-信息,失败");
}
return result;
}
return new ResultJson("400", message != null ? message : "编辑-消息队列-信息,失败!");
}
/**
* 新增-消息队列
*
* @param busQueue {@link BusQueue}
* @return {@link ResultJson}
*/
@PostMapping("/insert")
public ResultJson insertBusQueue(@RequestBody BusQueue busQueue) {
//先验证,增加的虚拟主机的核心信息(交换机名称)是否已存在
String message = validateBusQueue(busQueue);
//验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
// 设置id
busQueue.setId(IdUtils.generateId());
int num = busQueueService.insertSelective(busQueue);
if (num > 0) {
result.setCode("200");
result.setMsg("添加-消息队列-信息,成功!");
} else {
result.setCode("500");
result.setMsg("添加-消息队列-信息,失败!");
}
return result;
}
return new ResultJson("400", message != null ? message : "添加-消息队列-信息,失败!");
}
/**
* 校验-消息队列,添加和修改之前,是否已存在
*
* @param busQueue {@link BusQueue}
* @return 通过校验,无返回消息
*/
private String validateBusQueue(BusQueue busQueue) {
// 判断队列名称,是否为空
if ("".equals(busQueue.getQueueName()) || busQueue.getQueueName() == null) {
return "该-消息队列-信息中,没有消息队列名称";
}
// 如果id不为空,则是 update 操作
if (busQueue.getId() != null && busQueue.getId().length() != 0) {
// 根据 id 查询出原来的 消息队列 信息
BusQueue oldBusQueue = busQueueService.selectByPrimaryKey(busQueue.getId());
// 如果修改后的 队列名称,和原来的 队列名称 不一致,则校验 该 队列名称 是否已存在
if (!oldBusQueue.getQueueName().equals(busQueue.getQueueName())) {
// 根据 QueueName,进行查询校验
List<BusQueue> info = busQueueService.validateBusQueue(busQueue);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-消息队列(队列名称)-信息已存在,请谨慎输入";
}
return null;
}
// 队列名称 一致,则代表着没有修改 队列名称,校验通过
return null;
}
// 如果id为空,则是 insert 操作
else {
// 根据 QueueName,进行查询校验
List<BusQueue> info = busQueueService.validateBusQueue(busQueue);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-消息队列-信息已存在,请谨慎输入";
}
return null;
}
}
}
... ...
package com.sunyo.wlpt.message.bus.service.controller;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import com.sunyo.wlpt.message.bus.service.domain.BusServer;
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
import com.sunyo.wlpt.message.bus.service.service.BusServerService;
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author 子诚
* Description:关于MQ服务器静态信息的控制器
* 时间:2020/6/28 18:21
*/
@CrossOrigin
@RequestMapping("bus/server")
@RestController
public class BusServerController {
@Resource
private BusServerService busServerService;
/**
* 分页查询,MQ服务器列表
*
* @param serverName MQ服务器名称
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return 成功返回MQ服务器列表
*/
@GetMapping("/list")
public ResultJson<PageInfo> selectBusServerList(
@RequestParam(value = "serverName", required = false) String serverName,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
ResultJson<PageInfo> result = new ResultJson<>();
BusServer busServer = new BusServer();
// 获取参数,服务器名称
busServer.setServerName(serverName);
// 分页查询
PageInfo pageInfo = busServerService.selectBusServerList(busServer, pageNum, pageSize);
if (pageInfo.getTotal() > 0) {
result.setCode("200");
result.setData(pageInfo);
result.setMsg("查询MQ服务器列表,成功!");
} else {
result.setCode("500");
result.setMsg("查询MQ服务器列表,失败!");
}
return result;
}
/**
* 删除服务器
*
* @param busServer {@link BusServer}
* @return {@link ResultJson}
*/
@DeleteMapping("/delete")
public ResultJson deleteBusServer(@RequestBody BusServer busServer) {
ResultJson result = new ResultJson<>();
int num = busServerService.deleteByPrimaryKey(busServer.getId());
if (num > 0) {
result.setCode("200");
result.setMsg("删除MQ服务器,成功");
} else {
result.setCode("500");
result.setMsg("删除MQ服务器,失败");
}
return result;
}
/**
* 批量删除
*
* @param ids 需被删除的服务器的id以','相连接的字符串
* @return {@link ResultJson}
*/
@GetMapping("/batchRemove")
public ResultJson batchRemoveBusServer(String ids) {
ResultJson result = new ResultJson<>();
int num = busServerService.deleteByPrimaryKey(ids);
if (num > 0) {
result.setCode("200");
result.setMsg("批量删除服务器,成功!");
} else {
result.setCode("500");
result.setMsg("批量删除服务器,失败!");
}
return result;
}
/**
* 修改服务器信息
*
* @param busServer {@link BusServer}
* @return {@link ResultJson}
*/
@PutMapping("/update")
public ResultJson updateBusServer(@RequestBody BusServer busServer) {
//先验证,修改好的核心信息(ip和port,同时存在)是否已存在
String message = validateBusServer(busServer);
//验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
int num = busServerService.updateByPrimaryKeySelective(busServer);
if (num > 0) {
result.setCode("200");
result.setMsg("修改服务器信息,成功");
} else {
result.setCode("500");
result.setMsg("修改服务器信息,失败");
}
return result;
}
return new ResultJson("400", message != null ? message : "修改服务器信息,失败!");
}
/**
* 新增服务器
*
* @param busServer {@link BusServer}
* @return {@link ResultJson}
*/
@PostMapping("/insert")
public ResultJson insertBusServer(@RequestBody BusServer busServer) {
//先验证,增加的服务器的核心信息(ip和port,同时存在)是否已存在
String message = validateBusServer(busServer);
//验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
// 设置id
busServer.setId(IdUtils.generateId());
int num = busServerService.insertSelective(busServer);
if (num > 0) {
result.setCode("200");
result.setMsg("添加服务器信息,成功!");
} else {
result.setCode("500");
result.setMsg("添加服务器信息,失败!");
}
return result;
}
return new ResultJson("400", message != null ? message : "该服务器信息,已存在!");
}
/**
* 校验,添加和修改之前,是否已存在
*
* @param busServer {@link BusServer}
* @return 通过,无返回消息
*/
private String validateBusServer(BusServer busServer) {
if ("".equals(busServer.getServerIp()) || busServer.getServerIp() == null) {
return "该服务器信息中,没有服务器IP";
}
if ("".equals(busServer.getServerPort()) || busServer.getServerPort() == null) {
return "该服务器信息中,没有服务器Port";
}
// 如果id不为空,则是 update 操作
if (busServer.getId() != null && busServer.getId().length() != 0) {
// 根据 id 查询出原来的 MQ服务器 信息
BusServer oldBusServer = busServerService.selectByPrimaryKey(busServer.getId());
// 如果修改后的 ServerIp以及ServerPort(同时),和原来的 ServerIp以及ServerPort(同时) 不一致,(有一个不一致,即可)
// 则校验 该 ServerIp以及ServerPort(同时) 是否已存在
if (!oldBusServer.getServerPort().equals(busServer.getServerPort()) ||
!oldBusServer.getServerIp().equals(busServer.getServerIp())) {
// 根据 ServerIp以及ServerPort(同时),进行查询校验
List<BusServer> info = busServerService.validateBusServer(busServer);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-MQ服务器(ServerIp以及ServerPort)-信息已存在,请谨慎输入";
}
return null;
}
// ServerIp以及ServerPort(同时) 一致,则代表着没有修改 ServerIp以及ServerPort(同时),校验通过
return null;
}
// 如果id为空,则是 insert 操作
else {
// 根据 ServerIp以及ServerPort(同时),进行查询校验
List<BusServer> info = busServerService.validateBusServer(busServer);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-MQ服务器(ServerIp以及ServerPort)-信息已存在,请谨慎输入";
}
return null;
}
}
}
... ...
package com.sunyo.wlpt.message.bus.service.controller;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.MessageNote;
import com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding;
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
import com.sunyo.wlpt.message.bus.service.service.MessageNoteService;
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Date;
/**
* @author 子诚
* Description:关于消息收发记录的控制器
* 时间:2020/7/2 15:06
*/
@CrossOrigin
@RequestMapping("bus/note")
@RestController
public class MessageNoteController {
@Resource
private MessageNoteService messageNoteService;
/**
* 分页查询,消息收发记录
*
* @param username 用户登陆名称
* @param serverName MQ服务器名称
* @param virtualHostName 虚拟主机名称
* @param exchangeName 交换机名称
* @param queueName 队列名称
* @param routingKeyName 路由键名称
* @param sendTime 发送消息时间
* @param receiveTime 接收消息时间
* @param pageNum 当前页数,默认 1
* @param pageSize 每页条数,默认 10
* @return 消息收发记录-列表
*/
@GetMapping("/list")
public ResultJson<PageInfo> selectMessageNoteList(
@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "serverName", required = false) String serverName,
@RequestParam(value = "virtualHostName", required = false) String virtualHostName,
@RequestParam(value = "exchangeName", required = false) String exchangeName,
@RequestParam(value = "queueName", required = false) String queueName,
@RequestParam(value = "routingKeyName", required = false) String routingKeyName,
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@RequestParam(value = "sendTime", required = false) Date sendTime,
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@RequestParam(value = "receiveTime", required = false) Date receiveTime,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
ResultJson<PageInfo> result = new ResultJson<>();
MessageNote messageNote = new MessageNote();
// 获取参数,用户登陆名称
messageNote.setUsername(username);
// 获取参数,MQ服务器名称
messageNote.setServerName(serverName);
// 获取参数,虚拟主机名称
messageNote.setVirtualHostName(virtualHostName);
// 获取参数,交换机名称
messageNote.setExchangeName(exchangeName);
// 获取参数,队列名称
messageNote.setQueueName(queueName);
// 获取参数,路由键名称
messageNote.setRoutingKeyName(routingKeyName);
// 获取参数,发送消息时间
messageNote.setSendTime(sendTime);
// 获取参数,接收消息时间
messageNote.setReceiveTime(receiveTime);
// 分页查询
PageInfo pageInfo = messageNoteService.selectMessageNoteList(messageNote, pageNum, pageSize);
if (pageInfo.getTotal() > 0) {
result.setCode("200");
result.setData(pageInfo);
result.setMsg("查询MQ服务器列表,成功!");
} else {
result.setCode("500");
result.setMsg("查询MQ服务器列表,失败!");
}
return result;
}
/**
* 删除--消息收发记录
*
* @param messageNote {@link MessageNote}
* @return {@link ResultJson}
*/
@DeleteMapping("/delete")
public ResultJson deleteMessageNote(@RequestBody MessageNote messageNote) {
ResultJson result = new ResultJson<>();
int num = messageNoteService.deleteByPrimaryKey(messageNote.getId());
if (num > 0) {
result.setCode("200");
result.setMsg("删除-消息收发记录,成功");
} else {
result.setCode("500");
result.setMsg("删除-消息收发记录,失败");
}
return result;
}
/**
* 批量删除
*
* @param ids 需被删除的服务器的id以','相连接的字符串
* @return {@link ResultJson}
*/
@GetMapping("/batchRemove")
public ResultJson batchRemoveMessageNote(String ids) {
ResultJson result = new ResultJson<>();
int num = messageNoteService.deleteByPrimaryKey(ids);
if (num > 0) {
result.setCode("200");
result.setMsg("批量删除-消息收发记录,成功!");
} else {
result.setCode("500");
result.setMsg("批量删除-消息收发记录,失败!");
}
return result;
}
/**
* 编辑-消息收发记录
*
* @param messageNote {@link MessageNote}
* @return {@link ResultJson}
*/
@PutMapping("/update")
public ResultJson updateMessageNote(@RequestBody MessageNote messageNote) {
ResultJson result = new ResultJson<>();
int num = messageNoteService.updateByPrimaryKeySelective(messageNote);
if (num > 0) {
result.setCode("200");
result.setMsg("编辑-消息收发记录,成功");
} else {
result.setCode("500");
result.setMsg("编辑-消息收发记录,失败");
}
return result;
}
/**
* 新增-消息收发记录
*
* @param messageNote {@link MessageNote}
* @return {@link ResultJson}
*/
@PostMapping("/insert")
public ResultJson insertMessageNote(@RequestBody MessageNote messageNote) {
ResultJson result = new ResultJson<>();
// 设置id
messageNote.setId(IdUtils.generateId());
int num = messageNoteService.insertSelective(messageNote);
if (num > 0) {
result.setCode("200");
result.setMsg("添加-消息收发记录,成功");
} else {
result.setCode("500");
result.setMsg("添加-消息收发记录,失败");
}
return result;
}
}
... ...
package com.sunyo.wlpt.message.bus.service.controller;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.RoutingKey;
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
import com.sunyo.wlpt.message.bus.service.service.RoutingKeyService;
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author 子诚
* Description:关于路由键的控制器
* 时间:2020/7/1 17:41
*/
@CrossOrigin
@RequestMapping("bus/routing")
@RestController
public class RoutingKeyController {
@Resource
private RoutingKeyService routingKeyService;
/**
* 分页查询,路由键列表
*
* @param routingKeyName 路由键名称
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return 成功返回路由键列表
*/
@GetMapping("/list")
public ResultJson<PageInfo> selectRoutingKeyList(
@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();
// 获取参数,路由键名称
routingKey.setRoutingKeyName(routingKeyName);
// 分页查询
PageInfo pageInfo = routingKeyService.selectRoutingKeyList(routingKey, pageNum, pageSize);
if (pageInfo.getTotal() > 0) {
result.setCode("200");
result.setData(pageInfo);
result.setMsg("查询路由键列表,成功!");
} else {
result.setCode("500");
result.setMsg("查询路由键列表,失败!");
}
return result;
}
/**
* 删除路由键
*
* @param routingKey {@link RoutingKey}
* @return {@link ResultJson}
*/
@DeleteMapping("/delete")
public ResultJson deleteRoutingKey(@RequestBody RoutingKey routingKey) {
ResultJson result = new ResultJson<>();
int num = routingKeyService.deleteByPrimaryKey(routingKey.getId());
if (num > 0) {
result.setCode("200");
result.setMsg("删除路由键,成功");
} else {
result.setCode("500");
result.setMsg("删除路由键,失败");
}
return result;
}
/**
* 批量删除
*
* @param ids 需被删除的服务器的id以','相连接的字符串
* @return {@link ResultJson}
*/
@GetMapping("/batchRemove")
public ResultJson batchRemoveRoutingKey(String ids) {
ResultJson result = new ResultJson<>();
int num = routingKeyService.deleteByPrimaryKey(ids);
if (num > 0) {
result.setCode("200");
result.setMsg("批量删除路由键,成功!");
} else {
result.setCode("500");
result.setMsg("批量删除路由键,失败!");
}
return result;
}
/**
* 修改路由键信息
*
* @param routingKey {@link RoutingKey}
* @return {@link ResultJson}
*/
@PutMapping("/update")
public ResultJson updateRoutingKey(@RequestBody RoutingKey routingKey) {
//先验证,修改好的核心信息(路由键名称)是否已存在
String message = validateRoutingKey(routingKey);
//验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
int num = routingKeyService.updateByPrimaryKeySelective(routingKey);
if (num > 0) {
result.setCode("200");
result.setMsg("修改路由键信息,成功");
} else {
result.setCode("500");
result.setMsg("修改路由键信息,失败");
}
return result;
}
return new ResultJson("400", message != null ? message : "修改路由键信息,失败!");
}
/**
* 新增路由键
*
* @param routingKey {@link RoutingKey}
* @return {@link ResultJson}
*/
@PostMapping("/insert")
public ResultJson insertRoutingKey(@RequestBody RoutingKey routingKey) {
//先验证,增加的服务器的核心信息(ip和port,同时存在)是否已存在
String message = validateRoutingKey(routingKey);
//验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
// 设置id
routingKey.setId(IdUtils.generateId());
int num = routingKeyService.insertSelective(routingKey);
if (num > 0) {
result.setCode("200");
result.setMsg("添加路由键信息,成功!");
} else {
result.setCode("500");
result.setMsg("添加路由键信息,失败!");
}
return result;
}
return new ResultJson("400", message != null ? message : "添加路由键信息,失败!");
}
/**
* 校验路由键,添加和修改之前,是否已存在
*
* @param routingKey {@link RoutingKey}
* @return 通过,无返回消息
*/
private String validateRoutingKey(RoutingKey routingKey) {
if ("".equals(routingKey.getRoutingKeyName()) || routingKey.getRoutingKeyName() == null) {
return "该路由键信息中,没有路由键名称";
}
// 如果id不为空,则是 update 操作
if (routingKey.getId() != null && routingKey.getId().length() != 0) {
// 根据 id 查询出原来的 路由键 信息
RoutingKey oldRoutingKey = routingKeyService.selectByPrimaryKey(routingKey.getId());
// 如果修改后的 routingKeyName,和原来的 routingKeyName 不一致,则校验 该 routingKeyName 是否已存在
if (!oldRoutingKey.getRoutingKeyName().equals(routingKey.getRoutingKeyName())) {
// 根据 routingKeyName,进行查询校验
List<RoutingKey> info = routingKeyService.validateRoutingKey(routingKey);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-路由键(路由键名称)-信息已存在,请谨慎输入";
}
return null;
}
// routingKeyName 一致,则代表着没有修改 routingKeyName,校验通过
return null;
}
// 如果id为空,则是 insert 操作
else {
// 根据 routingKeyName,进行查询校验
List<RoutingKey> info = routingKeyService.validateRoutingKey(routingKey);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-路由键(路由键名称)-信息已存在,请谨慎输入";
}
return null;
}
}
}
... ...
package com.sunyo.wlpt.message.bus.service.controller;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding;
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
import com.sunyo.wlpt.message.bus.service.service.UserMessageBindingService;
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author 子诚
* Description:关于账户消息绑定配置表的控制器
* 时间:2020/7/2 11:20
*/
@CrossOrigin
@RequestMapping("bus/umb")
@RestController
public class UserMessageBindingController {
@Resource
private UserMessageBindingService userMessageBindingService;
/**
* 分页查询,账户消息绑定配置表,列表
*
* @param username 所属用户登陆名称
* @param virtualHostName 所属虚拟主机名称
* @param exchangeName 所属交换机名称
* @param queueName 所属队列名称
* @param routingKeyName 所属路由键名称
* @param subscriber 订阅者
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return 列表 {@link ResultJson}
*/
@GetMapping("/list")
public ResultJson<PageInfo> selectUserMessageBindingList(
@RequestParam(value = "username", required = false) String username,
@RequestParam(value = "virtualHostName", required = false) String virtualHostName,
@RequestParam(value = "exchangeName", required = false) String exchangeName,
@RequestParam(value = "queueName", required = false) String queueName,
@RequestParam(value = "routingKeyName", required = false) String routingKeyName,
@RequestParam(value = "subscriber", required = false) String subscriber,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
ResultJson<PageInfo> result = new ResultJson<>();
UserMessageBinding userMessageBinding = new UserMessageBinding();
// 获取参数,所属用户登陆名称
userMessageBinding.setUsername(username);
// 获取参数,所属虚拟主机名称
userMessageBinding.setVirtualHostName(virtualHostName);
// 获取参数,所属交换机名称
userMessageBinding.setExchangeName(exchangeName);
// 获取参数,所属队列名称
userMessageBinding.setQueueName(queueName);
// 获取参数,所属路由键名称
userMessageBinding.setRoutingKeyName(routingKeyName);
// 获取参数,订阅者
userMessageBinding.setSubscriber(subscriber);
// 分页查询
PageInfo pageInfo = userMessageBindingService.selectUserMessageBindingList(userMessageBinding, pageNum, pageSize);
if (pageInfo.getTotal() > 0) {
result.setCode("200");
result.setData(pageInfo);
result.setMsg("查询-账户消息绑定配置列表,成功!");
} else {
result.setCode("500");
result.setMsg("查询-账户消息绑定配置列表,失败!");
}
return result;
}
/**
* 删除--账户消息配置信息
*
* @param userMessageBinding {@link UserMessageBinding}
* @return {@link ResultJson}
*/
@DeleteMapping("/delete")
public ResultJson deleteUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) {
ResultJson result = new ResultJson<>();
int num = userMessageBindingService.deleteByPrimaryKey(userMessageBinding.getId());
if (num > 0) {
result.setCode("200");
result.setMsg("删除-账户消息配置信息,成功");
} else {
result.setCode("500");
result.setMsg("删除-账户消息配置信息,失败");
}
return result;
}
/**
* 批量删除
*
* @param ids 需被删除的服务器的id以','相连接的字符串
* @return {@link ResultJson}
*/
@GetMapping("/batchRemove")
public ResultJson batchRemoveUserMessageBinding(String ids) {
ResultJson result = new ResultJson<>();
int num = userMessageBindingService.deleteByPrimaryKey(ids);
if (num > 0) {
result.setCode("200");
result.setMsg("批量删除-账户消息配置-信息,成功!");
} else {
result.setCode("500");
result.setMsg("批量删除-账户消息配置-信息,失败!");
}
return result;
}
/**
* 编辑-账户消息配置信息
*
* @param userMessageBinding {@link UserMessageBinding}
* @return {@link ResultJson}
*/
@PutMapping("/update")
public ResultJson updateUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) {
ResultJson result = new ResultJson<>();
int num = userMessageBindingService.updateByPrimaryKeySelective(userMessageBinding);
if (num > 0) {
result.setCode("200");
result.setMsg("编辑-账户消息配置-信息,成功");
} else {
result.setCode("500");
result.setMsg("编辑-账户消息配置-信息,失败");
}
return result;
}
/**
* 新增-账户消息配置信息
*
* @param userMessageBinding {@link UserMessageBinding}
* @return {@link ResultJson}
*/
@PostMapping("/insert")
public ResultJson insertUserMessageBinding(@RequestBody UserMessageBinding userMessageBinding) {
ResultJson result = new ResultJson<>();
// 设置id
userMessageBinding.setId(IdUtils.generateId());
int num = userMessageBindingService.insertSelective(userMessageBinding);
if (num > 0) {
result.setCode("200");
result.setMsg("添加-账户消息配置-信息,成功");
} else {
result.setCode("500");
result.setMsg("添加-账户消息配置-信息,失败");
}
return result;
}
}
... ...
package com.sunyo.wlpt.message.bus.service.controller;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import com.sunyo.wlpt.message.bus.service.domain.VirtualHost;
import com.sunyo.wlpt.message.bus.service.response.ResultJson;
import com.sunyo.wlpt.message.bus.service.service.VirtualHostService;
import com.sunyo.wlpt.message.bus.service.utils.IdUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author 子诚
* Description:关于MQ虚拟主机信息的控制器
* 时间:2020/7/1 14:28
*/
@CrossOrigin
@RequestMapping("bus/host")
@RestController
public class VirtualHostController {
@Resource
private VirtualHostService virtualHostService;
/**
* 分页查询,虚拟主机列表
*
* @param serverId 所属服务器ID
* @param virtualHostName 虚拟主机名称
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return 成功返回,虚拟主机列表
*/
@GetMapping("/list")
public ResultJson<PageInfo> selectVirtualHostList(
@RequestParam(value = "serverId", required = false) String serverId,
@RequestParam(value = "virtualHostName", required = false) String virtualHostName,
@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
ResultJson<PageInfo> result = new ResultJson<>();
VirtualHost virtualHost = new VirtualHost();
// 获取参数,所属服务器ID
virtualHost.setServerId(serverId);
// 获取参数,虚拟主机名称
virtualHost.setVirtualHostName(virtualHostName);
// 分页查询
PageInfo pageInfo = virtualHostService.selectVirtualHostList(virtualHost, pageNum, pageSize);
if (pageInfo.getTotal() > 0) {
result.setCode("200");
result.setData(pageInfo);
result.setMsg("查询虚拟主机列表,成功!");
} else {
result.setCode("500");
result.setMsg("查询虚拟主机列表,失败!");
}
return result;
}
/**
* 删除虚拟主机
*
* @param virtualHost {@link VirtualHost}
* @return {@link ResultJson}
*/
@DeleteMapping("/delete")
public ResultJson deleteVirtualHost(@RequestBody VirtualHost virtualHost) {
ResultJson result = new ResultJson<>();
int num = virtualHostService.deleteByPrimaryKey(virtualHost.getId());
if (num > 0) {
result.setCode("200");
result.setMsg("删除虚拟主机信息,成功");
} else {
result.setCode("500");
result.setMsg("删除虚拟主机信息,失败");
}
return result;
}
/**
* 批量删除,虚拟主机
*
* @param ids 需被删除的服务器的id以','相连接的字符串
* @return {@link ResultJson}
*/
@GetMapping("/batchRemove")
public ResultJson batchRemoveVirtualHost(String ids) {
ResultJson result = new ResultJson<>();
int num = virtualHostService.deleteByPrimaryKey(ids);
if (num > 0) {
result.setCode("200");
result.setMsg("批量删除虚拟主机,成功!");
} else {
result.setCode("500");
result.setMsg("批量删除虚拟主机,失败!");
}
return result;
}
/**
* 编辑虚拟机信息
*
* @param virtualHost {@link VirtualHost}
* @return {@link ResultJson}
*/
@PutMapping("/update")
public ResultJson updateVirtualHost(@RequestBody VirtualHost virtualHost) {
//先验证,修改好的核心信息(虚拟主机名称)是否已存在
String message = validateVirtualHost(virtualHost);
//验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
int num = virtualHostService.updateByPrimaryKeySelective(virtualHost);
if (num > 0) {
result.setCode("200");
result.setMsg("修改虚拟主机信息,成功");
} else {
result.setCode("500");
result.setMsg("修改虚拟主机信息,失败");
}
return result;
}
return new ResultJson("400", message != null ? message : "修改虚拟主机信息,失败!");
}
/**
* 新增虚拟主机
*
* @param virtualHost {@link VirtualHost}
* @return {@link ResultJson}
*/
@PostMapping("/insert")
public ResultJson insertVirtualHost(@RequestBody VirtualHost virtualHost) {
//先验证,增加的虚拟主机的核心信息(虚拟主机名称)是否已存在
String message = validateVirtualHost(virtualHost);
//验证通过
if (message == null) {
ResultJson result = new ResultJson<>();
// 设置id
virtualHost.setId(IdUtils.generateId());
int num = virtualHostService.insertSelective(virtualHost);
if (num > 0) {
result.setCode("200");
result.setMsg("添加虚拟主机信息,成功!");
} else {
result.setCode("500");
result.setMsg("添加虚拟主机信息,失败!");
}
return result;
}
return new ResultJson("400", message != null ? message : "添加虚拟主机信息,失败!");
}
/**
* 校验虚拟主机,添加和修改之前,是否已存在
*
* @param virtualHost {@link VirtualHost}
* @return 通过,无返回消息
*/
private String validateVirtualHost(VirtualHost virtualHost) {
if ("".equals(virtualHost.getVirtualHostName()) || virtualHost.getVirtualHostName() == null) {
return "该虚拟主机信息中,没有虚拟主机名称";
}
// 如果id不为空,则是 update 操作
if (virtualHost.getId() != null && virtualHost.getId().length() != 0) {
// 根据 id 查询出原来的 虚拟主机 信息
VirtualHost oldVirtualHost = virtualHostService.selectByPrimaryKey(virtualHost.getId());
// 如果修改后的 virtualHostName,和原来的 virtualHostName 不一致,则校验 该 virtualHostName 是否已存在
if (!oldVirtualHost.getVirtualHostName().equals(virtualHost.getVirtualHostName())) {
// 根据 virtualHostName,进行查询校验
List<VirtualHost> info = virtualHostService.validateVirtualHost(virtualHost);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-虚拟主机(虚拟主机名称)-信息已存在,请谨慎输入";
}
return null;
}
// virtualHostName 一致,则代表着没有修改 virtualHostName,校验通过
return null;
}
// 如果id为空,则是 insert 操作
else {
// 根据 virtualHostName,进行查询校验
List<VirtualHost> info = virtualHostService.validateVirtualHost(virtualHost);
// 多于0个,则代表已存在;否则则是,校验通过
if (info.size() > 0) {
return "该-虚拟主机(虚拟主机名称)-信息已存在,请谨慎输入";
}
return null;
}
}
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:MQ路由交换表
* 时间:2020/7/1 10:08
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BusExchange implements Serializable {
private static final long serialVersionUID = -8533771450468596177L;
/**
* 交换机ID
*/
private String id;
/**
* 交换机名称
*/
private String exchangeName;
/**
* 所属虚拟主机ID
*/
private String virtualHostId;
/**
* 交换机类型:Direct exchange、Fanout exchange、Topic exchange、Headers exchange
*/
private String exchangeType;
/**
* 是否持久化,默认true:1是true;0是false
*/
private Boolean durability;
/**
* 是否自动删除,默认false:1是true;0是false
*/
private Boolean autoDelete;
/**
* 是否是RabbitMQ内部使用,默认false:1是true;0是false
*/
private Boolean internal;
/**
* 扩展参数,以JSON格式存储
*/
private String arguments;
/**
* 交换机相关描述
*/
private String description;
/**
* 交换机创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* 交换机修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:队列表
* 时间:2020/7/1 10:14
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BusQueue implements Serializable {
private static final long serialVersionUID = 4347677784198350308L;
/**
* 队列的ID
*/
private String id;
/**
* 队列名称
*/
private String queueName;
/**
* 所属虚拟主机ID
*/
private String virtualHostId;
/**
* 是否持久化,默认true:1是true;0是false
*/
private Boolean durability;
/**
* 是否自动删除,默认false:1是true;0是false
*/
private Boolean autoDelete;
/**
* 扩展参数,以JSON格式存储
*/
private String arguments;
/**
* 队列相关描述
*/
private String description;
/**
* 队列创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* 队列修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:MQ服务器静态信息表
* 时间:2020/7/1 10:02
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BusServer implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 服务器ID
*/
private String id;
/**
* 服务器名称
*/
private String serverName;
/**
* 服务器IP地址
*/
private String serverIp;
/**
* 服务器端口号
*/
private String serverPort;
/**
* 服务器相关描述
*/
private String description;
/**
* 服务器创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* 服务器修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:交换机、队列、routing_key绑定关系表
* 时间:2020/7/2 16:47
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExchangeQueueRouting implements Serializable {
private static final long serialVersionUID = 3765854915972798115L;
/**
* 交换机、队列、routing_key绑定关系的ID
*/
private String id;
/**
* 对应交换机ID
*/
private String exchangeId;
/**
* 对应队列的ID
*/
private String queueId;
/**
* 对应路由键的ID
*/
private String routingKeyId;
/**
* 对应路由键的名称
*/
private String routingKeyName;
/**
* 创建时间
*/
private Date gmtCreate;
/**
* 修改时间
*/
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:消息收发记录表(存储七天)
* 时间:2020/7/2 15:21
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MessageNote implements Serializable {
private static final long serialVersionUID = 6971204112114471516L;
/**
* 消息收发记录表的ID
*/
private String id;
/**
* 用户的ID
*/
private String userId;
/**
* 用户登陆名称
*/
private String username;
/**
* 服务器名称
*/
private String serverName;
/**
* 虚拟主机名称
*/
private String virtualHostName;
/**
* 交换机名称
*/
private String exchangeName;
/**
* routing_key的名称
*/
private String routingKeyName;
/**
* 队列名称
*/
private String queueName;
/**
* 消息发送时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date sendTime;
/**
* 消息获取时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date receiveTime;
/**
* 发送消息内容
*/
private byte[] sendContent;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:Routing key静态配置表/二级类
* 时间:2020/6/29 16:45
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RoutingKey implements Serializable {
private static final long serialVersionUID = 4318583918719126325L;
/**
* routing_key的ID
*/
private String id;
/**
* routing_key的名称
*/
private String routingKeyName;
/**
* 所属交换机ID
*/
private String exchangeId;
/**
* routing_key相关描述
*/
private String description;
/**
* routing_key创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* routing_key修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:MQ账户信息表
* 时间:2020/6/29 17:17
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserInfo implements Serializable {
private static final long serialVersionUID = -7311881151729617686L;
/**
* 用户的ID
*/
private String id;
/**
* 用户登陆名称
*/
private String username;
/**
* 用户登陆密码
*/
private String password;
/**
* 用户信息相关描述
*/
private String description;
/**
* 用户信息创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* 用户信息修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:账户消息绑定配置表
* 时间:2020/6/29 17:37
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserMessageBinding implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 账户消息绑定配置表的ID
*/
private String id;
/**
* 所属用户登陆名称
*/
private String username;
/**
* 所属虚拟主机名称
*/
private String virtualHostName;
/**
* 所属交换机名称
*/
private String exchangeName;
/**
* 所属队列名称
*/
private String queueName;
/**
* 所属routing_key的名称
*/
private String routingKeyName;
/**
* 订阅者
*/
private String subscriber;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:用户、服务器、虚拟机信息绑定关系表
* 时间:2020/7/2 11:35
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserServerVirtualHost implements Serializable {
private static final long serialVersionUID = -7376053283857221145L;
/**
* 用户、服务器、虚拟机信息绑定关系的ID
*/
private String id;
/**
* 所属用户登陆名称
*/
private String username;
/**
* 所属服务器ID
*/
private String serverId;
/**
* 所属虚拟主机ID
*/
private String virtualHostId;
/**
* 创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* 修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.domain;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author 子诚
* Description:MQ虚拟主机名称表
* 时间:2020/6/29 16:36
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class VirtualHost implements Serializable {
private static final long serialVersionUID = -3174914872904776153L;
/**
* 虚拟主机ID
*/
private String id;
/**
* 虚拟主机名称
*/
private String virtualHostName;
/**
* 所属服务器ID
*/
private String serverId;
/**
* 虚拟主机相关描述
*/
private String description;
/**
* 虚拟主机创建时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtCreate;
/**
* 虚拟主机修改时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date gmtModified;
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:08
*/
@Mapper
public interface BusExchangeMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(BusExchange record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(BusExchange record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
BusExchange selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(BusExchange record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(BusExchange record);
/**
* 查询交换机列表,选择性
*
* @param busExchange 交换机以及参数
* @return 交换机列表
*/
List<BusExchange> selectBusExchangeList(BusExchange busExchange);
/**
* 校验该服务器信息是否存在
*
* @param busExchange {@link BusExchange}
* @return List<BusExchange>
*/
List<BusExchange> validateBusExchange(BusExchange busExchange);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:14
*/
@Mapper
public interface BusQueueMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(BusQueue record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(BusQueue record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
BusQueue selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(BusQueue record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(BusQueue record);
/**
* 查询,消息队列列表,选择性
*
* @param busQueue 消息队列 {@link BusQueue}
* @return List<BusQueue>
*/
List<BusQueue> selectBusQueueList(BusQueue busQueue);
/**
* 校验-消息队列,是否已存在
*
* @param busQueue {@link BusQueue}
* @return List<BusQueue>
*/
List<BusQueue> validateBusQueue(BusQueue busQueue);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.BusServer;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:02
*/
@Mapper
public interface BusServerMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(BusServer record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(BusServer record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
BusServer selectByPrimaryKey(String id);
/**
* 查询服务器列表,选择性
*
* @param busServer 服务器以及参数
* @return 服务器列表
*/
List<BusServer> selectBusServerList(BusServer busServer);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(BusServer record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(BusServer record);
/**
* 校验该服务器信息是否存在
*
* @param busServer {@link BusServer}
* @return List<BusServer>
*/
List<BusServer> validateBusServer(BusServer busServer);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.ExchangeQueueRouting;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 子诚
* Description:
* 时间:2020/7/2 16:47
*/
@Mapper
public interface ExchangeQueueRoutingMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(ExchangeQueueRouting record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(ExchangeQueueRouting record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
ExchangeQueueRouting selectByPrimaryKey(String id);
/**
* 更新,根据主键,选择性
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(ExchangeQueueRouting record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(ExchangeQueueRouting record);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.MessageNote;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/2 15:21
*/
@Mapper
public interface MessageNoteMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(MessageNote record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(MessageNote record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
MessageNote selectByPrimaryKey(String id);
/**
* 更新,根据主键,选择性
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(MessageNote record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(MessageNote record);
/**
* 获取,消息收发记录-列表
*
* @param messageNote {@link MessageNote}
* @return List<MessageNote>
*/
List<MessageNote> selectMessageNoteList(MessageNote messageNote);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.RoutingKey;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 16:45
*/
@Mapper
public interface RoutingKeyMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(RoutingKey record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(RoutingKey record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
RoutingKey selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(RoutingKey record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(RoutingKey record);
/**
* 查询,路由键列表,选择性
*
* @param routingKey 路由键参数类
* @return List<RoutingKey> {@link RoutingKey}
*/
List<RoutingKey> selectRoutingKeyList(RoutingKey routingKey);
/**
* 校验,路由键是否已存在
*
* @param routingKey 路由键 {@link RoutingKey}
* @return List<RoutingKey>
*/
List<RoutingKey> validateRoutingKey(RoutingKey routingKey);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.UserInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:17
*/
@Mapper
public interface UserInfoMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(UserInfo record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(UserInfo record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
UserInfo selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(UserInfo record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(UserInfo record);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:37
*/
@Mapper
public interface UserMessageBindingMapper {
/**
* 根据主键删除
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(UserMessageBinding record);
/**
* 选择性增加
*
* @param record the record
* @return insert count
*/
int insertSelective(UserMessageBinding record);
/**
* 根据主键查询
*
* @param id primary key
* @return object by primary key
*/
UserMessageBinding selectByPrimaryKey(String id);
/**
* 选择性更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(UserMessageBinding record);
/**
* 根据主键更新
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(UserMessageBinding record);
/**
* 分页查询,获取账户信息绑定配置列表
*
* @param userMessageBinding {@link UserMessageBinding}
* @return List<UserMessageBinding>
*/
List<UserMessageBinding> selectUserMessageBindingList(UserMessageBinding userMessageBinding);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.UserServerVirtualHost;
import org.apache.ibatis.annotations.Mapper;
/**
* @author 子诚
* Description:
* 时间:2020/7/2 11:35
*/
@Mapper
public interface UserServerVirtualHostMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(UserServerVirtualHost record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(UserServerVirtualHost record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
UserServerVirtualHost selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(UserServerVirtualHost record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(UserServerVirtualHost record);
}
... ...
package com.sunyo.wlpt.message.bus.service.mapper;
import com.sunyo.wlpt.message.bus.service.domain.VirtualHost;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 16:36
*/
@Mapper
public interface VirtualHostMapper {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(VirtualHost record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(VirtualHost record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
VirtualHost selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(VirtualHost record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(VirtualHost record);
/**
* 查询虚拟主机列表,选择性
*
* @param virtualHost 虚拟主机,参数
* @return 虚拟主机列表
*/
List<VirtualHost> selectVirtualHostList(VirtualHost virtualHost);
/**
* 校验该服务器信息是否存在
*
* @param virtualHost {@link VirtualHost}
* @return List<VirtualHost>
*/
List<VirtualHost> validateVirtualHost(VirtualHost virtualHost);
}
... ...
package com.sunyo.wlpt.message.bus.service.rabbit;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
/**
* @author 子诚
* Description:RabbitMQ 的工具类
* 时间:2020/6/30 9:39
*/
public class RabbitUtils {
/**
* 链接 RabbitMQ
*
* @param hostIp mq服务器Ip地址
* @param hostPort mq服务器端口号
* @param vHostName VirtualHost名称
* @param userName 登录账号
* @param password 登录密码
* @return 返回链接
* @throws Exception
*/
public static Connection getConnection(String hostIp, int hostPort, String vHostName, String userName, String password) throws Exception {
//定义连接工厂
ConnectionFactory factory = new ConnectionFactory();
//设置服务地址
factory.setHost(hostIp);
//端口
factory.setPort(hostPort);
//设置账号信息,用户名、密码、vhost
factory.setVirtualHost(vHostName);
factory.setUsername(userName);
factory.setPassword(password);
// 通过工程获取连接
Connection connection = factory.newConnection();
return connection;
}
/**
* 关闭通道和关闭连接的工具方法
*
* @param channel 通道
* @param conn 连接
*/
public static void closeConnectionAndChanel(Channel channel, Connection conn) {
try {
if (channel != null) {
channel.close();
}
if (conn != null) {
conn.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
... ...
package com.sunyo.wlpt.message.bus.service.response;
import lombok.Data;
import java.io.Serializable;
/**
* @author 子诚
* Description:返回结果封装类
* 时间:2020/7/01 10:06
*/
@Data
public class ResultJson<T> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 响应业务状态,默认为200
*/
private String code;
/**
* 响应消息
*/
private String msg = "";
/**
* 错误消息内容
*/
private String error;
/**
* 响应数据
*/
private T data;
/**
* JWT令牌
*/
private String jwtToken;
/**
* 无参,构造方法
*/
public ResultJson() {
}
/**
* 有参,构造方法;
* 重载
*/
public ResultJson(String code) {
this.code = code;
}
public ResultJson(T data) {
this.data = data;
}
public ResultJson(String code, String msg) {
this.code = code;
this.msg = msg;
}
public ResultJson(String code, String msg, T data) {
this.code = code;
this.msg = msg;
this.data = data;
}
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
import com.sunyo.wlpt.message.bus.service.domain.VirtualHost;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:08
*/
public interface BusExchangeService {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(BusExchange record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(BusExchange record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
BusExchange selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(BusExchange record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(BusExchange record);
/**
* 分页查询交换机列表
*
* @param busExchange {@link BusExchange}
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return MQ交换机列表
*/
PageInfo selectBusExchangeList(BusExchange busExchange, Integer pageNum, Integer pageSize);
/**
* 校验该服务器信息是否存在
*
* @param busExchange {@link BusExchange}
* @return List<BusExchange>
*/
List<BusExchange> validateBusExchange(BusExchange busExchange);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:14
*/
public interface BusQueueService {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(BusQueue record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(BusQueue record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
BusQueue selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(BusQueue record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(BusQueue record);
/**
* 分页查询,消息队列-列表
*
* @param busQueue 消息队列
* @param pageNum 当前页数
* @param pageSize 每页条数
* @return 消息队列-列表
*/
PageInfo selectBusQueueList(BusQueue busQueue, Integer pageNum, Integer pageSize);
/**
* 校验-消息队列,是否已存在
*
* @param busQueue {@link BusQueue}
* @return List<BusQueue>
*/
List<BusQueue> validateBusQueue(BusQueue busQueue);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusServer;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:02
*/
public interface BusServerService {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(BusServer record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(BusServer record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
BusServer selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(BusServer record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(BusServer record);
/**
* 分页查询服务器列表
*
* @param busServer 参数
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return MQ服务器列表
*/
PageInfo selectBusServerList(BusServer busServer, Integer pageNum, Integer pageSize);
/**
* 校验该服务器信息是否存在
*
* @param busServer {@link BusServer}
* @return List<BusServer>
*/
List<BusServer> validateBusServer(BusServer busServer);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.sunyo.wlpt.message.bus.service.domain.ExchangeQueueRouting;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:07
*/
public interface ExchangeQueueRoutingService {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(ExchangeQueueRouting record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(ExchangeQueueRouting record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
ExchangeQueueRouting selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(ExchangeQueueRouting record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(ExchangeQueueRouting record);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.MessageNote;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:46
*/
public interface MessageNoteService {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(MessageNote record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(MessageNote record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
MessageNote selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(MessageNote record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(MessageNote record);
/**
* 分页查询,消息收发记录
*
* @param messageNote {@link MessageNote}
* @param pageNum 当前页数,默认 1
* @param pageSize 每页条数,默认 10
* @return 消息收发记录-列表
*/
PageInfo selectMessageNoteList(MessageNote messageNote, Integer pageNum, Integer pageSize);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
import com.sunyo.wlpt.message.bus.service.domain.RoutingKey;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 16:45
*/
public interface RoutingKeyService {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(RoutingKey record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(RoutingKey record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
RoutingKey selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(RoutingKey record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(RoutingKey record);
/**
* 分页查询,路由键列表
*
* @param routingKey 路由键 {@link RoutingKey}
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return 路由键列表
*/
PageInfo selectRoutingKeyList(RoutingKey routingKey, Integer pageNum, Integer pageSize);
/**
* 校验,路由键是否已存在
*
* @param routingKey 路由键 {@link RoutingKey}
* @return List<RoutingKey>
*/
List<RoutingKey> validateRoutingKey(RoutingKey routingKey);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.sunyo.wlpt.message.bus.service.domain.UserInfo;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:15
*/
public interface UserInfoService {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(UserInfo record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(UserInfo record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
UserInfo selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(UserInfo record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(UserInfo record);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.UserMessageBinding;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:37
*/
public interface UserMessageBindingService {
/**
* 根据主键删除
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(UserMessageBinding record);
/**
* 选择性增加
*
* @param record the record
* @return insert count
*/
int insertSelective(UserMessageBinding record);
/**
* 根据主键查询
*
* @param id primary key
* @return object by primary key
*/
UserMessageBinding selectByPrimaryKey(String id);
/**
* 选择性更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(UserMessageBinding record);
/**
* 根据主键更新
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(UserMessageBinding record);
/**
* 分页查询
*
* @param userMessageBinding {@link UserMessageBinding}
* @param pageNum 当前页数
* @param pageSize 每页条数
* @return PageInfo
*/
PageInfo selectUserMessageBindingList(UserMessageBinding userMessageBinding, Integer pageNum, Integer pageSize);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.sunyo.wlpt.message.bus.service.domain.UserServerVirtualHost;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:31
*/
public interface UserServerVirtualHostService {
/**
* 根据主键删除
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(UserServerVirtualHost record);
/**
* 选择性增加
*
* @param record the record
* @return insert count
*/
int insertSelective(UserServerVirtualHost record);
/**
* 根据主键查询
*
* @param id primary key
* @return object by primary key
*/
UserServerVirtualHost selectByPrimaryKey(String id);
/**
* 选择性更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(UserServerVirtualHost record);
/**
* 根据主键更新
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(UserServerVirtualHost record);
}
... ...
package com.sunyo.wlpt.message.bus.service.service;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusServer;
import com.sunyo.wlpt.message.bus.service.domain.VirtualHost;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 16:36
*/
public interface VirtualHostService {
/**
* 删除,根据主键
*
* @param id primaryKey
* @return deleteCount
*/
int deleteByPrimaryKey(String id);
/**
* 新增
*
* @param record the record
* @return insert count
*/
int insert(VirtualHost record);
/**
* 新增,选择性
*
* @param record the record
* @return insert count
*/
int insertSelective(VirtualHost record);
/**
* 查询,根据主键
*
* @param id primary key
* @return object by primary key
*/
VirtualHost selectByPrimaryKey(String id);
/**
* 更新,选择性,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKeySelective(VirtualHost record);
/**
* 更新,根据主键
*
* @param record the updated record
* @return update count
*/
int updateByPrimaryKey(VirtualHost record);
/**
* 分页查询,虚拟主机列表
*
* @param virtualHost 参数
* @param pageNum 当前页数
* @param pageSize 每页数量
* @return 虚拟主机列表
*/
PageInfo selectVirtualHostList(VirtualHost virtualHost, Integer pageNum, Integer pageSize);
/**
* 校验该服务器信息是否存在
*
* @param virtualHost {@link VirtualHost}
* @return List<VirtualHost>
*/
List<VirtualHost> validateVirtualHost(VirtualHost virtualHost);
}
... ...
package com.sunyo.wlpt.message.bus.service.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
import com.sunyo.wlpt.message.bus.service.mapper.BusExchangeMapper;
import com.sunyo.wlpt.message.bus.service.service.BusExchangeService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:08
*/
@Service
public class BusExchangeServiceImpl implements BusExchangeService {
@Resource
private BusExchangeMapper busExchangeMapper;
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public int deleteByPrimaryKey(String id) {
// 判断删除的个数,需被删除的个数是否一致
int index = 0;
String splitItem = ",";
//如果id,传过来多个,以','分割,即批量删除
if (id.contains(splitItem)) {
try {
String[] split = id.split(splitItem);
for (int i = 0; i < split.length; i++) {
int num = busExchangeMapper.deleteByPrimaryKey(split[i]);
if (num > 0) {
index = index + num;
}
}
if (index == split.length) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
} else {
return busExchangeMapper.deleteByPrimaryKey(id);
}
}
@Override
public int insert(BusExchange record) {
return busExchangeMapper.insert(record);
}
@Override
public int insertSelective(BusExchange record) {
return busExchangeMapper.insertSelective(record);
}
@Override
public BusExchange selectByPrimaryKey(String id) {
return busExchangeMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(BusExchange record) {
return busExchangeMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(BusExchange record) {
return busExchangeMapper.updateByPrimaryKey(record);
}
@Override
public PageInfo selectBusExchangeList(BusExchange busExchange, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<BusExchange> busExchangeList = busExchangeMapper.selectBusExchangeList(busExchange);
PageInfo<BusExchange> pageInfo = new PageInfo<>(busExchangeList);
return pageInfo;
}
@Override
public List<BusExchange> validateBusExchange(BusExchange busExchange) {
return busExchangeMapper.validateBusExchange(busExchange);
}
}
... ...
package com.sunyo.wlpt.message.bus.service.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusExchange;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import com.sunyo.wlpt.message.bus.service.mapper.BusQueueMapper;
import com.sunyo.wlpt.message.bus.service.service.BusQueueService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:14
*/
@Service
public class BusQueueServiceImpl implements BusQueueService {
@Resource
private BusQueueMapper busQueueMapper;
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public int deleteByPrimaryKey(String id) {
// 判断删除的个数,需被删除的个数是否一致
int index = 0;
String splitItem = ",";
//如果id,传过来多个,以','分割,即批量删除
if (id.contains(splitItem)) {
try {
String[] split = id.split(splitItem);
for (int i = 0; i < split.length; i++) {
int num = busQueueMapper.deleteByPrimaryKey(split[i]);
if (num > 0) {
index = index + num;
}
}
if (index == split.length) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
} else {
return busQueueMapper.deleteByPrimaryKey(id);
}
}
@Override
public int insert(BusQueue record) {
return busQueueMapper.insert(record);
}
@Override
public int insertSelective(BusQueue record) {
return busQueueMapper.insertSelective(record);
}
@Override
public BusQueue selectByPrimaryKey(String id) {
return busQueueMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(BusQueue record) {
return busQueueMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(BusQueue record) {
return busQueueMapper.updateByPrimaryKey(record);
}
@Override
public PageInfo selectBusQueueList(BusQueue busQueue, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<BusQueue> busQueueList = busQueueMapper.selectBusQueueList(busQueue);
PageInfo<BusQueue> pageInfo = new PageInfo<>(busQueueList);
return pageInfo;
}
@Override
public List<BusQueue> validateBusQueue(BusQueue busQueue) {
return busQueueMapper.validateBusQueue(busQueue);
}
}
... ...
package com.sunyo.wlpt.message.bus.service.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.sunyo.wlpt.message.bus.service.mapper.BusServerMapper;
import com.sunyo.wlpt.message.bus.service.domain.BusServer;
import com.sunyo.wlpt.message.bus.service.service.BusServerService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/7/1 10:02
*/
@Service
public class BusServerServiceImpl implements BusServerService {
@Resource
private BusServerMapper busServerMapper;
@Override
public PageInfo selectBusServerList(BusServer busServer, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<BusServer> busServerList = busServerMapper.selectBusServerList(busServer);
PageInfo<BusServer> pageInfo = new PageInfo<>(busServerList);
return pageInfo;
}
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public int deleteByPrimaryKey(String id) {
// 判断删除的个数,需被删除的个数是否一致
int index = 0;
String splitItem = ",";
//如果id,传过来多个,以','分割,即批量删除
if (id.contains(splitItem)) {
try {
String[] split = id.split(splitItem);
for (int i = 0; i < split.length; i++) {
int num = busServerMapper.deleteByPrimaryKey(split[i]);
if (num > 0) {
index = index + num;
}
}
if (index == split.length) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
} else {
return busServerMapper.deleteByPrimaryKey(id);
}
}
@Override
public int insert(BusServer record) {
return busServerMapper.insert(record);
}
@Override
public int insertSelective(BusServer record) {
return busServerMapper.insertSelective(record);
}
@Override
public BusServer selectByPrimaryKey(String id) {
return busServerMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(BusServer record) {
return busServerMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(BusServer record) {
return busServerMapper.updateByPrimaryKey(record);
}
@Override
public List<BusServer> validateBusServer(BusServer busServer) {
return busServerMapper.validateBusServer(busServer);
}
}
... ...
package com.sunyo.wlpt.message.bus.service.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.sunyo.wlpt.message.bus.service.mapper.ExchangeQueueRoutingMapper;
import com.sunyo.wlpt.message.bus.service.domain.ExchangeQueueRouting;
import com.sunyo.wlpt.message.bus.service.service.ExchangeQueueRoutingService;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:07
*/
@Service
public class ExchangeQueueRoutingServiceImpl implements ExchangeQueueRoutingService {
@Resource
private ExchangeQueueRoutingMapper exchangeQueueRoutingMapper;
@Override
public int deleteByPrimaryKey(String id) {
return exchangeQueueRoutingMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(ExchangeQueueRouting record) {
return exchangeQueueRoutingMapper.insert(record);
}
@Override
public int insertSelective(ExchangeQueueRouting record) {
return exchangeQueueRoutingMapper.insertSelective(record);
}
@Override
public ExchangeQueueRouting selectByPrimaryKey(String id) {
return exchangeQueueRoutingMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(ExchangeQueueRouting record) {
return exchangeQueueRoutingMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(ExchangeQueueRouting record) {
return exchangeQueueRoutingMapper.updateByPrimaryKey(record);
}
}
... ...
package com.sunyo.wlpt.message.bus.service.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusQueue;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.sunyo.wlpt.message.bus.service.mapper.MessageNoteMapper;
import com.sunyo.wlpt.message.bus.service.domain.MessageNote;
import com.sunyo.wlpt.message.bus.service.service.MessageNoteService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:46
*/
@Service
public class MessageNoteServiceImpl implements MessageNoteService {
@Resource
private MessageNoteMapper messageNoteMapper;
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public int deleteByPrimaryKey(String id) {
// 判断删除的个数,需被删除的个数是否一致
int index = 0;
String splitItem = ",";
//如果id,传过来多个,以','分割,即批量删除
if (id.contains(splitItem)) {
try {
String[] split = id.split(splitItem);
for (int i = 0; i < split.length; i++) {
int num = messageNoteMapper.deleteByPrimaryKey(split[i]);
if (num > 0) {
index = index + num;
}
}
if (index == split.length) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
} else {
return messageNoteMapper.deleteByPrimaryKey(id);
}
}
@Override
public int insert(MessageNote record) {
return messageNoteMapper.insert(record);
}
@Override
public int insertSelective(MessageNote record) {
return messageNoteMapper.insertSelective(record);
}
@Override
public MessageNote selectByPrimaryKey(String id) {
return messageNoteMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(MessageNote record) {
return messageNoteMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(MessageNote record) {
return messageNoteMapper.updateByPrimaryKey(record);
}
@Override
public PageInfo selectMessageNoteList(MessageNote messageNote, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<MessageNote> messageNoteList = messageNoteMapper.selectMessageNoteList(messageNote);
PageInfo<MessageNote> pageInfo = new PageInfo<>(messageNoteList);
return pageInfo;
}
}
... ...
package com.sunyo.wlpt.message.bus.service.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sunyo.wlpt.message.bus.service.domain.BusServer;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.sunyo.wlpt.message.bus.service.mapper.RoutingKeyMapper;
import com.sunyo.wlpt.message.bus.service.domain.RoutingKey;
import com.sunyo.wlpt.message.bus.service.service.RoutingKeyService;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 16:45
*/
@Service
public class RoutingKeyServiceImpl implements RoutingKeyService {
@Resource
private RoutingKeyMapper routingKeyMapper;
@Override
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public int deleteByPrimaryKey(String id) {
// 判断删除的个数,需被删除的个数是否一致
int index = 0;
String splitItem = ",";
//如果id,传过来多个,以','分割,即批量删除
if (id.contains(splitItem)) {
try {
String[] split = id.split(splitItem);
for (int i = 0; i < split.length; i++) {
int num = routingKeyMapper.deleteByPrimaryKey(split[i]);
if (num > 0) {
index = index + num;
}
}
if (index == split.length) {
return 1;
} else {
return 0;
}
} catch (Exception e) {
e.printStackTrace();
return 0;
}
} else {
return routingKeyMapper.deleteByPrimaryKey(id);
}
}
@Override
public int insert(RoutingKey record) {
return routingKeyMapper.insert(record);
}
@Override
public int insertSelective(RoutingKey record) {
return routingKeyMapper.insertSelective(record);
}
@Override
public RoutingKey selectByPrimaryKey(String id) {
return routingKeyMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(RoutingKey record) {
return routingKeyMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(RoutingKey record) {
return routingKeyMapper.updateByPrimaryKey(record);
}
@Override
public PageInfo selectRoutingKeyList(RoutingKey routingKey, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<RoutingKey> routingKeyList = routingKeyMapper.selectRoutingKeyList(routingKey);
PageInfo<RoutingKey> pageInfo = new PageInfo<>(routingKeyList);
return pageInfo;
}
@Override
public List<RoutingKey> validateRoutingKey(RoutingKey routingKey) {
return routingKeyMapper.validateRoutingKey(routingKey);
}
}
... ...
package com.sunyo.wlpt.message.bus.service.service.impl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.sunyo.wlpt.message.bus.service.mapper.UserInfoMapper;
import com.sunyo.wlpt.message.bus.service.domain.UserInfo;
import com.sunyo.wlpt.message.bus.service.service.UserInfoService;
/**
* @author 子诚
* Description:
* 时间:2020/6/29 17:15
*/
@Service
public class UserInfoServiceImpl implements UserInfoService {
@Resource
private UserInfoMapper userInfoMapper;
@Override
public int deleteByPrimaryKey(String id) {
return userInfoMapper.deleteByPrimaryKey(id);
}
@Override
public int insert(UserInfo record) {
return userInfoMapper.insert(record);
}
@Override
public int insertSelective(UserInfo record) {
return userInfoMapper.insertSelective(record);
}
@Override
public UserInfo selectByPrimaryKey(String id) {
return userInfoMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(UserInfo record) {
return userInfoMapper.updateByPrimaryKeySelective(record);
}
@Override
public int updateByPrimaryKey(UserInfo record) {
return userInfoMapper.updateByPrimaryKey(record);
}
}
... ...