代码优化-改名
This commit is contained in:
12
example/mqtt-car/src/main/resources/application-dev.yml
Normal file
12
example/mqtt-car/src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/xa_cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: root
|
||||
data:
|
||||
redis:
|
||||
host: 192.168.2.30
|
||||
password: redis2025
|
||||
database: 5
|
||||
port: 6379
|
||||
17
example/mqtt-car/src/main/resources/application-prod.yml
Normal file
17
example/mqtt-car/src/main/resources/application-prod.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/jl_cloud?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
#xa
|
||||
# password: Xahg2024.
|
||||
#jl
|
||||
# password: JL202509jj
|
||||
#td
|
||||
password: td@JJ2024
|
||||
data:
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
password:
|
||||
database: 1
|
||||
129
example/mqtt-car/src/main/resources/application.yml
Normal file
129
example/mqtt-car/src/main/resources/application.yml
Normal file
@@ -0,0 +1,129 @@
|
||||
server:
|
||||
port: 30013
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: mica-mqtt-server
|
||||
# 环境 dev|test|prod
|
||||
profiles:
|
||||
# active: dev
|
||||
active: prod
|
||||
messages:
|
||||
encoding: UTF-8
|
||||
basename: i18n/messages
|
||||
# jackson时间格式化
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ANT_PATH_MATCHER
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
enabled: true
|
||||
|
||||
#mybatis
|
||||
#mybatis-plus:
|
||||
# mapper-locations: classpath*:/mapper/**/*.xml
|
||||
# #实体扫描,多个package用逗号或者分号分隔
|
||||
# typeAliasesPackage: io.renren.entity
|
||||
# global-config:
|
||||
# #数据库相关配置
|
||||
# db-config:
|
||||
# #主键类型
|
||||
# id-type: ASSIGN_ID
|
||||
# banner: false
|
||||
# #原生配置
|
||||
# configuration:
|
||||
# map-underscore-to-camel-case: true
|
||||
# cache-enabled: false
|
||||
# call-setters-on-nulls: true
|
||||
# jdbc-type-for-null: 'null'
|
||||
# configuration-properties:
|
||||
# prefix:
|
||||
# blobType: BLOB
|
||||
# boolValue: TRUE
|
||||
|
||||
|
||||
|
||||
# mqtt 服务端配置
|
||||
mqtt:
|
||||
server:
|
||||
enabled: true # 是否开启服务端,默认:true
|
||||
name: Mica-Mqtt-Server # 名称,默认:Mica-Mqtt-Server
|
||||
heartbeat-timeout: 120000 # 心跳超时,单位毫秒,默认: 1000 * 120
|
||||
read-buffer-size: 8KB # 接收数据的 buffer size,默认:8k
|
||||
max-bytes-in-message: 10MB # 消息解析最大 bytes 长度,默认:10M
|
||||
auth:
|
||||
enable: true # 是否开启 mqtt 认证
|
||||
username: admin # mqtt 认证用户名
|
||||
password: admin@123 # mqtt 认证密码
|
||||
debug: true # 如果开启 prometheus 指标收集建议关闭
|
||||
stat-enable: true # 开启指标收集,debug 和 prometheus 开启时需要打开,默认开启,关闭节省内存
|
||||
mqtt-listener: # mqtt 监听器
|
||||
enable: true # 是否开启,默认:false
|
||||
# ip: "0.0.0.0" # 服务端 ip 默认为空,0.0.0.0,建议不要设置
|
||||
port: 1883 # 端口,默认:1883
|
||||
mqtt-ssl-listener: # mqtt ssl 监听器
|
||||
enable: false # 是否开启,默认:false
|
||||
port: 8883 # 端口,默认:8883
|
||||
ssl: # ssl 配置,必须
|
||||
keystore-path: # 必须参数:ssl keystore 目录,支持 classpath:/ 路径。
|
||||
keystore-pass: # 必选参数:ssl keystore 密码
|
||||
truststore-path: # 可选参数:ssl 双向认证 truststore 目录,支持 classpath:/ 路径。
|
||||
truststore-pass: # 可选参数:ssl 双向认证 truststore 密码
|
||||
client-auth: none # 是否需要客户端认证(双向认证),默认:NONE(不需要)
|
||||
ws-listener: # websocket mqtt 监听器
|
||||
enable: true # 是否开启,默认:false
|
||||
port: 8083 # websocket 端口,默认:8083
|
||||
wss-listener: # websocket ssl mqtt 监听器
|
||||
enable: false # 是否开启,默认:false
|
||||
port: 8084 # 端口,默认:8084
|
||||
ssl: # ssl 配置,必须
|
||||
keystore-path: # 必须参数:ssl keystore 目录,支持 classpath:/ 路径。
|
||||
keystore-pass: # 必选参数:ssl keystore 密码
|
||||
truststore-path: # 可选参数:ssl 双向认证 truststore 目录,支持 classpath:/ 路径。
|
||||
truststore-pass: # 可选参数:ssl 双向认证 truststore 密码
|
||||
client-auth: none # 是否需要客户端认证(双向认证),默认:NONE(不需要)
|
||||
http-listener:
|
||||
enable: true
|
||||
port: 18083
|
||||
basic-auth: # 基础认证
|
||||
enable: true
|
||||
username: mica
|
||||
password: mica
|
||||
mcp-server: # 大模型 mcp
|
||||
enable: true
|
||||
|
||||
springdoc:
|
||||
swagger-ui:
|
||||
urls:
|
||||
- name: swagger
|
||||
url: /v3/api-docs
|
||||
|
||||
# actuator management
|
||||
management:
|
||||
info:
|
||||
defaults:
|
||||
enabled: true
|
||||
metrics:
|
||||
tags:
|
||||
application: ${spring.application.name}
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
prometheus:
|
||||
enabled: true
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: '*'
|
||||
|
||||
logging:
|
||||
level:
|
||||
root: info
|
||||
server: info # t-io 服务端默认日志
|
||||
org.tio: info # t-io 服务端默认日志
|
||||
org.dromara.mica.mqtt: info # mica-mqtt 日志
|
||||
12
example/mqtt-car/src/main/resources/banner.txt
Normal file
12
example/mqtt-car/src/main/resources/banner.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
${AnsiColor.BRIGHT_BLUE}## ## #### ###### ### ${AnsiColor.RED} ## ## ####### ######## ########
|
||||
${AnsiColor.BRIGHT_BLUE}### ### ## ## ## ## ## ${AnsiColor.RED} ### ### ## ## ## ##
|
||||
${AnsiColor.BRIGHT_BLUE}#### #### ## ## ## ## ${AnsiColor.RED} #### #### ## ## ## ##
|
||||
${AnsiColor.BRIGHT_BLUE}## ### ## ## ## ## ##${AnsiColor.RED} ## ### ## ## ## ## ##
|
||||
${AnsiColor.BRIGHT_BLUE}## ## ## ## #########${AnsiColor.RED} ## ## ## ## ## ## ##
|
||||
${AnsiColor.BRIGHT_BLUE}## ## ## ## ## ## ##${AnsiColor.RED} ## ## ## ## ## ##
|
||||
${AnsiColor.BRIGHT_BLUE}## ## #### ###### ## ##${AnsiColor.RED} ## ## ##### ## ## ##
|
||||
|
||||
https://www.dreamlu.net
|
||||
|
||||
${AnsiColor.BRIGHT_BLUE}:: ${spring.application.name} :: Running Spring Boot ${spring-boot.version} 🏃🏃🏃 ${AnsiColor.DEFAULT}
|
||||
78
example/mqtt-car/src/main/resources/mapper/CarInfoMapper.xml
Normal file
78
example/mqtt-car/src/main/resources/mapper/CarInfoMapper.xml
Normal file
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.mica.mqtt.server.mapper.CarInfoMapper">
|
||||
|
||||
<resultMap type="org.dromara.mica.mqtt.server.entity.CarInfo" id="CarInfoResult">
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="enableTime" column="enable_time" />
|
||||
<result property="overdueTime" column="overdue_time" />
|
||||
<result property="enable" column="enable" />
|
||||
<result property="plate" column="plate" />
|
||||
<result property="timeSegEnable" column="time_seg_enable" />
|
||||
<result property="segTime" column="seg_time" />
|
||||
<result property="needAlarm" column="need_alarm" />
|
||||
<result property="vehicleCode" column="vehicle_code" />
|
||||
<result property="vehicleComment" column="vehicle_comment" />
|
||||
<result property="peopleId" column="people_id" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="sync" column="sync" />
|
||||
<result property="overclockCard" column="overclock_card" />
|
||||
<result property="sn" column="sequence" />
|
||||
<result property="carParkRecordId" column="carParkRecordId" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCarInfoVo">
|
||||
select ci.customer_id, ci.enable_time, ci.overdue_time, ci.enable, ci.plate, ci.time_seg_enable, ci.seg_time,
|
||||
ci.need_alarm, ci.vehicle_code, ci.vehicle_comment, ci.people_id, ci.del_flag, ci.sync, ci.remark,
|
||||
ci.create_by, ci.create_time, ci.update_by, ci.update_time, ci.overclock_card
|
||||
from car_info ci
|
||||
left join car_park cp on ci.park_id=cp.id
|
||||
left join sys_people p on ci.people_id=p.id
|
||||
left join car_park_record cpr on cpr.customer_id=ci.customer_id
|
||||
left join sys_equipment se on cpr.equipment_id=se.id
|
||||
</sql>
|
||||
|
||||
<select id="selectCarInfoList" parameterType="org.dromara.mica.mqtt.server.entity.CarInfo" resultMap="CarInfoResult">
|
||||
SELECT
|
||||
ci.customer_id,
|
||||
ci.enable_time,
|
||||
ci.overdue_time,
|
||||
ci.`enable`,
|
||||
ci.plate,
|
||||
ci.time_seg_enable,
|
||||
ci.seg_time,
|
||||
ci.need_alarm,
|
||||
ci.vehicle_code,
|
||||
ci.vehicle_comment,
|
||||
ci.people_id,
|
||||
ci.del_flag,
|
||||
ci.sync,
|
||||
ci.remark,
|
||||
ci.create_by,
|
||||
ci.create_time,
|
||||
ci.update_by,
|
||||
ci.update_time,
|
||||
ci.overclock_card,
|
||||
se.sequence,
|
||||
cpr.id as carParkRecordId
|
||||
FROM car_info ci
|
||||
LEFT JOIN car_park cp ON ci.park_id = cp.id
|
||||
LEFT JOIN sys_people p ON ci.people_id = p.id
|
||||
LEFT JOIN car_park_record cpr ON cpr.customer_id = ci.customer_id
|
||||
LEFT JOIN sys_equipment se ON cpr.equipment_id = se.id
|
||||
<where>
|
||||
<if test="enableTime != null "> and ci.enable_time = #{enableTime}</if>
|
||||
<if test="overdueTime != null "> and ci.overdue_time = #{overdueTime}</if>
|
||||
<if test="enable != null and enable != ''"> and ci.enable = #{enable}</if>
|
||||
<if test="plate != null and plate != ''"> and ci.plate = #{plate}</if>
|
||||
<if test="peopleId != null "> and ci.people_id = #{peopleId}</if>
|
||||
<if test="sn != null "> and se.sequence = #{sn}</if>
|
||||
<if test="delFlag != null "> and ci.del_flag = #{delFlag}</if>
|
||||
<if test="sync != null "> and cpr.sync = #{sync}</if>
|
||||
limit 10
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user