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