车辆管理系统更新

master
ZhiShuo_Lou 2023-12-06 20:52:10 +08:00
parent 403e27e76e
commit ebe49db774
22 changed files with 886 additions and 801 deletions

View File

@ -1,156 +1,156 @@
package com.god.base.domain; //package com.god.base.domain;
//
import com.baomidou.mybatisplus.annotation.TableId; //import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; //import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; //import com.fasterxml.jackson.annotation.JsonFormat;
import com.god.base.domain.request.CarRequest; //import com.god.base.domain.request.CarRequest;
import com.god.common.core.annotation.Excel; //import com.god.common.core.annotation.Excel;
import lombok.AllArgsConstructor; //import lombok.AllArgsConstructor;
import lombok.Builder; //import lombok.Builder;
import lombok.Data; //import lombok.Data;
import lombok.NoArgsConstructor; //import lombok.NoArgsConstructor;
//
import java.util.Date; //import java.util.Date;
//
/** ///**
* // * 车辆信息管理对象
*/ // */
@Data //@Data
@AllArgsConstructor //@AllArgsConstructor
@NoArgsConstructor //@NoArgsConstructor
@Builder //@Builder
@TableName(value = "t_car") //@TableName(value = "t_car")
public class Car { //public class Car {
//
private static final long serialVersionUID = 1L; // private static final long serialVersionUID = 1L;
//
/** // /**
* Vin // * 车辆Vin 主键
*/ // */
@Excel(name = "车辆carVibId") // @Excel(name = "车辆carVibId")
@TableId // @TableId
private String carVinId; // private String carVinId;
/** // /**
* id // * 单位id
*/ // */
private long userId; // private long userId;
/** // /**
* id // * 车辆类型id
*/ // */
@Excel(name = "车辆类型ID") // @Excel(name = "车辆类型ID")
private long carTypeId; // private long carTypeId;
/** // /**
* id // * 电池箱信息id
*/ // */
private long batteryBoxId; // private long batteryBoxId;
/** // /**
* id // * 电池组id
*/ // */
private long cellId; // private long cellId;
/** // /**
* id // * 单体电池id
*/ // */
private long batteryCellId; // private long batteryCellId;
/** // /**
* id // * 电池组模块id
*/ // */
private long batteryPackInformationId; // private long batteryPackInformationId;
/** // /**
* ID // * 电子围栏ID
*/ // */
@Excel(name = "电子围栏ID") // @Excel(name = "电子围栏ID")
private long fenceId; // private long fenceId;
/** // /**
* // * 车牌号
*/ // */
private String carNumber; // private String carNumber;
/** // /**
* // * 驱动机主键
*/ // */
private long driveMotorId; // private long driveMotorId;
/** // /**
* // * 车辆总里程
*/ // */
private String carMileage; // private String carMileage;
/** // /**
* // * 创建者
*/ // */
private String createBy; // private String createBy;
/** // /**
* // * 创建时间
*/ // */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "开始时间" , width = 30, dateFormat = "yyyy-MM-dd") // @Excel(name = "开始时间" , width = 30, dateFormat = "yyyy-MM-dd")
private Date createTime; // private Date createTime;
/** // /**
* // * 更新者
*/ // */
private String updateBy; // private String updateBy;
/** // /**
* // * 更新时间
*/ // */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "结束时间" , width = 30, dateFormat = "yyyy-MM-dd") // @Excel(name = "结束时间" , width = 30, dateFormat = "yyyy-MM-dd")
private Date updateTime; // private Date updateTime;
/** // /**
* // * 区域
*/ // */
private String address; // private String address;
/** // /**
* // * 电池厂商
*/ // */
@Excel(name = "电池厂商") // @Excel(name = "电池厂商")
private String batteryManufacturer; // private String batteryManufacturer;
/** // /**
* // * 电机厂商
*/ // */
@Excel(name = "电机厂商") // @Excel(name = "电机厂商")
private String motorManufacturer; // private String motorManufacturer;
/** // /**
* // * 电机编号
*/ // */
@Excel(name = "电机编号") // @Excel(name = "电机编号")
private String motorNumber; // private String motorNumber;
/** // /**
* // * 电池编号
*/ // */
@Excel(name = "电池编号") // @Excel(name = "电池编号")
private String batteryNumber; // private String batteryNumber;
/** // /**
* // * 逻辑删除
*/ // */
private int isDelete; // private int isDelete;
/** // /**
* // * 车辆状态
*/ // */
@Excel(name = "车辆状态") // @Excel(name = "车辆状态")
private int status; // private int status;
//
/** // /**
* // * 电子围栏名称
*/ // */
private String fenceName; // private String fenceName;
/** // /**
* // * 车辆类型名称
*/ // */
private String carTypeName; // private String carTypeName;
//
/** // /**
* // * 车辆绑定的主题
*/ // */
private String topic; // private String topic;
//
public static Car carBuildAdd(CarRequest carRequest){ // public static Car carBuildAdd(CarRequest carRequest){
return Car.builder() // return Car.builder()
.carVinId(carRequest.getCarVinId()) // .carVinId(carRequest.getCarVinId())
.carTypeId(carRequest.getCarTypeId()) // .carTypeId(carRequest.getCarTypeId())
.fenceId(carRequest.getFenceId()) // .fenceId(carRequest.getFenceId())
.status(carRequest.getStatus()) // .status(carRequest.getStatus())
.batteryManufacturer(carRequest.getBatteryManufacturer()) // .batteryManufacturer(carRequest.getBatteryManufacturer())
.motorManufacturer(carRequest.getMotorManufacturer()) // .motorManufacturer(carRequest.getMotorManufacturer())
.motorNumber(carRequest.getMotorNumber()) // .motorNumber(carRequest.getMotorNumber())
.batteryNumber(carRequest.getBatteryNumber()) // .batteryNumber(carRequest.getBatteryNumber())
.build(); // .build();
} // }
//
} //}

View File

@ -1,12 +1,18 @@
package com.god.base.domain; package com.god.base.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.god.base.domain.request.FirmCarInsertReq;
import com.god.base.domain.request.FirmCarRequest;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date;
/** /**
* *
@ -18,6 +24,7 @@ import javax.validation.constraints.NotNull;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@TableName(value = "t_car")
public class FirmCar { public class FirmCar {
@ -90,7 +97,7 @@ public class FirmCar {
* 1- * 1-
* 0- * 0-
*/ */
private Integer is_delete; private Integer isDelete;
/** /**
* *
* 1-线 * 1-线
@ -103,7 +110,54 @@ public class FirmCar {
private String topic; private String topic;
/**
*
*/
private String createBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH-mm-ss")
@JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss",timezone = "GMT+8")
private Date createTime;
/**
*
*/
private String updateBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH-mm-ss")
@JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss",timezone = "GMT+8")
private Date updateTime;
public static FirmCar FirmInsertCar(FirmCarInsertReq firmCarInsertReq) {
return FirmCar.builder()
.carVinId(firmCarInsertReq.getCarVinId())
.userId(firmCarInsertReq.getUserId())
.carTypeId(firmCarInsertReq.getCarTypeId())
.batteryBoxId(firmCarInsertReq.getBatteryBoxId())
.cellId(firmCarInsertReq.getCellId())
.batteryCellId(firmCarInsertReq.getBatteryCellId())
.batteryPackInformationId(firmCarInsertReq.getBatteryPackInformationId())
.carNumber(firmCarInsertReq.getCarNumber())
.driveMotorId(firmCarInsertReq.getDriveMotorId())
.carMileage(firmCarInsertReq.getCarMileage())
.address(firmCarInsertReq.getAddress())
.batteryManufacturer(firmCarInsertReq.getBatteryManufacturer())
.motorManufacturer(firmCarInsertReq.getMotorManufacturer())
.motorNumber(firmCarInsertReq.getMotorNumber())
.batteryNumber(firmCarInsertReq.getBatteryNumber())
.topic(firmCarInsertReq.getTopic())
.createBy(firmCarInsertReq.getCreateBy())
.createTime(firmCarInsertReq.getCreateTime())
.build();
}
} }

View File

@ -0,0 +1,107 @@
package com.god.base.domain.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotEmpty;
import java.util.Date;
/**
*
*
* @author LouZhiSHuo
* @Date 2023/12/6 20:36
**/
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class FirmCarInsertReq {
/**
* VIN
*/
@NotEmpty(message = "车辆VIN不能为空")
private String carVinId;
/**
*
*/
private Integer userId;
/**
*
*/
private Integer carTypeId;
/**
* id
*/
private Integer batteryBoxId;
/**
* id
*/
private Integer cellId;
/**
* id
*/
private Integer batteryCellId;
/**
* id
*/
private Integer batteryPackInformationId;
/**
*
*/
private String carNumber;
/**
*
*/
private Integer driveMotorId;
/**
*
*/
private Double carMileage;
/**
*
*/
private String address;
/**
*
*/
private String batteryManufacturer;
/**
*
*/
private String motorManufacturer;
/**
*
*/
private String motorNumber;
/**
*
*/
private String batteryNumber;
/**
*
*/
private String topic;
/**
*
*/
private String createBy;
/**
*
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH-mm-ss")
@JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss",timezone = "GMT+8")
private Date createTime;
}

View File

@ -1,8 +1,9 @@
package com.god.base.remote; package com.god.base.remote;
import com.god.base.domain.Fence; import com.god.base.domain.Fence;
import com.god.base.domain.FirmCar;
import com.god.base.remote.factory.RemoteCarFallbackFactory; import com.god.base.remote.factory.RemoteCarFallbackFactory;
import com.god.base.domain.Car;
import com.god.common.core.domain.Result; import com.god.common.core.domain.Result;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -17,8 +18,8 @@ import org.springframework.web.bind.annotation.*;
public interface RemoteCarService { public interface RemoteCarService {
@GetMapping("/car/list") @GetMapping("/FirmCar/findFirmCarByUserId")
public Result<Car> list(@RequestParam("carVinId") String carVinId); public Result<FirmCar> list(@RequestParam("carVinId") String carVinId);
@PostMapping("/baseFence/fenceById") @PostMapping("/baseFence/fenceById")
public Result<Fence> fenceById(@RequestParam("fenceId") Integer fenceId); public Result<Fence> fenceById(@RequestParam("fenceId") Integer fenceId);

View File

@ -1,23 +0,0 @@
package com.god.base.remote;
import com.god.base.domain.Fence;
import com.god.base.remote.factory.RemoteFenceFallbackFactory;
import com.god.common.core.constant.SecurityConstants;
import com.god.common.core.domain.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
*
* @author LouZhiSHuo
* @Date 2023/11/27 19:39
**/
@FeignClient(contextId = "remoteFenceService", value = "god-car-base", fallbackFactory = RemoteFenceFallbackFactory.class)
public interface RemoteFenceService {
@PostMapping("/baseFence/fenceById")
public Result<Fence> fenceById(@RequestParam("fenceId") Integer fenceId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

View File

@ -1,8 +1,9 @@
package com.god.base.remote.factory; package com.god.base.remote.factory;
import com.god.base.domain.Fence; import com.god.base.domain.Fence;
import com.god.base.domain.FirmCar;
import com.god.base.remote.RemoteCarService; import com.god.base.remote.RemoteCarService;
import com.god.base.domain.Car;
import com.god.common.core.domain.Result; import com.god.common.core.domain.Result;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -25,8 +26,10 @@ public class RemoteCarFallbackFactory implements FallbackFactory<RemoteCarServic
log.error("远程调用车辆信息错误:{}",cause.getMessage()); log.error("远程调用车辆信息错误:{}",cause.getMessage());
return new RemoteCarService() { return new RemoteCarService() {
@Override @Override
public Result<Car> list(String carVinId) { public Result<FirmCar> list(String carVinId) {
return Result.error("保存操作日志失败:" + cause.getMessage()); return Result.error("保存操作日志失败:" + cause.getMessage());
} }

View File

@ -1,31 +0,0 @@
package com.god.base.remote.factory;
import com.god.base.domain.Fence;
import com.god.base.remote.RemoteFenceService;
import com.god.common.core.domain.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
/**
*
*
* @author LouZhiSHuo
* @Date 2023/11/27 19:40
**/
public class RemoteFenceFallbackFactory implements FallbackFactory<RemoteFenceService> {
private static final Logger log = LoggerFactory.getLogger(RemoteFenceFallbackFactory.class);
@Override
public RemoteFenceService create(Throwable cause) {
log.error("远程调用围栏服务失败:{}",cause.getMessage());
return new RemoteFenceService() {
@Override
public Result<Fence> fenceById(Integer fenceId, String source) {
return Result.error("保存操作日志失败:" + cause.getMessage());
}
};
}
}

View File

@ -1,7 +1,7 @@
package com.god.base.server.config; package com.god.base.server.config;
import com.god.base.common.constant.EventConstant; import com.god.base.common.constant.EventConstant;
import com.god.base.domain.Car;
import com.god.base.domain.request.QueryCarRequest; import com.god.base.domain.request.QueryCarRequest;
import com.god.base.server.service.impl.TopLineServiceImpl; import com.god.base.server.service.impl.TopLineServiceImpl;
import com.god.common.redis.service.RedisService; import com.god.common.redis.service.RedisService;

View File

@ -1,179 +1,179 @@
package com.god.base.server.controller; //package com.god.base.server.controller;
//
import com.alibaba.fastjson.JSONObject; //import com.alibaba.fastjson.JSONObject;
import com.god.base.domain.Car; //import com.god.base.domain.Car;
import com.god.base.domain.CarType; //import com.god.base.domain.CarType;
import com.god.base.domain.Fence; //import com.god.base.domain.Fence;
import com.god.base.domain.VehicleMessage; //import com.god.base.domain.VehicleMessage;
import com.god.base.domain.request.CarRequest; //import com.god.base.domain.request.CarRequest;
import com.god.base.server.mapper.CarMapper; //import com.god.base.server.mapper.CarMapper;
import com.god.base.server.service.CarService; //import com.god.base.server.service.CarService;
import com.god.common.core.domain.Result; //import com.god.common.core.domain.Result;
import com.god.common.core.utils.poi.ExcelUtil; //import com.god.common.core.utils.poi.ExcelUtil;
import com.god.common.core.web.controller.BaseController; //import com.god.common.core.web.controller.BaseController;
import com.god.common.log.annotation.Log; //import com.god.common.log.annotation.Log;
import com.god.common.log.enums.BusinessType; //import com.god.common.log.enums.BusinessType;
import com.god.common.security.annotation.RequiresPermissions; //import com.god.common.security.annotation.RequiresPermissions;
import lombok.extern.log4j.Log4j2; //import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; //import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; //import org.springframework.web.bind.annotation.*;
//
import javax.servlet.http.HttpServletRequest; //import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; //import javax.servlet.http.HttpServletResponse;
import java.util.List; //import java.util.List;
//
/** ///**
* // * 车辆管理
*/ // */
@RestController //@RestController
@RequestMapping("/car") //@RequestMapping("/car")
@Log4j2 //@Log4j2
public class CarController extends BaseController { //public class CarController extends BaseController {
//
@Autowired // @Autowired
private HttpServletRequest request; // 用于获取方法执行信息 // private HttpServletRequest request; // 用于获取方法执行信息
//
@Autowired // @Autowired
private CarService carService; // private CarService carService;
//
@Autowired // @Autowired
private CarMapper carMapper; // private CarMapper carMapper;
//
//
/** // /**
* vin // * 根据vin查询车辆信息管理列表
*/ // */
@GetMapping("/list") // @GetMapping("/list")
public Result<Car> list(@RequestParam("carVinId") String carVinId){ // public Result<Car> list(@RequestParam("carVinId") String carVinId){
//
Car list = carService.selectCarInfoList(carVinId); // Car list = carService.selectCarInfoList(carVinId);
//
return Result.success(list); // return Result.success(list);
} // }
//
/** // /**
* // * 车辆信息查看
*/ // */
@GetMapping("/carList/{userId}") // @GetMapping("/carList/{userId}")
public Result<?> carList(@PathVariable String userId){ // public Result<?> carList(@PathVariable String userId){
//
log.info("功能介绍车辆信息列表查看,请求方式:{},请求路径:{},请求参数:{}", // log.info("功能介绍车辆信息列表查看,请求方式:{},请求路径:{},请求参数:{}",
request.getMethod(), // request.getMethod(),
request.getRequestURL(), // request.getRequestURL(),
JSONObject.toJSONString(userId)); // JSONObject.toJSONString(userId));
//
startPage();//设置请求分页数据 继承方法 // startPage();//设置请求分页数据 继承方法
Result<List<Car>> carList = carService.carList(userId); // Result<List<Car>> carList = carService.carList(userId);
//
log.info("功能介绍车辆信息列表查看,响应方式:{},响应路径:{},响应参数:{}", // log.info("功能介绍车辆信息列表查看,响应方式:{},响应路径:{},响应参数:{}",
request.getMethod(), // request.getMethod(),
request.getRequestURL(), // request.getRequestURL(),
JSONObject.toJSONString(carList)); // JSONObject.toJSONString(carList));
//
return carList; // return carList;
} // }
//
//
/** // /**
* // * 添加车辆管理信息
*/ // */
@Log(title = "添加车辆管理信息" , businessType = BusinessType.INSERT) // 添加 // @Log(title = "添加车辆管理信息" , businessType = BusinessType.INSERT) // 添加
@PostMapping("/addCar") // @PostMapping("/addCar")
public Result addCarP(@RequestBody @Validated CarRequest carRequest){ // public Result addCarP(@RequestBody @Validated CarRequest carRequest){
//
carService.save(Car.carBuildAdd(carRequest)); // carService.save(Car.carBuildAdd(carRequest));
//
return Result.success(); // return Result.success();
} // }
//
/** // /**
* // * 修改车辆信息
*/ // */
@Log(title = "修改车辆信息" , businessType = BusinessType.UPDATE) //修改 // @Log(title = "修改车辆信息" , businessType = BusinessType.UPDATE) //修改
@PostMapping("/updCar") // @PostMapping("/updCar")
public Result updCar(@PathVariable @Validated Car car){ // public Result updCar(@PathVariable @Validated Car car){
log.info("功能介绍修改车辆,请求方式:{},请求路径:{},请求参数:{}", // log.info("功能介绍修改车辆,请求方式:{},请求路径:{},请求参数:{}",
request.getMethod(), // request.getMethod(),
request.getRequestURL(), // request.getRequestURL(),
JSONObject.toJSONString(car)); // JSONObject.toJSONString(car));
//
carService.updateById(car); // carService.updateById(car);
//
log.info("功能介绍修改车辆,响应方式:{},响应路径:{},响应参数:{}", // log.info("功能介绍修改车辆,响应方式:{},响应路径:{},响应参数:{}",
request.getMethod(), // request.getMethod(),
request.getRequestURL(), // request.getRequestURL(),
JSONObject.toJSONString(car)); // JSONObject.toJSONString(car));
//
return Result.success(); // return Result.success();
} // }
//
/** // /**
* // * 逻辑删除车辆信息管理
*/ // */
@Log(title = "逻辑删除车辆信息管理" , businessType = BusinessType.DELETE) // 删除 // @Log(title = "逻辑删除车辆信息管理" , businessType = BusinessType.DELETE) // 删除
@GetMapping("/delCar/{vinId}") // @GetMapping("/delCar/{vinId}")
public Result delCar(@PathVariable String vinId){ // public Result delCar(@PathVariable String vinId){
log.info("功能介绍逻辑删除车辆信息,请求方式:{},请求路径:{},请求参数:{}", // log.info("功能介绍逻辑删除车辆信息,请求方式:{},请求路径:{},请求参数:{}",
request.getMethod(), // request.getMethod(),
request.getRequestURL(), // request.getRequestURL(),
JSONObject.toJSONString(vinId)); // JSONObject.toJSONString(vinId));
//
boolean b = carService.removeById(vinId); // boolean b = carService.removeById(vinId);
//
log.info("功能介绍逻辑删除车辆信息,响应方式:{},响应路径:{},响应参数:{}", // log.info("功能介绍逻辑删除车辆信息,响应方式:{},响应路径:{},响应参数:{}",
request.getMethod(), // request.getMethod(),
request.getRequestURL(), // request.getRequestURL(),
JSONObject.toJSONString(b)); // JSONObject.toJSONString(b));
//
return Result.success(); // return Result.success();
} // }
//
/** // /**
* // * 导出车辆信息管理列表
*/ // */
@Log(title = "导出车辆信息管理列表" , businessType = BusinessType.EXPORT) // 导出 跳转业务操作类型表中 // @Log(title = "导出车辆信息管理列表" , businessType = BusinessType.EXPORT) // 导出 跳转业务操作类型表中
@PostMapping("/export") // @PostMapping("/export")
public void export(HttpServletResponse response , Car car , CarRequest carRequest) // public void export(HttpServletResponse response , Car car , CarRequest carRequest)
{ // {
List<Car> list = carMapper.getList(String.valueOf(car.getUserId())); // List<Car> list = carMapper.getList(String.valueOf(car.getUserId()));
ExcelUtil<Car> util = new ExcelUtil<>(Car.class); // ExcelUtil<Car> util = new ExcelUtil<>(Car.class);
//对list数据源将其里面的数据导入到excel表单 // //对list数据源将其里面的数据导入到excel表单
util.exportExcel(response,list,"车辆信息管理"); // util.exportExcel(response,list,"车辆信息管理");
} // }
//
//
/** // /**
* 线 // * 获取所有在线车辆
*/ // */
@GetMapping("/onlineVehicle") // @GetMapping("/onlineVehicle")
public Result<List<VehicleMessage>> onlineVehicle(){ // public Result<List<VehicleMessage>> onlineVehicle(){
return carService.onlineVehicle(); // return carService.onlineVehicle();
} // }
//
/** // /**
* // * 统计车辆
*/ // */
@GetMapping("/countData") // @GetMapping("/countData")
public Result<String> countData(){ // public Result<String> countData(){
return carService.countData(); // return carService.countData();
} // }
//
/** // /**
* id // * 查看电子围栏id 获取下拉框
*/ // */
@GetMapping("/fenceId") // @GetMapping("/fenceId")
public Result<List<Fence>> fenceId(){ // public Result<List<Fence>> fenceId(){
List<Fence> fenceId = carService.fenceId(); // List<Fence> fenceId = carService.fenceId();
return Result.success(fenceId); // return Result.success(fenceId);
} // }
/** // /**
* id // * 查看车辆类型id 获取下拉框
*/ // */
@GetMapping("/carType") // @GetMapping("/carType")
public Result<List<CarType>> carTypeId(){ // public Result<List<CarType>> carTypeId(){
List<CarType> carTypeId = carService.carTypeId(); // List<CarType> carTypeId = carService.carTypeId();
return Result.success(carTypeId); // return Result.success(carTypeId);
} // }
//
} //}

View File

@ -9,7 +9,6 @@ package com.god.base.server.controller;
**/ **/
import com.god.base.common.constant.EventConstant; import com.god.base.common.constant.EventConstant;
import com.god.base.domain.Car;
import com.god.base.domain.Fence; import com.god.base.domain.Fence;
import com.god.base.domain.request.FenceAddRequest; import com.god.base.domain.request.FenceAddRequest;
import com.god.base.domain.request.FenceQueryRequest; import com.god.base.domain.request.FenceQueryRequest;

View File

@ -1,6 +1,7 @@
package com.god.base.server.controller; package com.god.base.server.controller;
import com.god.base.domain.FirmCar; import com.god.base.domain.FirmCar;
import com.god.base.domain.request.FirmCarInsertReq;
import com.god.base.domain.request.FirmCarRequest; import com.god.base.domain.request.FirmCarRequest;
import com.god.base.server.service.FirmCarService; import com.god.base.server.service.FirmCarService;
import com.god.common.core.domain.Result; import com.god.common.core.domain.Result;
@ -30,14 +31,14 @@ public class FirmCarController {
/** /**
* *
* @param firmCar * @param firmCarInsertReq
* @return * @return
*/ */
@PostMapping("/inertFirmCar") @PostMapping("/inertFirmCar")
@Log(title = "添加车辆") @Log(title = "添加车辆")
public Result<String> inertFirmCar(@RequestBody FirmCar firmCar) { public Result<String> inertFirmCar(@RequestBody FirmCarInsertReq firmCarInsertReq) {
//添加车辆 //添加车辆
firmCarService.save(firmCar); firmCarService.save(FirmCar.FirmInsertCar(firmCarInsertReq));
return Result.success("","添加成功!"); return Result.success("","添加成功!");
} }

View File

@ -1,62 +1,51 @@
package com.god.base.server.mapper; //package com.god.base.server.mapper;
//
import com.baomidou.dynamic.datasource.annotation.DS; //import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; //import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.god.base.domain.Car; //import com.god.base.domain.Car;
import com.god.base.domain.CarType; //import com.god.base.domain.CarType;
import com.god.base.domain.Fence; //import com.god.base.domain.Fence;
import com.god.base.domain.request.CarRequest; //import com.god.base.domain.request.CarRequest;
import org.apache.ibatis.annotations.Mapper; //import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; //import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; //import org.apache.ibatis.annotations.Select;
//
import java.util.List; //import java.util.List;
//
//
/** ///**
* mapper // * 车辆mapper
*/ // */
@Mapper //@Mapper
public interface CarMapper extends BaseMapper<Car> { //public interface CarMapper extends BaseMapper<Car> {
//
//
List<Car> getList(@Param("userId") String userId); // List<Car> getList(@Param("userId") String userId);
//
// @Select("select * from t_car where 1=1 " + //
// "<if test=\"carVinId != null and carVinId != ''\"> and car_vin_id = #{carVinId}</if>" + // /**
// "<if test=\"carTypeId != null \"> and car_type_id = #{carTypeId}</if>" + // * 根据vin进行查询管理信息
// "<if test=\"fenceId != null and fenceId != ''\"> and fence_id = #{fenceId}</if>" + // * @param vinId
// "<if test=\"status != null \"> and status = #{status}</if>" + // * @return
// "<if test=\"motorManufacturer != null and motorManufacturer != ''\"> and motor_manufacturer = #{motorManufacturer}</if>" + // */
// "<if test=\"batteryManufacturer != null and batteryManufacturer != ''\"> and battery_manufacturer = #{batteryManufacturer}</if>" + //
// "<if test=\"motorNumber != null and motorNumber != ''\"> and motor_number = #{motorNumber}</if>" + // Car HuiCarSelect(@Param("vinId") String vinId);
// "<if test=\"batteryNumber != null and batteryNumber != ''\"> and battery_number = #{batteryNumber}</if>" //
// ) // /**
// List<Car> selectCarInfoList(Car car); // * 车辆管理信息查询
// * @param carRequest
/** // * @return
* vin // */
* @param vinId // List<Car> selectVehicleInfoList(CarRequest carRequest);
* @return //
*/ // List<String> getOnlineCarIds();
//
Car HuiCarSelect(@Param("vinId") String vinId); // Integer getOnlineCarCount();
//
/** // Integer getUnOnlineCount();
* //
* @param carRequest //
* @return // List<Fence> fenceId();
*/ //
List<Car> selectVehicleInfoList(CarRequest carRequest); // List<CarType> carTypeId();
//}
List<String> getOnlineCarIds();
Integer getOnlineCarCount();
Integer getUnOnlineCount();
List<Fence> fenceId();
List<CarType> carTypeId();
}

View File

@ -1,7 +1,6 @@
package com.god.base.server.mapper; package com.god.base.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.god.base.domain.Car;
import com.god.base.domain.TopicCar; import com.god.base.domain.TopicCar;
import com.god.base.domain.request.CarRequest; import com.god.base.domain.request.CarRequest;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;

View File

@ -1,51 +1,51 @@
package com.god.base.server.service; //package com.god.base.server.service;
//
import com.baomidou.mybatisplus.extension.service.IService; //import com.baomidou.mybatisplus.extension.service.IService;
import com.god.base.domain.Car; //
import com.god.base.domain.CarType; //import com.god.base.domain.CarType;
import com.god.base.domain.Fence; //import com.god.base.domain.Fence;
import com.god.base.domain.VehicleMessage; //import com.god.base.domain.VehicleMessage;
import com.god.common.core.domain.Result; //import com.god.common.core.domain.Result;
import org.apache.ibatis.annotations.Param; //import org.apache.ibatis.annotations.Param;
//
import java.util.List; //import java.util.List;
//
/** ///**
* // * 车辆管理层
*/ // */
public interface CarService extends IService<Car> { //public interface CarService extends IService<Car> {
//
//
Result<List<Car>> carList(@Param("userId") String userId); // Result<List<Car>> carList(@Param("userId") String userId);
//
//
Car selectCarInfoList(@Param("vinId") String vinId); // Car selectCarInfoList(@Param("vinId") String vinId);
//
Result<List<VehicleMessage>> onlineVehicle(); // Result<List<VehicleMessage>> onlineVehicle();
//
/** // /**
* // * 响应信息主题
* @return // * @return
*/ // */
Result<String> countData(); // Result<String> countData();
//
//
//
/** // /**
* id // * 通过电子围栏id 获取这一条信息
* @param // * @param
* @return // * @return
*/ // */
List<Fence> fenceId(); // List<Fence> fenceId();
//
/** // /**
* id // * 通过车辆类型id 获取车辆类型
* @param // * @param
* @return // * @return
* @return // * @return
*/ // */
List<CarType> carTypeId(); // List<CarType> carTypeId();
} //}
//
//
//

View File

@ -1,18 +0,0 @@
//package com.god.base.server.service;
//
//import com.baomidou.mybatisplus.extension.service.IService;
//import com.god.base.domain.RequestLog;
//
///**
// * AOP
// *
// * @author ChenXinHai
// * @version 2023/11/22 - 18:39
// */
//public interface RequestLogService extends IService<RequestLog> {
// /**
// * 异步保存
// * @param entity
// */
// void asyncSave(RequestLog entity);
//}

View File

@ -1,184 +1,184 @@
package com.god.base.server.service.impl; //package com.god.base.server.service.impl;
//
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; //import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.god.base.domain.Car; //import com.god.base.domain.Car;
import com.god.base.domain.CarType; //import com.god.base.domain.CarType;
import com.god.base.domain.Fence; //import com.god.base.domain.Fence;
import com.god.base.domain.VehicleMessage; //import com.god.base.domain.VehicleMessage;
import com.god.base.common.constant.RedisConstant; //import com.god.base.common.constant.RedisConstant;
import com.god.base.server.mapper.CarMapper; //import com.god.base.server.mapper.CarMapper;
import com.god.base.server.service.CarService; //import com.god.base.server.service.CarService;
import com.god.common.core.domain.Result; //import com.god.common.core.domain.Result;
import lombok.extern.log4j.Log4j2; //import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; //import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import java.io.Serializable; //import java.io.Serializable;
import java.util.List; //import java.util.List;
import java.util.stream.Collectors; //import java.util.stream.Collectors;
//
/** ///**
* // * 车辆管理业务层
*/ // */
@Log4j2 //@Log4j2
@Service //@Service
public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements CarService { //public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements CarService {
//
@Autowired // @Autowired
private CarMapper carMapper; // private CarMapper carMapper;
//
@Autowired // @Autowired
private RedisTemplate redisTemplate; // private RedisTemplate redisTemplate;
//
//
/**
*
*
* @param userId
* @return
*/
@Override
public Result<List<Car>> carList(String userId) {
// Long userId1 = SecurityUtils.getUserId();
// if (null == userId1){
// throw new SecurityException("请先登录");
// }
List<Car> carList = carMapper.getList(userId);
return Result.success(carList);
}
// /** // /**
// * 查询车辆信息管理列表 // * 车辆信息
// * // *
// * @param carRequest 车辆信息管理 // * @param userId
// * @return // * @return
// */ // */
// @Override // @Override
// public List<Car> selectCarInfoList(CarRequest carRequest) { // public Result<List<Car>> carList(String userId) {
// LambdaQueryWrapper<Car> lambdaQueryWrapper = new LambdaQueryWrapper<>(); //// Long userId1 = SecurityUtils.getUserId();
// //判断vin是否为空 //// if (null == userId1){
// if (StringUtils.isNotEmpty(carRequest.getCarVinId())){ //// throw new SecurityException("请先登录");
// //模糊查询 vin //// }
// lambdaQueryWrapper.like(Car::getCarVinId, carRequest.getCarVinId()); // List<Car> carList = carMapper.getList(userId);
// } // return Result.success(carList);
// //模糊查询 车辆类型
// lambdaQueryWrapper.like(Car::getCarTypeId, carRequest.getCarTypeId());
// //模糊查询 电子围栏
// lambdaQueryWrapper.like(Car::getFenceId, carRequest.getFenceId());
// //模糊查询 车辆状态
// lambdaQueryWrapper.like(Car::getStatus, carRequest.getStatus());
// if (StringUtils.isNotEmpty(carRequest.getBatteryManufacturer())){
// //模糊查询 电池厂商
// lambdaQueryWrapper.like(Car::getBatteryManufacturer, carRequest.getBatteryManufacturer());
// }
// if (StringUtils.isNotEmpty(carRequest.getMotorManufacturer())){
// //模糊查询 电机厂商
// lambdaQueryWrapper.like(Car::getMotorManufacturer, carRequest.getMotorManufacturer());
// }
// if (StringUtils.isNotEmpty(carRequest.getMotorNumber())){
// //模糊查询 电机编号
// lambdaQueryWrapper.like(Car::getMotorNumber, carRequest.getMotorNumber());
// }
// if (StringUtils.isNotEmpty(carRequest.getBatteryNumber())){
// //模糊查询 电池编号
// lambdaQueryWrapper.like(Car::getBatteryNumber, carRequest.getBatteryNumber());
// } // }
// //
// return carMapper.selectVehicleInfoList(carRequest); //
//// /**
//// * 查询车辆信息管理列表
//// *
//// * @param carRequest 车辆信息管理
//// * @return
//// */
//// @Override
//// public List<Car> selectCarInfoList(CarRequest carRequest) {
//// LambdaQueryWrapper<Car> lambdaQueryWrapper = new LambdaQueryWrapper<>();
//// //判断vin是否为空
//// if (StringUtils.isNotEmpty(carRequest.getCarVinId())){
//// //模糊查询 vin
//// lambdaQueryWrapper.like(Car::getCarVinId, carRequest.getCarVinId());
//// }
//// //模糊查询 车辆类型
//// lambdaQueryWrapper.like(Car::getCarTypeId, carRequest.getCarTypeId());
//// //模糊查询 电子围栏
//// lambdaQueryWrapper.like(Car::getFenceId, carRequest.getFenceId());
//// //模糊查询 车辆状态
//// lambdaQueryWrapper.like(Car::getStatus, carRequest.getStatus());
//// if (StringUtils.isNotEmpty(carRequest.getBatteryManufacturer())){
//// //模糊查询 电池厂商
//// lambdaQueryWrapper.like(Car::getBatteryManufacturer, carRequest.getBatteryManufacturer());
//// }
//// if (StringUtils.isNotEmpty(carRequest.getMotorManufacturer())){
//// //模糊查询 电机厂商
//// lambdaQueryWrapper.like(Car::getMotorManufacturer, carRequest.getMotorManufacturer());
//// }
//// if (StringUtils.isNotEmpty(carRequest.getMotorNumber())){
//// //模糊查询 电机编号
//// lambdaQueryWrapper.like(Car::getMotorNumber, carRequest.getMotorNumber());
//// }
//// if (StringUtils.isNotEmpty(carRequest.getBatteryNumber())){
//// //模糊查询 电池编号
//// lambdaQueryWrapper.like(Car::getBatteryNumber, carRequest.getBatteryNumber());
//// }
////
//// return carMapper.selectVehicleInfoList(carRequest);
//// }
//
//
// /**
// * 查询车辆信息管理列表信息
// * @param vinId
// * @return
// */
// @Override
// public Car selectCarInfoList(String vinId) {
// return carMapper.HuiCarSelect(vinId);
// } // }
//
//
/** //
* // /**
* @param vinId // * 根据VIN 编辑管理修改车辆信息数据
* @return // * @param entity
*/ // * @return
@Override // */
public Car selectCarInfoList(String vinId) { // @Override
return carMapper.HuiCarSelect(vinId); // public boolean updateById(Car entity) {
} // boolean updatedById = super.updateById(entity);
// if (!updatedById){
// throw new RuntimeException("修改失败");
// }
/** // return true;
* VIN // }
* @param entity //
* @return // /**
*/ // * 添加车辆管理数据
@Override // * @param entity
public boolean updateById(Car entity) { // * @return
boolean updatedById = super.updateById(entity); // */
if (!updatedById){ // @Override
throw new RuntimeException("修改失败"); // public boolean save(Car entity) {
} // boolean addCar = super.save(entity);
return true; // if (!addCar){
} // throw new RuntimeException("添加车辆管理失败失败");
// }
/** // return true;
* // }
* @param entity //
* @return // /**
*/ // * 删除车辆信息数据
@Override // *
public boolean save(Car entity) { // * @param id
boolean addCar = super.save(entity); // * @return
if (!addCar){ // */
throw new RuntimeException("添加车辆管理失败失败"); // @Override
} // public boolean removeById(Serializable id) {
return true; // boolean remove = super.removeById(id);
} // if (remove ==false) {
// log.warn("删除管理车辆数据:[/-{}-/]失败!", id);
/** // throw new RuntimeException("删除管理车辆数据失败");
* // } else {
* // return true;
* @param id // }
* @return // }
*/ //
@Override // /**
public boolean removeById(Serializable id) { // * 获取所有在线车辆
boolean remove = super.removeById(id); // * @return
if (remove ==false) { // */
log.warn("删除管理车辆数据:[/-{}-/]失败!", id); // @Override
throw new RuntimeException("删除管理车辆数据失败"); // public Result<List<VehicleMessage>> onlineVehicle() {
} else { // List<String> ids = carMapper.getOnlineCarIds();
return true; // List<VehicleMessage> messages = ids.stream().map(id -> {
} // VehicleMessage message = (VehicleMessage) redisTemplate.opsForValue().get(RedisConstant.CURRENT_INFO + ":" + id);
} // return message;
// }).collect(Collectors.toList());Collectors.toList();
/** // return Result.success(messages);
* 线 // }
* @return //
*/ // @Override
@Override // public Result<String> countData() {
public Result<List<VehicleMessage>> onlineVehicle() { // Integer day = (Integer) redisTemplate.opsForValue().get(RedisConstant.VEHICLE_INFO_TOKEN+RedisConstant.CURRENT_DAY_FAULT);
List<String> ids = carMapper.getOnlineCarIds(); // Integer month = (Integer) redisTemplate.opsForValue().get(RedisConstant.VEHICLE_INFO_TOKEN+RedisConstant.CURRENT_MONTH_FAULT);
List<VehicleMessage> messages = ids.stream().map(id -> { // Integer onlineCount = carMapper.getOnlineCarCount();
VehicleMessage message = (VehicleMessage) redisTemplate.opsForValue().get(RedisConstant.CURRENT_INFO + ":" + id); // Integer unOnlineCount = carMapper.getUnOnlineCount();
return message; // return Result.success(day + ":" + month + ":" + onlineCount + ":" + unOnlineCount );
}).collect(Collectors.toList());Collectors.toList(); // }
return Result.success(messages); //
} // @Override
// public List<Fence> fenceId() {
@Override // return carMapper.fenceId();
public Result<String> countData() { // }
Integer day = (Integer) redisTemplate.opsForValue().get(RedisConstant.VEHICLE_INFO_TOKEN+RedisConstant.CURRENT_DAY_FAULT); //
Integer month = (Integer) redisTemplate.opsForValue().get(RedisConstant.VEHICLE_INFO_TOKEN+RedisConstant.CURRENT_MONTH_FAULT); // @Override
Integer onlineCount = carMapper.getOnlineCarCount(); // public List<CarType> carTypeId() {
Integer unOnlineCount = carMapper.getUnOnlineCount(); // return carMapper.carTypeId();
return Result.success(day + ":" + month + ":" + onlineCount + ":" + unOnlineCount ); // }
} //
//
@Override //}
public List<Fence> fenceId() {
return carMapper.fenceId();
}
@Override
public List<CarType> carTypeId() {
return carMapper.carTypeId();
}
}

View File

@ -3,7 +3,7 @@ package com.god.base.server.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.god.base.domain.Car;
import com.god.base.domain.HisPath; import com.god.base.domain.HisPath;
import com.god.base.domain.TopicCar; import com.god.base.domain.TopicCar;
import com.god.base.domain.request.GetTopicReq; import com.god.base.domain.request.GetTopicReq;

View File

@ -1,10 +1,14 @@
package com.god.base.server.utils; package com.god.base.server.utils;
import com.god.base.domain.Car;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.god.base.domain.Fence; import com.god.base.domain.Fence;
import com.god.base.domain.FirmCar;
import com.god.base.domain.request.FenceQueryRequest; import com.god.base.domain.request.FenceQueryRequest;
import com.god.base.server.service.CarService; import com.god.base.domain.request.FirmCarRequest;
import com.god.base.server.service.FenceService; import com.god.base.server.service.FenceService;
import com.god.base.server.service.FirmCarService;
import com.god.common.core.domain.Result; import com.god.common.core.domain.Result;
import com.god.common.core.web.page.TableDataInfo; import com.god.common.core.web.page.TableDataInfo;
import com.god.common.redis.service.RedisService; import com.god.common.redis.service.RedisService;
@ -27,7 +31,7 @@ import java.util.*;
public class CarFenceMonitor { public class CarFenceMonitor {
@Autowired @Autowired
private CarService carService; private FirmCarService firmCarService;
@Autowired @Autowired
private FenceService fenceService; private FenceService fenceService;
@ -41,15 +45,15 @@ public class CarFenceMonitor {
log.info("开始获取车辆围栏信息"); log.info("开始获取车辆围栏信息");
//获取车辆信息 //获取车辆信息
Result<List<Car>> listResult = carService.carList(null); List<FirmCar> dataCar = firmCarService.findFirmCarByUserId(new FirmCarRequest());
List<Car> dataCar = listResult.getData();
if (dataCar.size() <= 0) { if (dataCar.size() <= 0) {
throw new RuntimeException("查无管理车辆"); throw new RuntimeException("查无管理车辆");
} }
//新建map集合存储车辆围栏 //新建map集合存储车辆围栏
Map<String, Set<Fence>> map = new HashMap<>(); Map<String, Set<Fence>> map = new HashMap<>();
for (Car car : dataCar) { for (FirmCar car : dataCar) {
//单线程获取车辆围栏信息 //单线程获取车辆围栏信息
FenceQueryRequest fenceQueryRequest = new FenceQueryRequest(); FenceQueryRequest fenceQueryRequest = new FenceQueryRequest();

View File

@ -1,90 +1,90 @@
<?xml version="1.0" encoding="UTF-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"> <!--<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">-->
<mapper namespace="com.god.base.server.mapper.CarMapper"> <!--<mapper namespace="com.god.base.server.mapper.CarMapper">-->
<!-- 车辆列表--> <!--&lt;!&ndash; 车辆列表&ndash;&gt;-->
<!-- <select id="getList" resultType="com.god.base.server.common.domain.Car">--> <!--&lt;!&ndash; <select id="getList" resultType="com.god.base.server.common.domain.Car">&ndash;&gt;-->
<!-- SELECT--> <!--&lt;!&ndash; SELECT&ndash;&gt;-->
<!-- t_car.car_vin_id as vin ,--> <!--&lt;!&ndash; t_car.car_vin_id as vin ,&ndash;&gt;-->
<!-- t_car.car_type_id as 车辆类型 ,--> <!--&lt;!&ndash; t_car.car_type_id as 车辆类型 ,&ndash;&gt;-->
<!-- t_car.fence_id as 电子围栏ID ,--> <!--&lt;!&ndash; t_car.fence_id as 电子围栏ID ,&ndash;&gt;-->
<!-- t_car.battery_manufacturer as 电池厂商 ,--> <!--&lt;!&ndash; t_car.battery_manufacturer as 电池厂商 ,&ndash;&gt;-->
<!-- t_car.motor_manufacturer as 电机厂商 ,--> <!--&lt;!&ndash; t_car.motor_manufacturer as 电机厂商 ,&ndash;&gt;-->
<!-- t_car.motor_number as 电机编号 ,--> <!--&lt;!&ndash; t_car.motor_number as 电机编号 ,&ndash;&gt;-->
<!-- t_car.battery_number as 电池编号 ,--> <!--&lt;!&ndash; t_car.battery_number as 电池编号 ,&ndash;&gt;-->
<!-- t_car.status as 车辆状态--> <!--&lt;!&ndash; t_car.status as 车辆状态&ndash;&gt;-->
<!-- FROM--> <!--&lt;!&ndash; FROM&ndash;&gt;-->
<!-- t_car--> <!--&lt;!&ndash; t_car&ndash;&gt;-->
<!-- JOIN t_fence ON t_car.fence_id = t_fence.fence_id--> <!--&lt;!&ndash; JOIN t_fence ON t_car.fence_id = t_fence.fence_id&ndash;&gt;-->
<!-- JOIN t_car_type ON t_car.car_type_id = t_car_type.id--> <!--&lt;!&ndash; JOIN t_car_type ON t_car.car_type_id = t_car_type.id&ndash;&gt;-->
<!-- where t_car.user_id = #{userId1}--> <!--&lt;!&ndash; where t_car.user_id = #{userId1}&ndash;&gt;-->
<!--&lt;!&ndash; </select>&ndash;&gt;-->
<!-- <sql id="selectVehicleInfoVo">-->
<!-- select car_vin_id, car_type_id, fence_id, battery_manufacturer, motor_manufacturer, motor_numberr, battery_number,status from t_car-->
<!-- </sql>-->
<!--&lt;!&ndash;车辆列表查询&ndash;&gt;-->
<!-- <select id="selectVehicleInfoList" resultType="com.god.base.domain.Car">-->
<!-- <include refid="selectVehicleInfoVo"/>-->
<!-- <where>-->
<!-- <if test="carVinId != null and carVinId != ''"> and car_vin_id = #{carVinId}</if>-->
<!-- <if test="carTypeId != null"> and car_type_id = #{carTypeId}</if>-->
<!-- <if test="fenceId != null and fenceId != ''"> and fence_id = #{fenceId}</if>-->
<!-- <if test="status != null"> and status = #{status}</if>-->
<!-- <if test="motorManufacturer != null and motorManufacturer != ''"> and motor_manufacturer = #{motorManufacturer}</if>-->
<!-- <if test="batteryManufacturer != null and batteryManufacturer != ''"> and battery_manufacturer = #{batteryManufacturer}</if>-->
<!-- <if test="motorNumber != null and motorNumber != ''"> and motor_number = #{motorNumber}</if>-->
<!-- <if test="batteryNumber != null and batteryNumber != ''"> and battery_number = #{batteryNumber}</if>-->
<!-- </where>-->
<!-- </select>-->
<!-- <select id="getOnlineCarIds" resultType="java.lang.String">-->
<!-- select vin-->
<!-- from car where vehicle_status = 1-->
<!-- </select>--> <!-- </select>-->
<sql id="selectVehicleInfoVo"> <!-- <select id="getOnlineCarCount" resultType="java.lang.Integer">-->
select car_vin_id, car_type_id, fence_id, battery_manufacturer, motor_manufacturer, motor_numberr, battery_number,status from t_car <!-- select count(*)-->
</sql> <!-- from t_car where status = 1-->
<!--车辆列表查询--> <!-- </select>-->
<select id="selectVehicleInfoList" resultType="com.god.base.domain.Car"> <!-- <select id="getUnOnlineCount" resultType="java.lang.Integer">-->
<include refid="selectVehicleInfoVo"/> <!-- select count(*)-->
<where> <!-- from t_car-->
<if test="carVinId != null and carVinId != ''"> and car_vin_id = #{carVinId}</if>" <!-- </select>-->
<if test="carTypeId != null"> and car_type_id = #{carTypeId}</if>" <!--&lt;!&ndash; 根据vin查询当前对象的所有信息&ndash;&gt;-->
<if test="fenceId != null and fenceId != ''"> and fence_id = #{fenceId}</if>" <!-- <select id="HuiCarSelect" resultType="com.god.base.domain.Car">-->
<if test="status != null"> and status = #{status}</if>" <!-- <include refid="selectVehicleInfoVo"/>-->
<if test="motorManufacturer != null and motorManufacturer != ''"> and motor_manufacturer = #{motorManufacturer}</if>" <!-- where car_vin_id = #{vinId}-->
<if test="batteryManufacturer != null and batteryManufacturer != ''"> and battery_manufacturer = #{batteryManufacturer}</if>" <!-- </select>-->
<if test="motorNumber != null and motorNumber != ''"> and motor_number = #{motorNumber}</if>" <!--&lt;!&ndash; 根据电子围栏 获取电子围栏信息&ndash;&gt;-->
<if test="batteryNumber != null and batteryNumber != ''"> and battery_number = #{batteryNumber}</if>" <!-- <select id="fenceId" resultType="com.god.base.domain.Fence">-->
</where> <!-- SELECT * from t_fence-->
<!-- </select>-->
<!--&lt;!&ndash; 根据车辆类型 获取车辆类型下拉框&ndash;&gt;-->
<!-- <select id="carTypeId" resultType="com.god.base.domain.CarType">-->
<!-- select * from t_car_type-->
<!-- </select>-->
<!-- <select id="getList" resultType="com.god.base.domain.Car">-->
<!-- SELECt-->
<!-- t_car.car_vin_id ,-->
<!-- t_car_type.car_type_name ,-->
<!-- t_car.battery_manufacturer ,-->
<!-- t_car.motor_manufacturer ,-->
<!-- t_car.motor_number ,-->
<!-- t_car.battery_number ,-->
<!-- t_car.status-->
<!-- FROM-->
<!-- t_car-->
<!-- JOIN t_car_type ON t_car.car_type_id = t_car_type.id-->
<!-- <where>-->
<!-- <if test="userId != null">-->
<!-- and t_car.user_id = #{userId}-->
<!-- </if>-->
<!-- </where>-->
</select> <!-- </select>-->
<!--</mapper>-->
<select id="getOnlineCarIds" resultType="java.lang.String">
select vin
from car where vehicle_status = 1
</select>
<select id="getOnlineCarCount" resultType="java.lang.Integer">
select count(*)
from t_car where status = 1
</select>
<select id="getUnOnlineCount" resultType="java.lang.Integer">
select count(*)
from t_car
</select>
<!-- 根据vin查询当前对象的所有信息-->
<select id="HuiCarSelect" resultType="com.god.base.domain.Car">
<include refid="selectVehicleInfoVo"/>
where car_vin_id = #{vinId}
</select>
<!-- 根据电子围栏 获取电子围栏信息-->
<select id="fenceId" resultType="com.god.base.domain.Fence">
SELECT * from t_fence
</select>
<!-- 根据车辆类型 获取车辆类型下拉框-->
<select id="carTypeId" resultType="com.god.base.domain.CarType">
select * from t_car_type
</select>
<select id="getList" resultType="com.god.base.domain.Car">
SELECt
t_car.car_vin_id ,
t_car_type.car_type_name ,
t_car.battery_manufacturer ,
t_car.motor_manufacturer ,
t_car.motor_number ,
t_car.battery_number ,
t_car.status
FROM
t_car
JOIN t_car_type ON t_car.car_type_id = t_car_type.id
<where>
<if test="userId != null">
and t_car.user_id = #{userId}
</if>
</where>
</select>
</mapper>