From 9df04a6af28aa1b16dcb1ad8637f6ef12f71201a Mon Sep 17 00:00:00 2001
From: liuyunhu <3286117488@qq.com>
Date: Tue, 26 Mar 2024 22:37:57 +0800
Subject: [PATCH] aa
---
.../couplet-modules-vehicle/pom.xml | 114 ++++++++++++++++++
.../vehicle/LyhVehicleApplication.java | 23 ++++
.../controller/LyhVehicleController.java | 59 +++++++++
.../couplet/vehicle/domain/LyhVehicle.java | 84 +++++++++++++
.../domain/req/LyhVehicleListParams.java | 33 +++++
.../vehicle/mapper/LyhVehicleMapper.java | 17 +++
.../vehicle/service/LyhVehicleService.java | 20 +++
.../service/impl/LyhVehicleServiceImpl.java | 86 +++++++++++++
.../src/main/resources/banner.txt | 2 +
.../src/main/resources/bootstrap.yml | 30 +++++
.../src/main/resources/logback.xml | 74 ++++++++++++
.../mapper/vehicle/LyhVehicleMapper.xml | 8 ++
couplet-modules/pom.xml | 1 +
13 files changed, 551 insertions(+)
create mode 100644 couplet-modules/couplet-modules-vehicle/pom.xml
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/LyhVehicleApplication.java
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/controller/LyhVehicleController.java
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/LyhVehicle.java
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleListParams.java
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/mapper/LyhVehicleMapper.java
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/LyhVehicleService.java
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/impl/LyhVehicleServiceImpl.java
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/resources/banner.txt
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/resources/bootstrap.yml
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/resources/logback.xml
create mode 100644 couplet-modules/couplet-modules-vehicle/src/main/resources/mapper/vehicle/LyhVehicleMapper.xml
diff --git a/couplet-modules/couplet-modules-vehicle/pom.xml b/couplet-modules/couplet-modules-vehicle/pom.xml
new file mode 100644
index 0000000..d7be645
--- /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..73b0e9c
--- /dev/null
+++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/controller/LyhVehicleController.java
@@ -0,0 +1,59 @@
+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.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);
+ }
+
+
+}
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..bec3f15
--- /dev/null
+++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/LyhVehicle.java
@@ -0,0 +1,84 @@
+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 com.couplet.common.core.web.domain.BaseEntity;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+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/LyhVehicleListParams.java b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleListParams.java
new file mode 100644
index 0000000..767ccde
--- /dev/null
+++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/domain/req/LyhVehicleListParams.java
@@ -0,0 +1,33 @@
+package com.couplet.vehicle.domain.req;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.couplet.common.core.web.domain.BaseEntity;
+import io.swagger.models.auth.In;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+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..e92fd4a
--- /dev/null
+++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/LyhVehicleService.java
@@ -0,0 +1,20 @@
+package com.couplet.vehicle.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.couplet.vehicle.domain.LyhVehicle;
+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);
+}
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..c824e79
--- /dev/null
+++ b/couplet-modules/couplet-modules-vehicle/src/main/java/com/couplet/vehicle/service/impl/LyhVehicleServiceImpl.java
@@ -0,0 +1,86 @@
+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.LyhVehicleListParams;
+import com.couplet.vehicle.mapper.LyhVehicleMapper;
+import com.couplet.vehicle.service.LyhVehicleService;
+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;
+ }
+}
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/pom.xml b/couplet-modules/pom.xml
index 5d1cb7d..e0b68b2 100644
--- a/couplet-modules/pom.xml
+++ b/couplet-modules/pom.xml
@@ -13,6 +13,7 @@
couplet-gen
couplet-job
couplet-file
+ couplet-modules-vehicle
couplet-modules