diff --git a/couplet-modules/couplet-modules-vehicle/pom.xml b/couplet-modules/couplet-modules-vehicle/pom.xml new file mode 100644 index 0000000..bd06244 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/pom.xml @@ -0,0 +1,114 @@ + + + + com.couplet + couplet-modules + 3.6.3 + + 4.0.0 + + couplet-modules-vehicle + + + + + + + + + couplet-modules-vehicle车辆管理模块 + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + com.mysql + mysql-connector-j + + + + + com.couplet + couplet-common-datasource + + + + + com.couplet + couplet-common-datascope + + + + + com.couplet + couplet-common-log + + + + + com.couplet + couplet-common-swagger + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + true + + + + + + diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/LyhVehicleApplication.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/LyhVehicleApplication.java new file mode 100644 index 0000000..19937ef --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/LyhVehicleApplication.java @@ -0,0 +1,23 @@ +package com.couplet.vehicle; + +import com.couplet.common.security.annotation.EnableCustomConfig; +import com.couplet.common.security.annotation.EnableMyFeignClients; +import com.couplet.common.swagger.annotation.EnableCustomSwagger2; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @ProjectName: Default (Template) Project + * @Author: LiuYunHu + * @CreateTime: 2024/3/26 + * @Description: + */ +@EnableCustomConfig +@EnableCustomSwagger2 +@EnableMyFeignClients +@SpringBootApplication +public class LyhVehicleApplication { + public static void main(String[] args) { + SpringApplication.run(LyhVehicleApplication.class, args); + } +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/controller/LyhVehicleController.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/controller/LyhVehicleController.java new file mode 100644 index 0000000..f7900b8 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/controller/LyhVehicleController.java @@ -0,0 +1,92 @@ +package com.couplet.vehicle.controller; + +import com.couplet.common.core.domain.Result; +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 org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/26 + * @Description: + */ +@RestController +@RequestMapping("/vehicle") +public class LyhVehicleController extends BaseController { + @Autowired + private LyhVehicleService lyhVehicleService; + + /* + * @Author: LiuYunHu + * @Date: 2024/3/26 21:39 + * @Description: 查询车辆列表 + * @Param: [listParams] + * @Return: com.couplet.common.core.domain.Result + **/ + @PostMapping("/list") + @Log(title = "车辆列表") + public Result list(@RequestBody LyhVehicleListParams listParams) { + + List List = lyhVehicleService.list(listParams); + + return Result.success(List); + } + + /* + * @Author: LiuYunHu + * @Date: 2024/3/26 22:35 + * @Description: 通过id删除车辆 + * @Param: [vehicleId] + * @Return: com.couplet.common.core.domain.Result + **/ + @GetMapping("/deleteById/{vehicleId}") + @Log(title = "删除车辆", businessType = BusinessType.DELETE) + public Result deleteById(@PathVariable Long vehicleId) { + String result = lyhVehicleService.deleteById(vehicleId); + + return Result.success(result); + } + + + /* + * @Author: LiuYunHu + * @Date: 2024/3/27 16:09 + * @Description: 编辑车辆 + * @Param: [editParams] + * @Return: com.couplet.common.core.domain.Result + **/ + @PostMapping("/editById") + @Log(title = "编辑车辆", businessType = BusinessType.UPDATE) + public Result editById(@RequestBody LyhVehicleEditParams editParams) { + + String result = lyhVehicleService.editById(editParams); + + return Result.success(result); + } + + /* + * @Author: LiuYunHu + * @Date: 2024/3/27 16:21 + * @Description: 新增车辆 + * @Param: [insertParams] + * @Return: com.couplet.common.core.domain.Result + **/ + @PostMapping("/insert") + @Log(title = "新增车辆", businessType = BusinessType.INSERT) + public Result insert(@RequestBody LyhVehicleInsertParams insertParams) { + + String result = lyhVehicleService.insert(insertParams); + + return Result.success(result); + } +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/LyhVehicle.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/LyhVehicle.java new file mode 100644 index 0000000..26058ed --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/LyhVehicle.java @@ -0,0 +1,82 @@ +package com.couplet.vehicle.domain; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/26 + * @Description: 车辆信息表 + */ + +@Data +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +@TableName("lyh_vehicle") +public class LyhVehicle { + + /* + *车辆id + * */ + @TableId(type = IdType.AUTO, value = "vehicle_id") + private Long vehicleId; + + /* + *车辆类型 + * */ + @TableField(value = "vehicle_type") + private Integer vehicleType; + + + /* + *电机厂商 + * */ + @TableField(value = "motor_manufacturer") + private String motorManufacturer; + + /* + *电池厂商 + * */ + @TableField(value = "battery_manufacturer") + private String batteryManufacturer; + + /* + *电机编号 + * */ + @TableField(value = "motor_number") + private String motorNumber; + + /* + *电池编号 + * */ + @TableField(value = "battery_number") + private String batteryNumber; + + /* + *vin码 + * */ + @TableField(value = "vin") + private String vin; + + /* + *0离线 1在线 + * */ + @TableField(value = "vehicle_state") + private Integer vehicleState; + + /* + *0未删除 1删除 + * */ + @TableField(value = "isdelete") + private Integer isdelete; + + +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleEditParams.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleEditParams.java new file mode 100644 index 0000000..7a99349 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleEditParams.java @@ -0,0 +1,51 @@ +package com.couplet.vehicle.domain.req; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/27 + * @Description: 车辆编辑入参 + */ + +@Data +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +public class LyhVehicleEditParams { + /* + *车辆id + * */ + private Long vehicleId; + + /* + *车辆类型 + * */ + private Integer vehicleType; + + + /* + *电机厂商 + * */ + private String motorManufacturer; + + /* + *电池厂商 + * */ + private String batteryManufacturer; + + /* + *电机编号 + * */ + private String motorNumber; + + /* + *电池编号 + * */ + private String batteryNumber; + +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleInsertParams.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleInsertParams.java new file mode 100644 index 0000000..587a1fd --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleInsertParams.java @@ -0,0 +1,55 @@ +package com.couplet.vehicle.domain.req; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/27 + * @Description: 车辆编辑入参 + */ + +@Data +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +public class LyhVehicleInsertParams { + + /* + *车辆类型 + * */ + @NotNull(message = "车辆类型不能为空") + private Integer vehicleType; + + + /* + *电机厂商 + * */ + @NotBlank(message = "电机厂商不能为空") + private String motorManufacturer; + + /* + *电池厂商 + * */ + @NotBlank(message = "电池厂商不能为空") + private String batteryManufacturer; + + /* + *电机编号 + * */ + @NotBlank(message = "电机编号不能为空") + private String motorNumber; + + /* + *电池编号 + * */ + @NotBlank(message = "电池编号不能为空") + private String batteryNumber; + +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleListParams.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleListParams.java new file mode 100644 index 0000000..382e5b6 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleListParams.java @@ -0,0 +1,29 @@ +package com.couplet.vehicle.domain.req; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.SuperBuilder; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/26 + * @Description: 查询车辆列表入参 + */ +@Data +@SuperBuilder +@AllArgsConstructor +@NoArgsConstructor +public class LyhVehicleListParams { + /* + *车辆类型 + * */ + private Integer vehicleType; + + /* + *0离线 1在线 + * */ + private Integer vehicleState; + +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/mapper/LyhVehicleMapper.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/mapper/LyhVehicleMapper.java new file mode 100644 index 0000000..2d2d712 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/mapper/LyhVehicleMapper.java @@ -0,0 +1,17 @@ +package com.couplet.vehicle.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.couplet.vehicle.domain.LyhVehicle; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.stereotype.Component; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/26 + * @Description: + */ +@Mapper +@Component +public interface LyhVehicleMapper extends BaseMapper { +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/LyhVehicleService.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/LyhVehicleService.java new file mode 100644 index 0000000..b230bd6 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/LyhVehicleService.java @@ -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.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 { + List list(LyhVehicleListParams listParams); + + String deleteById(Long vehicleId); + + String editById(LyhVehicleEditParams editParams); + + String insert(LyhVehicleInsertParams insertParams); +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/impl/LyhVehicleServiceImpl.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/impl/LyhVehicleServiceImpl.java new file mode 100644 index 0000000..14953f9 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/impl/LyhVehicleServiceImpl.java @@ -0,0 +1,162 @@ +package com.couplet.vehicle.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +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.utils.SnowflakeIdGenerator; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/26 + * @Description: + */ + +@Service +@Slf4j +public class LyhVehicleServiceImpl extends ServiceImpl implements LyhVehicleService { + @Autowired + private LyhVehicleMapper lyhVehicleMapper; + + /* + * @Author: LiuYunHu + * @Date: 2024/3/26 22:11 + * @Description: 查询列表 + * @Param: [listParams] + * @Return: java.util.List + **/ + @Override + public List list(LyhVehicleListParams listParams) { + // 创建查询条件包装器 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + + // 如果车辆类型不为空,添加车辆类型作为查询条件 + if (!StringUtils.isNull(listParams.getVehicleType())) { + queryWrapper.eq(LyhVehicle::getVehicleType, listParams.getVehicleType()); + } + + // 如果车辆状态不为空,添加车辆状态作为查询条件 + if (!StringUtils.isNull(listParams.getVehicleState())) { + queryWrapper.eq(LyhVehicle::getVehicleState, listParams.getVehicleState()); + } + + //只查询车辆未被删除的 + queryWrapper.eq(LyhVehicle::getIsdelete, 0); + + // 执行查询并返回结果 + return this.list(queryWrapper); + } + + /* + * @Author: LiuYunHu + * @Date: 2024/3/26 22:31 + * @Description: 通过id删除 + * @Param: [vehicleId] + * @Return: java.lang.String + **/ + @Override + public String deleteById(Long vehicleId) { + String result = ""; + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + + updateWrapper.set("isdelete", 1) + .eq("vehicle_id", vehicleId); + + boolean update = update(updateWrapper); + + if (!update) { + result = "删除失败"; + throw new RuntimeException(result); + } + + result = "删除成功!"; + + return result; + } + + /* + * @Author: LiuYunHu + * @Date: 2024/3/27 15:21 + * @Description: 通过id进行编辑 + * @Param: [editParams] + * @Return: java.lang.String + **/ + @Override + public String editById(LyhVehicleEditParams editParams) { + String result = ""; + + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + + //编辑车辆类型 + + updateWrapper.set("vehicle_type", editParams.getVehicleType()) + + //编辑电机厂商 + .set("motor_manufacturer", editParams.getMotorManufacturer()) + + //编辑电池厂商 + .set("battery_manufacturer", editParams.getBatteryManufacturer()) + + //编辑电机编号 + .set("motor_number", editParams.getMotorNumber()) + + //编辑电池编号 + .set("battery_number", editParams.getBatteryNumber()) + + //匹配车辆id + .eq("vehicle_id", editParams.getVehicleId()); + + + boolean update = update(updateWrapper); + + if (!update) { + result = "编辑失败"; + throw new RuntimeException(result); + } + + result = "编辑成功!"; + + return result; + } + + /* + * @Author: LiuYunHu + * @Date: 2024/3/27 16:34 + * @Description: 新增车辆 + * @Param: [insertParams] + * @Return: java.lang.String + **/ + @Override + public String insert(LyhVehicleInsertParams insertParams) { + String result = ""; + + SnowflakeIdGenerator idGenerator = new SnowflakeIdGenerator(1, 1); + long randomId = idGenerator.nextId(); + String vin = "VIN" + randomId; + + int insert = lyhVehicleMapper.insert(new LyhVehicle(null, insertParams.getVehicleType(), insertParams.getMotorManufacturer(), insertParams.getBatteryManufacturer(), insertParams.getMotorNumber(), insertParams.getBatteryNumber(), vin, 0, 0)); + + if (insert == 0) { + result = "新增失败"; + throw new RuntimeException(result); + } + + result = "新增成功!"; + + return result; + } + +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/utils/SnowflakeIdGenerator.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/utils/SnowflakeIdGenerator.java new file mode 100644 index 0000000..3f6132c --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/utils/SnowflakeIdGenerator.java @@ -0,0 +1,79 @@ +package com.couplet.vehicle.utils; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/27 + * @Description: 雪花ID生成器 + * 使用方法 + * SnowflakeIdGenerator idGenerator = new SnowflakeIdGenerator(1, 1); // 创建一个 ID 生成器,传入机器 ID 和数据中心 ID + * long id = idGenerator.nextId(); // 生成 ID + */ + +public class SnowflakeIdGenerator { + + private final long epoch = 1420041600000L; // 起始时间戳,用于缩小时间戳范围,可根据实际情况调整 + private final long workerIdBits = 5L; // 机器 ID 所占位数 + private final long dataCenterIdBits = 5L; // 数据中心 ID 所占位数 + private final long sequenceBits = 12L; // 序列号所占位数 + + private final long maxWorkerId = -1L ^ (-1L << workerIdBits); // 机器 ID 最大值 + private final long maxDataCenterId = -1L ^ (-1L << dataCenterIdBits); // 数据中心 ID 最大值 + private final long maxSequence = -1L ^ (-1L << sequenceBits); // 序列号最大值 + + private final long workerIdShift = sequenceBits; // 机器 ID 向左移动位数 + private final long dataCenterIdShift = sequenceBits + workerIdBits; // 数据中心 ID 向左移动位数 + private final long timestampShift = sequenceBits + workerIdBits + dataCenterIdBits; // 时间戳向左移动位数 + + private long workerId; // 机器 ID + private long dataCenterId; // 数据中心 ID + private long sequence = 0L; // 序列号 + private long lastTimestamp = -1L; // 上次生成的时间戳 + + public SnowflakeIdGenerator(long workerId, long dataCenterId) { + if (workerId > maxWorkerId || workerId < 0) { + throw new IllegalArgumentException("Worker ID can't be greater than " + maxWorkerId + " or less than 0"); + } + if (dataCenterId > maxDataCenterId || dataCenterId < 0) { + throw new IllegalArgumentException("Data center ID can't be greater than " + maxDataCenterId + " or less than 0"); + } + this.workerId = workerId; + this.dataCenterId = dataCenterId; + } + + public synchronized long nextId() { + long timestamp = timeGen(); + + if (timestamp < lastTimestamp) { + throw new RuntimeException("Clock moved backwards, refusing to generate ID"); + } + + if (timestamp == lastTimestamp) { + sequence = (sequence + 1) & maxSequence; + if (sequence == 0) { + timestamp = tilNextMillis(lastTimestamp); + } + } else { + sequence = 0L; + } + + lastTimestamp = timestamp; + + return ((timestamp - epoch) << timestampShift) | + (dataCenterId << dataCenterIdShift) | + (workerId << workerIdShift) | + sequence; + } + + private long tilNextMillis(long lastTimestamp) { + long timestamp = timeGen(); + while (timestamp <= lastTimestamp) { + timestamp = timeGen(); + } + return timestamp; + } + + private long timeGen() { + return System.currentTimeMillis(); + } +} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/resources/banner.txt b/couplet-modules/couplet-modules-vehicle/src/main/resources/banner.txt new file mode 100644 index 0000000..0dd5eee --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/resources/banner.txt @@ -0,0 +1,2 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} diff --git a/couplet-modules/couplet-modules-vehicle/src/main/resources/bootstrap.yml b/couplet-modules/couplet-modules-vehicle/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..b30719a --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/resources/bootstrap.yml @@ -0,0 +1,30 @@ +# Tomcat +server: + port: 9615 + +# Spring +spring: + application: + # 应用名称 + name: couplet-vehicle + 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 diff --git a/couplet-modules/couplet-modules-vehicle/src/main/resources/logback.xml b/couplet-modules/couplet-modules-vehicle/src/main/resources/logback.xml new file mode 100644 index 0000000..4940ee0 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/resources/logback.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/couplet-modules/couplet-modules-vehicle/src/main/resources/mapper/vehicle/LyhVehicleMapper.xml b/couplet-modules/couplet-modules-vehicle/src/main/resources/mapper/vehicle/LyhVehicleMapper.xml new file mode 100644 index 0000000..99ffce9 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/main/resources/mapper/vehicle/LyhVehicleMapper.xml @@ -0,0 +1,8 @@ + + + + + + diff --git a/couplet-modules/couplet-modules-vehicle/src/test/java/IdTest.java b/couplet-modules/couplet-modules-vehicle/src/test/java/IdTest.java new file mode 100644 index 0000000..8a754b4 --- /dev/null +++ b/couplet-modules/couplet-modules-vehicle/src/test/java/IdTest.java @@ -0,0 +1,20 @@ +import com.couplet.vehicle.utils.SnowflakeIdGenerator; + +/** + * @ProjectName: five-groups-couplet + * @Author: LiuYunHu + * @CreateTime: 2024/3/27 + * @Description: + */ + +public class IdTest { + + + public static void main(String[] args) { + SnowflakeIdGenerator idGenerator = new SnowflakeIdGenerator(1, 1); + + long l = idGenerator.nextId(); + System.out.println(l); + + } +} diff --git a/couplet-modules/pom.xml b/couplet-modules/pom.xml index 8372348..f5823f2 100644 --- a/couplet-modules/pom.xml +++ b/couplet-modules/pom.xml @@ -14,6 +14,7 @@ couplet-job couplet-file couplet-trouble + couplet-modules-vehicle couplet-modules