Merge remote-tracking branch 'origin/server_five_liuyunhu' into server_five_xiaoyao
commit
825026a357
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-modules</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>couplet-modules-mqtt</artifactId>
|
||||
|
||||
<!-- <properties>-->
|
||||
<!-- <maven.compiler.source>17</maven.compiler.source>-->
|
||||
<!-- <maven.compiler.target>17</maven.compiler.target>-->
|
||||
<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>-->
|
||||
<!-- </properties>-->
|
||||
|
||||
<description>
|
||||
couplet-modules-mqttx获取报文模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos Config -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringCloud Alibaba Sentinel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Actuator -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Swagger UI -->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
<version>${swagger.fox.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-datascope</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-log</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MuYu Common Swagger -->
|
||||
<dependency>
|
||||
<groupId>com.couplet</groupId>
|
||||
<artifactId>couplet-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mqttx依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.eclipse.paho</groupId>
|
||||
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
|
||||
<version>1.2.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- 加入maven deploy插件,当在deploy时,忽略些model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,26 @@
|
|||
package com.couplet.mqtt;
|
||||
|
||||
import com.couplet.common.security.annotation.EnableCustomConfig;
|
||||
import com.couplet.common.security.annotation.EnableMyFeignClients;
|
||||
import com.couplet.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import com.couplet.mqtt.service.impl.MqttListen;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @ProjectName: Default (Template) Project
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description:
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class LyhMqttxApplatcaion {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(LyhMqttxApplatcaion.class, args);
|
||||
System.out.println("获取报文模块启动成功");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.couplet.mqtt.controller;
|
||||
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
public class Test {
|
||||
public static void main(String[] args) {
|
||||
String broker = "tcp://115.159.47.13:1883";
|
||||
String clientId = "JavaMqttSubscriber";
|
||||
String topic = "test"; // 替换成您要订阅的主题
|
||||
|
||||
try {
|
||||
MqttClient client = new MqttClient(broker, clientId, new MemoryPersistence());
|
||||
MqttConnectOptions connOpts = new MqttConnectOptions();
|
||||
connOpts.setCleanSession(true);
|
||||
|
||||
System.out.println("Connecting to broker: " + broker);
|
||||
client.connect(connOpts);
|
||||
System.out.println("Connected");
|
||||
|
||||
client.setCallback(new MqttCallback() {
|
||||
@Override
|
||||
public void connectionLost(Throwable cause) {
|
||||
System.out.println("Connection lost");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage message) throws Exception {
|
||||
System.out.println("Received message: " + new String(message.getPayload()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||
}
|
||||
});
|
||||
|
||||
client.subscribe(topic);
|
||||
System.out.println("Subscribed to topic: " + topic);
|
||||
} catch (MqttException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.couplet.mqtt.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description:
|
||||
*/
|
||||
@Component
|
||||
@Mapper
|
||||
public interface MqttMapper {
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.couplet.mqtt.service;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
public interface MqttService {
|
||||
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.couplet.mqtt.service.impl;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description: mqtt客户端
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class MqttListen {
|
||||
/*
|
||||
* 路径
|
||||
* */
|
||||
@Value("${mqtt.server.broker}")
|
||||
private String BROKER;
|
||||
|
||||
/*
|
||||
* 主题
|
||||
* */
|
||||
@Value("${mqtt.server.topic}")
|
||||
private String TOPIC;
|
||||
|
||||
/*
|
||||
* 客户端id
|
||||
* */
|
||||
@Value("${mqtt.server.clientid}")
|
||||
private String CLIENTID;
|
||||
|
||||
/*
|
||||
* 用户名
|
||||
* */
|
||||
@Value("${mqtt.server.username}")
|
||||
private String USERNAME;
|
||||
|
||||
/*
|
||||
* 密码
|
||||
* */
|
||||
@Value("${mqtt.server.password}")
|
||||
private String PASSWORD;
|
||||
|
||||
/*
|
||||
* qos
|
||||
* */
|
||||
@Value("${mqtt.server.qos}")
|
||||
private Integer QOS;
|
||||
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void connect() {
|
||||
System.out.println("监听者启动");
|
||||
try {
|
||||
|
||||
MqttClient client = new MqttClient(BROKER, CLIENTID, new MemoryPersistence());
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setUserName(USERNAME);
|
||||
options.setPassword(PASSWORD.toCharArray());
|
||||
|
||||
//连接超时
|
||||
options.setConnectionTimeout(60);
|
||||
|
||||
//心跳
|
||||
options.setKeepAliveInterval(60);
|
||||
|
||||
log.info("连接到:"+BROKER);
|
||||
|
||||
client.connect(options);
|
||||
log.info("连接成功");
|
||||
|
||||
//设置回调
|
||||
client.setCallback(new MqttCallback() {
|
||||
@Override
|
||||
public void connectionLost(Throwable throwable) {
|
||||
log.error("连接断开:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage message) throws Exception {
|
||||
log.info("消息到达");
|
||||
log.info("接收消息主题:" + topic);
|
||||
log.info("接收消息Qos:" + message.getQos());
|
||||
log.info("接收消息内容:" + new String(message.getPayload()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||
log.info("消息发送成功----------" + token.isComplete());
|
||||
}
|
||||
});
|
||||
client.subscribe(TOPIC, QOS);
|
||||
|
||||
|
||||
} catch (MqttException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.couplet.mqtt.service.impl;
|
||||
|
||||
import com.couplet.mqtt.service.MqttService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/28
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class MqttServiceImpl implements MqttService {
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
|
@ -0,0 +1,40 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9616
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: couplet-mqtt
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 121.89.211.230:8848
|
||||
namespace: 172469
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
logging:
|
||||
level:
|
||||
com.couplet.system.mapper: DEBUG
|
||||
|
||||
# 订阅端配置
|
||||
mqtt:
|
||||
server:
|
||||
broker: tcp://115.159.47.13:1883
|
||||
username:
|
||||
password:
|
||||
clientid: mqttx
|
||||
qos: 0
|
||||
topic: test
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/couplet-system"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.couplet" level="info"/>
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn"/>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -2,7 +2,7 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.couplet.vehicle.mapper.LyhVehicleMapper">
|
||||
<mapper namespace="com.couplet.mqtt.mapper.MqttMapper">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -16,8 +16,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@EnableCustomSwagger2
|
||||
@EnableMyFeignClients
|
||||
@SpringBootApplication
|
||||
public class LyhVehicleApplication {
|
||||
public class CoupletVehicleApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(LyhVehicleApplication.class, args);
|
||||
SpringApplication.run(CoupletVehicleApplication.class, args);
|
||||
System.out.println("车辆管理模块启动成功");
|
||||
}
|
||||
}
|
|
@ -5,10 +5,10 @@ import com.couplet.common.core.web.controller.BaseController;
|
|||
import com.couplet.common.log.annotation.Log;
|
||||
import com.couplet.common.log.enums.BusinessType;
|
||||
import com.couplet.vehicle.domain.LyhVehicle;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleListParams;
|
||||
import com.couplet.vehicle.service.LyhVehicleService;
|
||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||
import com.couplet.vehicle.service.VehicleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -22,9 +22,9 @@ import java.util.List;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/vehicle")
|
||||
public class LyhVehicleController extends BaseController {
|
||||
public class VehicleController extends BaseController {
|
||||
@Autowired
|
||||
private LyhVehicleService lyhVehicleService;
|
||||
private VehicleService lyhVehicleService;
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
|
@ -35,7 +35,7 @@ public class LyhVehicleController extends BaseController {
|
|||
**/
|
||||
@PostMapping("/list")
|
||||
@Log(title = "车辆列表")
|
||||
public Result list(@RequestBody LyhVehicleListParams listParams) {
|
||||
public Result list(@RequestBody VehicleListParams listParams) {
|
||||
|
||||
List<LyhVehicle> List = lyhVehicleService.list(listParams);
|
||||
|
||||
|
@ -67,7 +67,7 @@ public class LyhVehicleController extends BaseController {
|
|||
**/
|
||||
@PostMapping("/editById")
|
||||
@Log(title = "编辑车辆", businessType = BusinessType.UPDATE)
|
||||
public Result editById(@RequestBody LyhVehicleEditParams editParams) {
|
||||
public Result editById(@RequestBody VehicleEditParams editParams) {
|
||||
|
||||
String result = lyhVehicleService.editById(editParams);
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class LyhVehicleController extends BaseController {
|
|||
**/
|
||||
@PostMapping("/insert")
|
||||
@Log(title = "新增车辆", businessType = BusinessType.INSERT)
|
||||
public Result insert(@RequestBody LyhVehicleInsertParams insertParams) {
|
||||
public Result insert(@RequestBody VehicleInsertParams insertParams) {
|
||||
|
||||
String result = lyhVehicleService.insert(insertParams);
|
||||
|
|
@ -16,7 +16,7 @@ import lombok.experimental.SuperBuilder;
|
|||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LyhVehicleEditParams {
|
||||
public class VehicleEditParams {
|
||||
/*
|
||||
*车辆id
|
||||
* */
|
|
@ -19,7 +19,7 @@ import javax.validation.constraints.NotNull;
|
|||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LyhVehicleInsertParams {
|
||||
public class VehicleInsertParams {
|
||||
|
||||
/*
|
||||
*车辆类型
|
|
@ -15,7 +15,7 @@ import lombok.experimental.SuperBuilder;
|
|||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class LyhVehicleListParams {
|
||||
public class VehicleListParams {
|
||||
/*
|
||||
*车辆类型
|
||||
* */
|
|
@ -13,5 +13,5 @@ import org.springframework.stereotype.Component;
|
|||
*/
|
||||
@Mapper
|
||||
@Component
|
||||
public interface LyhVehicleMapper extends BaseMapper<LyhVehicle> {
|
||||
public interface VehicleMapper extends BaseMapper<LyhVehicle> {
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package com.couplet.vehicle.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.couplet.vehicle.domain.LyhVehicle;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleListParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/26
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
public interface LyhVehicleService extends IService<LyhVehicle> {
|
||||
List<LyhVehicle> list(LyhVehicleListParams listParams);
|
||||
|
||||
String deleteById(Long vehicleId);
|
||||
|
||||
String editById(LyhVehicleEditParams editParams);
|
||||
|
||||
String insert(LyhVehicleInsertParams insertParams);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.couplet.vehicle.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.couplet.vehicle.domain.LyhVehicle;
|
||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ProjectName: five-groups-couplet
|
||||
* @Author: LiuYunHu
|
||||
* @CreateTime: 2024/3/26
|
||||
* @Description:
|
||||
*/
|
||||
|
||||
public interface VehicleService extends IService<LyhVehicle> {
|
||||
List<LyhVehicle> list(VehicleListParams listParams);
|
||||
|
||||
String deleteById(Long vehicleId);
|
||||
|
||||
String editById(VehicleEditParams editParams);
|
||||
|
||||
String insert(VehicleInsertParams insertParams);
|
||||
}
|
|
@ -5,11 +5,11 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.couplet.common.core.utils.StringUtils;
|
||||
import com.couplet.vehicle.domain.LyhVehicle;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.LyhVehicleListParams;
|
||||
import com.couplet.vehicle.mapper.LyhVehicleMapper;
|
||||
import com.couplet.vehicle.service.LyhVehicleService;
|
||||
import com.couplet.vehicle.domain.req.VehicleEditParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleInsertParams;
|
||||
import com.couplet.vehicle.domain.req.VehicleListParams;
|
||||
import com.couplet.vehicle.mapper.VehicleMapper;
|
||||
import com.couplet.vehicle.service.VehicleService;
|
||||
import com.couplet.vehicle.utils.SnowflakeIdGenerator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -26,9 +26,9 @@ import java.util.List;
|
|||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class LyhVehicleServiceImpl extends ServiceImpl<LyhVehicleMapper, LyhVehicle> implements LyhVehicleService {
|
||||
public class VehicleServiceImpl extends ServiceImpl<VehicleMapper, LyhVehicle> implements VehicleService {
|
||||
@Autowired
|
||||
private LyhVehicleMapper lyhVehicleMapper;
|
||||
private VehicleMapper lyhVehicleMapper;
|
||||
|
||||
/*
|
||||
* @Author: LiuYunHu
|
||||
|
@ -38,7 +38,7 @@ public class LyhVehicleServiceImpl extends ServiceImpl<LyhVehicleMapper, LyhVehi
|
|||
* @Return: java.util.List<com.couplet.vehicle.domain.LyhVehicle>
|
||||
**/
|
||||
@Override
|
||||
public List<LyhVehicle> list(LyhVehicleListParams listParams) {
|
||||
public List<LyhVehicle> list(VehicleListParams listParams) {
|
||||
// 创建查询条件包装器
|
||||
LambdaQueryWrapper<LyhVehicle> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class LyhVehicleServiceImpl extends ServiceImpl<LyhVehicleMapper, LyhVehi
|
|||
* @Return: java.lang.String
|
||||
**/
|
||||
@Override
|
||||
public String editById(LyhVehicleEditParams editParams) {
|
||||
public String editById(VehicleEditParams editParams) {
|
||||
String result = "";
|
||||
|
||||
UpdateWrapper<LyhVehicle> updateWrapper = new UpdateWrapper<>();
|
||||
|
@ -140,7 +140,7 @@ public class LyhVehicleServiceImpl extends ServiceImpl<LyhVehicleMapper, LyhVehi
|
|||
* @Return: java.lang.String
|
||||
**/
|
||||
@Override
|
||||
public String insert(LyhVehicleInsertParams insertParams) {
|
||||
public String insert(VehicleInsertParams insertParams) {
|
||||
String result = "";
|
||||
|
||||
SnowflakeIdGenerator idGenerator = new SnowflakeIdGenerator(1, 1);
|
|
@ -0,0 +1,8 @@
|
|||
<?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="com.couplet.vehicle.mapper.VehicleMapper">
|
||||
|
||||
|
||||
</mapper>
|
|
@ -16,6 +16,7 @@
|
|||
<module>couplet-trouble</module>
|
||||
<module>couplet-electronic-fence</module>
|
||||
<module>couplet-modules-vehicle</module>
|
||||
<module>couplet-modules-mqtt</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>couplet-modules</artifactId>
|
||||
|
|
Loading…
Reference in New Issue