车辆信息 删改查
parent
0ad2cd436d
commit
f549b1824b
23
pom.xml
23
pom.xml
|
@ -27,4 +27,27 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>dragon-release</id>
|
||||
<name>dragon-releases</name>
|
||||
<url>http://10.100.1.7:8081/repository/maven-releases/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>dragon-public</id>
|
||||
<name>dragon-maven</name>
|
||||
<url>http://10.100.1.7:8081/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>aliyun-public</id>
|
||||
<name>aliyun</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
</project>
|
||||
|
|
|
@ -22,5 +22,12 @@
|
|||
<groupId>com.dragon</groupId>
|
||||
<artifactId>dragon-common-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.dragon.vehicle.history.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/20 19:26
|
||||
* @description 车辆信息表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Car {
|
||||
/**
|
||||
* 车辆表ID
|
||||
*/
|
||||
private Integer carId;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String carVin;
|
||||
/**
|
||||
* 车辆名称
|
||||
*/
|
||||
private String carName;
|
||||
/**
|
||||
* 车辆品牌
|
||||
*/
|
||||
private String carBrand;
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private Integer carTypeId;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
*/
|
||||
private Integer fenceId;
|
||||
/**
|
||||
* 车辆状态 1-在线 0-离线
|
||||
*/
|
||||
private Integer carStatus;
|
||||
/**
|
||||
* 是否删除 1-是 0-否
|
||||
*/
|
||||
@TableLogic(value="0",delval="1")
|
||||
//value为正常数据的值,delval为删除数据的值
|
||||
private Integer isDelete;
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.dragon.vehicle.history.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/21 19:47
|
||||
* @description 车辆类型表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CarType {
|
||||
/**
|
||||
* 车辆类型表ID
|
||||
*/
|
||||
private Integer carTypeId;
|
||||
/**
|
||||
* 车辆类型名称
|
||||
*/
|
||||
private String carTypeName;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.dragon.vehicle.history.common.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/22 8:14
|
||||
* @description 电子围栏表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Fence {
|
||||
/**
|
||||
* 围栏主键id
|
||||
*/
|
||||
private Integer fenceId;
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
private String fenceName;
|
||||
/**
|
||||
* 围栏数据
|
||||
*/
|
||||
private String fenceData;
|
||||
/**
|
||||
* 围栏状态
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 告警类型
|
||||
*/
|
||||
private String alarmType;
|
||||
/**
|
||||
* 租户号
|
||||
*/
|
||||
private String tenantId;
|
||||
/**
|
||||
* 乐观锁
|
||||
*/
|
||||
private Integer revision;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,240 @@
|
|||
package com.dragon.vehicle.history.common.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/19 20:01
|
||||
* @description 车辆详细信息表
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class VehicleOperation {
|
||||
/**
|
||||
* 车辆实时轨迹数据表
|
||||
*/
|
||||
private Integer vehicleOperationId;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String vin;
|
||||
/**
|
||||
* 行驶路线
|
||||
*/
|
||||
private String drivingRoute;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String longitude;
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String latitude;
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
private String speed;
|
||||
/**
|
||||
* 总里程
|
||||
*/
|
||||
private BigDecimal mileage;
|
||||
/**
|
||||
* 总电压
|
||||
*/
|
||||
private String voltage;
|
||||
/**
|
||||
* 总电流
|
||||
*/
|
||||
private String current;
|
||||
/**
|
||||
* 绝缘电阻
|
||||
*/
|
||||
private String resistance;
|
||||
/**
|
||||
* 档位
|
||||
*/
|
||||
private String gear;
|
||||
/**
|
||||
* 加速踏板行程值
|
||||
*/
|
||||
private String accelerationPedal;
|
||||
/**
|
||||
* 制动踏板行程值
|
||||
*/
|
||||
private String brakePedal;
|
||||
/**
|
||||
* 燃料消耗率
|
||||
*/
|
||||
private String fuelConsumptionRate;
|
||||
/**
|
||||
* 电机控制器温度
|
||||
*/
|
||||
private String motorControllerTemperature;
|
||||
/**
|
||||
* 电机转速
|
||||
*/
|
||||
private String motorSpeed;
|
||||
/**
|
||||
* 电机转矩
|
||||
*/
|
||||
private String motorTorque;
|
||||
/**
|
||||
* 电机温度
|
||||
*/
|
||||
private String motorTemperature;
|
||||
/**
|
||||
* 电机电压
|
||||
*/
|
||||
private String motorVoltage;
|
||||
/**
|
||||
* 电机电流
|
||||
*/
|
||||
private String motorCurrent;
|
||||
/**
|
||||
* 动力电池剩余电量SOC
|
||||
*/
|
||||
private BigDecimal remainingBattery;
|
||||
/**
|
||||
* 电池总容量
|
||||
*/
|
||||
private BigDecimal batteryLevel;
|
||||
/**
|
||||
* 当前状态允许的最大反馈功率
|
||||
*/
|
||||
private String maximumFeedbackPower;
|
||||
/**
|
||||
* 当前状态允许最大放电功率
|
||||
*/
|
||||
private String maximumDischargePower;
|
||||
/**
|
||||
* BMS自检计数器
|
||||
*/
|
||||
private String selfCheckCounter;
|
||||
/**
|
||||
* 动力电池充放电电流
|
||||
*/
|
||||
private String totalBatteryCurrent;
|
||||
/**
|
||||
* 动力电池负载端总电压V3
|
||||
*/
|
||||
private String totalBatteryVoltage;
|
||||
/**
|
||||
* 单次最大电压
|
||||
*/
|
||||
private String singleBatteryMaxVoltage;
|
||||
/**
|
||||
* 单体电池最低电压
|
||||
*/
|
||||
private String singleBatteryMinVoltage;
|
||||
/**
|
||||
* 单体电池最高温度
|
||||
*/
|
||||
private String singleBatteryMaxTemperature;
|
||||
/**
|
||||
* 单体电池最低温度
|
||||
*/
|
||||
private String singleBatteryMinTemperature;
|
||||
/**
|
||||
* 动力电池可用容量
|
||||
*/
|
||||
private String availableBatteryCapacity;
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
private Integer vehicleStatus;
|
||||
/**
|
||||
* 充电状态
|
||||
*/
|
||||
private Integer chargingStatus;
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
private Integer operatingStatus;
|
||||
/**
|
||||
* SOC
|
||||
*/
|
||||
private Integer socStatus;
|
||||
/**
|
||||
* 可充电储能装置工作状态
|
||||
*/
|
||||
private Integer chargingRnergyStorageStatus;
|
||||
/**
|
||||
* 驱动电机状态
|
||||
*/
|
||||
private Integer driveMotorStatus;
|
||||
/**
|
||||
* 定位是否有效
|
||||
*/
|
||||
private Integer positionStatus;
|
||||
/**
|
||||
* EAS(汽车防盗系统)状态
|
||||
*/
|
||||
private Integer easStatus;
|
||||
/**
|
||||
* EPS(电动助力系统)状态
|
||||
*/
|
||||
private Integer epsStatus;
|
||||
/**
|
||||
* ABS(防抱死)状态
|
||||
*/
|
||||
private Integer absStatus;
|
||||
/**
|
||||
* MCU(电机/逆变器)状态
|
||||
*/
|
||||
private Integer mcuStatus;
|
||||
/**
|
||||
* 动力电池加热状态
|
||||
*/
|
||||
private Integer heatingStatus;
|
||||
/**
|
||||
* 动力电池当前状态
|
||||
*/
|
||||
private Integer batteryStatus;
|
||||
/**
|
||||
* 动力电池保温状态
|
||||
*/
|
||||
private Integer batteryInsulationStatus;
|
||||
/**
|
||||
* DCDC(电力交换系统)状态
|
||||
*/
|
||||
private Integer dcdcStatus;
|
||||
/**
|
||||
* CHG(充电机)状态
|
||||
*/
|
||||
private Integer chgStatus;
|
||||
/**
|
||||
* 车辆状态 报文
|
||||
*/
|
||||
private String vehicleStatusMsg;
|
||||
/**
|
||||
* 智能硬件 报文
|
||||
*/
|
||||
private String smartHardwareMsg;
|
||||
/**
|
||||
* 电池报文
|
||||
*/
|
||||
private String batteryMsg;
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
/**
|
||||
* 是否删除 1-是 0-否
|
||||
*/
|
||||
private Integer isDelete;
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.dragon.vehicle.history.common.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dragon.common.core.utils.StringUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/21 19:15
|
||||
* @description 车辆列表分页参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReqCar {
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
private Integer pageNum=1;
|
||||
|
||||
/**
|
||||
* 每页条数
|
||||
*/
|
||||
private Integer pageSize=10;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String carVin;
|
||||
/**
|
||||
* 车辆名称
|
||||
*/
|
||||
private String carName;
|
||||
/**
|
||||
* 车辆品牌
|
||||
*/
|
||||
private String carBrand;
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private Integer carTypeId;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
*/
|
||||
private Integer fenceId;
|
||||
/**
|
||||
* 车辆状态 1-在线 0-离线
|
||||
*/
|
||||
private Integer carStatus;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.dragon.vehicle.history.common.domain.req;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/20 18:38
|
||||
* @description 查询车辆历史轨迹参数
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReqVehicleOperation {
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String vin;
|
||||
|
||||
/**
|
||||
* 当前页数
|
||||
*/
|
||||
private Integer pageNum;
|
||||
|
||||
/**
|
||||
* 每页条数
|
||||
*/
|
||||
private Integer pageSize;
|
||||
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.dragon.vehicle.history.common.domain.res;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/21 20:35
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class ResCar {
|
||||
/**
|
||||
* 车辆表ID
|
||||
*/
|
||||
private Integer carId;
|
||||
/**
|
||||
* 车辆VIN
|
||||
*/
|
||||
private String carVin;
|
||||
/**
|
||||
* 车辆名称
|
||||
*/
|
||||
private String carName;
|
||||
/**
|
||||
* 车辆品牌
|
||||
*/
|
||||
private String carBrand;
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private Integer carTypeId;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
*/
|
||||
private Integer fenceId;
|
||||
/**
|
||||
* 车辆状态 1-在线 0-离线
|
||||
*/
|
||||
private Integer carStatus;
|
||||
/**
|
||||
* 是否删除 1-是 0-否
|
||||
*/
|
||||
private Integer isDelete;
|
||||
/**
|
||||
* 车辆类型名称
|
||||
*/
|
||||
private String carTypeName;
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
private String fenceName;
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
package com.dragon.vehicle.history.remote;
|
||||
|
||||
/**
|
||||
* @author 冯凯
|
||||
* @version 1.0
|
||||
* @description:
|
||||
* @date 2023/11/19 19:02
|
||||
* @author 唐文康
|
||||
*/
|
||||
public interface RemoteHistoryService {
|
||||
|
||||
}
|
||||
|
|
|
@ -4,10 +4,7 @@ import com.dragon.vehicle.history.remote.RemoteHistoryService;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author 冯凯
|
||||
* @version 1.0
|
||||
* @description:
|
||||
* @date 2023/11/19 19:03
|
||||
* @author 唐文康
|
||||
*/
|
||||
@Component
|
||||
public class RemoteHistoryServiceFallbackFactory implements RemoteHistoryService {
|
||||
|
|
|
@ -83,18 +83,51 @@
|
|||
<artifactId>dragon-common-swagger</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mybatis Plus-->
|
||||
<dependency>
|
||||
<groupId>com.dragon</groupId>
|
||||
<artifactId>dragon-file-remote</artifactId>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.dragon</groupId>
|
||||
<artifactId>dragon-system-common</artifactId>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join</artifactId>
|
||||
<version>1.2.4</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>dragon-release</id>
|
||||
<name>dragon-releases</name>
|
||||
<url>http://10.100.1.7:8081/repository/maven-releases/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<repositories>
|
||||
|
||||
<repository>
|
||||
<id>dragon-public</id>
|
||||
<name>dragon-maven</name>
|
||||
<url>http://10.100.1.7:8081/repository/maven-public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>aliyun-public</id>
|
||||
<name>aliyun</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
</repository>
|
||||
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
|
@ -106,6 +139,8 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!--当deploy时候忽略此model-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
|
@ -113,7 +148,7 @@
|
|||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>16</source><target>16</target></configuration></plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -6,11 +6,9 @@ import com.dragon.common.swagger.annotation.EnableCustomSwagger2;
|
|||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
||||
/**
|
||||
* @author 冯凯
|
||||
* @version 1.0
|
||||
* @description:
|
||||
* @date 2023/11/19 18:59
|
||||
* @author 唐文康
|
||||
*/
|
||||
@EnableCustomConfig
|
||||
@EnableCustomSwagger2
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.dragon.vehicle.history.server.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author 唐文康
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
|
||||
/**
|
||||
* 分页插件。如果你不配置,分页插件将不生效
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor paginationInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 指定数据库方言为 MYSQL
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.dragon.vehicle.history.server.controller;
|
||||
|
||||
import com.dragon.common.core.domain.Result;
|
||||
import com.dragon.vehicle.history.common.domain.Car;
|
||||
import com.dragon.vehicle.history.common.domain.CarType;
|
||||
import com.dragon.vehicle.history.common.domain.req.ReqCar;
|
||||
import com.dragon.vehicle.history.common.domain.res.ResCar;
|
||||
import com.dragon.vehicle.history.server.service.CarService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/21 19:18
|
||||
* @description
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/car")
|
||||
public class CarController {
|
||||
@Autowired
|
||||
private CarService carService;
|
||||
|
||||
/**
|
||||
* 车辆信息列表
|
||||
* @param reqCar 分页参数
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/listCar")
|
||||
public Result<List<ResCar>> listCar(@RequestBody ReqCar reqCar){
|
||||
return carService.listCar(reqCar);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车辆类型列表
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/listCarType")
|
||||
public Result<List<CarType>> listCarType(){
|
||||
return carService.listCarType();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆信息
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/updateCar")
|
||||
public Result updateCar(@RequestBody Car car){
|
||||
return carService.updateCar(car);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆信息
|
||||
* @param carVin
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/deleteCar")
|
||||
public Result deleteCar(@RequestParam String carVin){
|
||||
return carService.deleteCar(carVin);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.dragon.vehicle.history.server.controller;
|
||||
|
||||
import com.dragon.common.core.domain.Result;
|
||||
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||
import com.dragon.vehicle.history.server.service.HistoricalTrackService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/19 19:54
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/history")
|
||||
public class HistoricalTrackController {
|
||||
@Autowired
|
||||
private HistoricalTrackService historicalTrackService;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.dragon.vehicle.history.server.mapper;
|
||||
|
||||
import com.dragon.vehicle.history.common.domain.Car;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/21 19:29
|
||||
* @description
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarMapper extends MPJBaseMapper<Car> {
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.dragon.vehicle.history.server.mapper;
|
||||
|
||||
import com.dragon.vehicle.history.common.domain.CarType;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/22 9:24
|
||||
* @description
|
||||
*/
|
||||
@Mapper
|
||||
public interface CarTypeMapper extends MPJBaseMapper<CarType> {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.dragon.vehicle.history.server.mapper;
|
||||
|
||||
import com.dragon.vehicle.history.common.domain.VehicleOperation;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/19 19:55
|
||||
*/
|
||||
@Mapper
|
||||
public interface HistoricalTrackMapper extends MPJBaseMapper<VehicleOperation> {
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.dragon.vehicle.history.server.service;
|
||||
|
||||
|
||||
import com.dragon.common.core.domain.Result;
|
||||
import com.dragon.vehicle.history.common.domain.Car;
|
||||
import com.dragon.vehicle.history.common.domain.CarType;
|
||||
import com.dragon.vehicle.history.common.domain.req.ReqCar;
|
||||
import com.dragon.vehicle.history.common.domain.res.ResCar;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/21 19:27
|
||||
* @description
|
||||
*/
|
||||
public interface CarService {
|
||||
/**
|
||||
* 车辆信息列表
|
||||
* @param reqCar 分页参数
|
||||
* @return
|
||||
*/
|
||||
Result<List<ResCar>> listCar(ReqCar reqCar);
|
||||
|
||||
/**
|
||||
* 查询车辆类型列表
|
||||
* @return
|
||||
*/
|
||||
Result<List<CarType>> listCarType();
|
||||
/**
|
||||
* 修改车辆信息
|
||||
* @return
|
||||
*/
|
||||
Result updateCar(Car car);
|
||||
|
||||
/**
|
||||
* 删除车辆信息
|
||||
* @param carVin
|
||||
* @return
|
||||
*/
|
||||
Result deleteCar(String carVin);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package com.dragon.vehicle.history.server.service;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/19 19:55
|
||||
*/
|
||||
public interface HistoricalTrackService {
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
package com.dragon.vehicle.history.server.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dragon.common.core.domain.Result;
|
||||
import com.dragon.vehicle.history.common.domain.Car;
|
||||
import com.dragon.vehicle.history.common.domain.CarType;
|
||||
import com.dragon.vehicle.history.common.domain.Fence;
|
||||
import com.dragon.vehicle.history.common.domain.req.ReqCar;
|
||||
import com.dragon.vehicle.history.common.domain.res.ResCar;
|
||||
import com.dragon.vehicle.history.server.mapper.CarMapper;
|
||||
import com.dragon.vehicle.history.server.mapper.CarTypeMapper;
|
||||
import com.dragon.vehicle.history.server.service.CarService;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/21 19:29
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
public class CarServiceImpl implements CarService {
|
||||
@Autowired
|
||||
private CarMapper carMapper;
|
||||
@Autowired
|
||||
private CarTypeMapper carTypeMapper;
|
||||
|
||||
/**
|
||||
* 车辆信息列表
|
||||
* @param reqCar 分页参数
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<List<ResCar>> listCar(ReqCar reqCar) {
|
||||
Page<ResCar> resCarPage = new Page<>(reqCar.getPageNum(), reqCar.getPageSize());
|
||||
List<ResCar> resCars = carMapper.selectJoinPage(resCarPage, ResCar.class, new MPJLambdaWrapper<Car>()
|
||||
.selectAll(Car.class)
|
||||
.select(CarType::getCarTypeName)
|
||||
.select(Fence::getFenceName)
|
||||
.leftJoin(CarType.class, CarType::getCarTypeId, Car::getCarTypeId)
|
||||
.leftJoin(Fence.class,Fence::getFenceId,Car::getFenceId)
|
||||
.like(reqCar.getCarName() != null, Car::getCarName, reqCar.getCarName())
|
||||
.like(reqCar.getCarBrand() != null, Car::getCarBrand, reqCar.getCarBrand())
|
||||
.like(reqCar.getCarVin() != null, Car::getCarVin, reqCar.getCarVin())
|
||||
.eq(reqCar.getCarStatus() != null, Car::getCarStatus, reqCar.getCarStatus())
|
||||
.eq(reqCar.getCarTypeId() != null, CarType::getCarTypeId, reqCar.getCarTypeId())
|
||||
.eq(reqCar.getFenceId() != null, Car::getFenceId, reqCar.getFenceId())).getRecords();
|
||||
return Result.success(resCars);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车辆类型列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<List<CarType>> listCarType() {
|
||||
MPJLambdaWrapper<CarType> carTypeMPJLambdaWrapper = new MPJLambdaWrapper<CarType>().selectAll(CarType.class);
|
||||
return Result.success(carTypeMapper.selectList(carTypeMPJLambdaWrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆信息
|
||||
*
|
||||
* @param car
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result updateCar(Car car) {
|
||||
MPJLambdaWrapper<Car> carMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
||||
MPJLambdaWrapper<Car> lambdaWrapper = carMPJLambdaWrapper.eq(Car::getCarVin, car.getCarVin());
|
||||
carMapper.update(car,lambdaWrapper);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆信息
|
||||
* @param carVin
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result deleteCar(String carVin) {
|
||||
carMapper.deleteById(carVin);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.dragon.vehicle.history.server.service.impl;
|
||||
|
||||
import com.dragon.vehicle.history.server.mapper.HistoricalTrackMapper;
|
||||
import com.dragon.vehicle.history.server.service.HistoricalTrackService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author Wenkang Tang
|
||||
* @date 2023/11/19 19:55
|
||||
*/
|
||||
@Service
|
||||
public class HistoricalTrackServiceImpl implements HistoricalTrackService {
|
||||
@Autowired
|
||||
private HistoricalTrackMapper historicalTrackMapper;
|
||||
}
|
|
@ -26,3 +26,8 @@ spring:
|
|||
mybatis-plus:
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: flag # 全局逻辑删除的实体字段名
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
<?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.dragon.vehicle.history.server.mapper.CarMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,5 @@
|
|||
<?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.dragon.vehicle.history.server.mapper.CarTypeMapper">
|
||||
|
||||
</mapper>
|
|
@ -1,6 +1,5 @@
|
|||
<?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.dragon.vehicle.history.server.mapper.HistoryMapper">
|
||||
|
||||
<mapper namespace="com.dragon.vehicle.history.server.mapper.HistoricalTrackMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue