车辆管理系统更新

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

View File

@ -1,12 +1,18 @@
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.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
*
@ -18,6 +24,7 @@ import javax.validation.constraints.NotNull;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "t_car")
public class FirmCar {
@ -90,7 +97,7 @@ public class FirmCar {
* 1-
* 0-
*/
private Integer is_delete;
private Integer isDelete;
/**
*
* 1-线
@ -103,7 +110,54 @@ public class FirmCar {
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;
import com.god.base.domain.Fence;
import com.god.base.domain.FirmCar;
import com.god.base.remote.factory.RemoteCarFallbackFactory;
import com.god.base.domain.Car;
import com.god.common.core.domain.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
@ -17,8 +18,8 @@ import org.springframework.web.bind.annotation.*;
public interface RemoteCarService {
@GetMapping("/car/list")
public Result<Car> list(@RequestParam("carVinId") String carVinId);
@GetMapping("/FirmCar/findFirmCarByUserId")
public Result<FirmCar> list(@RequestParam("carVinId") String carVinId);
@PostMapping("/baseFence/fenceById")
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;
import com.god.base.domain.Fence;
import com.god.base.domain.FirmCar;
import com.god.base.remote.RemoteCarService;
import com.god.base.domain.Car;
import com.god.common.core.domain.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -25,8 +26,10 @@ public class RemoteCarFallbackFactory implements FallbackFactory<RemoteCarServic
log.error("远程调用车辆信息错误:{}",cause.getMessage());
return new RemoteCarService() {
@Override
public Result<Car> list(String carVinId) {
public Result<FirmCar> list(String carVinId) {
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;
import com.god.base.common.constant.EventConstant;
import com.god.base.domain.Car;
import com.god.base.domain.request.QueryCarRequest;
import com.god.base.server.service.impl.TopLineServiceImpl;
import com.god.common.redis.service.RedisService;

View File

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

View File

@ -1,6 +1,7 @@
package com.god.base.server.controller;
import com.god.base.domain.FirmCar;
import com.god.base.domain.request.FirmCarInsertReq;
import com.god.base.domain.request.FirmCarRequest;
import com.god.base.server.service.FirmCarService;
import com.god.common.core.domain.Result;
@ -30,14 +31,14 @@ public class FirmCarController {
/**
*
* @param firmCar
* @param firmCarInsertReq
* @return
*/
@PostMapping("/inertFirmCar")
@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("","添加成功!");
}

View File

@ -1,62 +1,51 @@
package com.god.base.server.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.god.base.domain.Car;
import com.god.base.domain.CarType;
import com.god.base.domain.Fence;
import com.god.base.domain.request.CarRequest;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* mapper
*/
@Mapper
public interface CarMapper extends BaseMapper<Car> {
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>" +
// "<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>"
// )
// List<Car> selectCarInfoList(Car car);
/**
* vin
* @param vinId
* @return
*/
Car HuiCarSelect(@Param("vinId") String vinId);
/**
*
* @param carRequest
* @return
*/
List<Car> selectVehicleInfoList(CarRequest carRequest);
List<String> getOnlineCarIds();
Integer getOnlineCarCount();
Integer getUnOnlineCount();
List<Fence> fenceId();
List<CarType> carTypeId();
}
//package com.god.base.server.mapper;
//
//import com.baomidou.dynamic.datasource.annotation.DS;
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import com.god.base.domain.Car;
//import com.god.base.domain.CarType;
//import com.god.base.domain.Fence;
//import com.god.base.domain.request.CarRequest;
//import org.apache.ibatis.annotations.Mapper;
//import org.apache.ibatis.annotations.Param;
//import org.apache.ibatis.annotations.Select;
//
//import java.util.List;
//
//
///**
// * 车辆mapper
// */
//@Mapper
//public interface CarMapper extends BaseMapper<Car> {
//
//
// List<Car> getList(@Param("userId") String userId);
//
//
// /**
// * 根据vin进行查询管理信息
// * @param vinId
// * @return
// */
//
// Car HuiCarSelect(@Param("vinId") String vinId);
//
// /**
// * 车辆管理信息查询
// * @param carRequest
// * @return
// */
// List<Car> selectVehicleInfoList(CarRequest carRequest);
//
// 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;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.god.base.domain.Car;
import com.god.base.domain.TopicCar;
import com.god.base.domain.request.CarRequest;
import org.apache.ibatis.annotations.Mapper;

View File

@ -1,51 +1,51 @@
package com.god.base.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.god.base.domain.Car;
import com.god.base.domain.CarType;
import com.god.base.domain.Fence;
import com.god.base.domain.VehicleMessage;
import com.god.common.core.domain.Result;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*/
public interface CarService extends IService<Car> {
Result<List<Car>> carList(@Param("userId") String userId);
Car selectCarInfoList(@Param("vinId") String vinId);
Result<List<VehicleMessage>> onlineVehicle();
/**
*
* @return
*/
Result<String> countData();
/**
* id
* @param
* @return
*/
List<Fence> fenceId();
/**
* id
* @param
* @return
* @return
*/
List<CarType> carTypeId();
}
//package com.god.base.server.service;
//
//import com.baomidou.mybatisplus.extension.service.IService;
//
//import com.god.base.domain.CarType;
//import com.god.base.domain.Fence;
//import com.god.base.domain.VehicleMessage;
//import com.god.common.core.domain.Result;
//import org.apache.ibatis.annotations.Param;
//
//import java.util.List;
//
///**
// * 车辆管理层
// */
//public interface CarService extends IService<Car> {
//
//
// Result<List<Car>> carList(@Param("userId") String userId);
//
//
// Car selectCarInfoList(@Param("vinId") String vinId);
//
// Result<List<VehicleMessage>> onlineVehicle();
//
// /**
// * 响应信息主题
// * @return
// */
// Result<String> countData();
//
//
//
// /**
// * 通过电子围栏id 获取这一条信息
// * @param
// * @return
// */
// List<Fence> fenceId();
//
// /**
// * 通过车辆类型id 获取车辆类型
// * @param
// * @return
// * @return
// */
// 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;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.god.base.domain.Car;
import com.god.base.domain.CarType;
import com.god.base.domain.Fence;
import com.god.base.domain.VehicleMessage;
import com.god.base.common.constant.RedisConstant;
import com.god.base.server.mapper.CarMapper;
import com.god.base.server.service.CarService;
import com.god.common.core.domain.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
*
*/
@Log4j2
@Service
public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements CarService {
@Autowired
private CarMapper carMapper;
@Autowired
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);
}
//package com.god.base.server.service.impl;
//
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.god.base.domain.Car;
//import com.god.base.domain.CarType;
//import com.god.base.domain.Fence;
//import com.god.base.domain.VehicleMessage;
//import com.god.base.common.constant.RedisConstant;
//import com.god.base.server.mapper.CarMapper;
//import com.god.base.server.service.CarService;
//import com.god.common.core.domain.Result;
//import lombok.extern.log4j.Log4j2;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.stereotype.Service;
//
//import java.io.Serializable;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * 车辆管理业务层
// */
//@Log4j2
//@Service
//public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements CarService {
//
// @Autowired
// private CarMapper carMapper;
//
// @Autowired
// private RedisTemplate redisTemplate;
//
//
// /**
// * 查询车辆信息管理列表
// * 车辆信息
// *
// * @param carRequest 车辆信息管理
// * @param userId
// * @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);
// 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 vinId
* @return
*/
@Override
public Car selectCarInfoList(String vinId) {
return carMapper.HuiCarSelect(vinId);
}
/**
* VIN
* @param entity
* @return
*/
@Override
public boolean updateById(Car entity) {
boolean updatedById = super.updateById(entity);
if (!updatedById){
throw new RuntimeException("修改失败");
}
return true;
}
/**
*
* @param entity
* @return
*/
@Override
public boolean save(Car entity) {
boolean addCar = super.save(entity);
if (!addCar){
throw new RuntimeException("添加车辆管理失败失败");
}
return true;
}
/**
*
*
* @param id
* @return
*/
@Override
public boolean removeById(Serializable id) {
boolean remove = super.removeById(id);
if (remove ==false) {
log.warn("删除管理车辆数据:[/-{}-/]失败!", id);
throw new RuntimeException("删除管理车辆数据失败");
} else {
return true;
}
}
/**
* 线
* @return
*/
@Override
public Result<List<VehicleMessage>> onlineVehicle() {
List<String> ids = carMapper.getOnlineCarIds();
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);
}
@Override
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);
Integer onlineCount = carMapper.getOnlineCarCount();
Integer unOnlineCount = carMapper.getUnOnlineCount();
return Result.success(day + ":" + month + ":" + onlineCount + ":" + unOnlineCount );
}
@Override
public List<Fence> fenceId() {
return carMapper.fenceId();
}
@Override
public List<CarType> carTypeId() {
return carMapper.carTypeId();
}
}
//
//
//// /**
//// * 查询车辆信息管理列表
//// *
//// * @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);
// }
//
//
//
// /**
// * 根据VIN 编辑管理修改车辆信息数据
// * @param entity
// * @return
// */
// @Override
// public boolean updateById(Car entity) {
// boolean updatedById = super.updateById(entity);
// if (!updatedById){
// throw new RuntimeException("修改失败");
// }
// return true;
// }
//
// /**
// * 添加车辆管理数据
// * @param entity
// * @return
// */
// @Override
// public boolean save(Car entity) {
// boolean addCar = super.save(entity);
// if (!addCar){
// throw new RuntimeException("添加车辆管理失败失败");
// }
// return true;
// }
//
// /**
// * 删除车辆信息数据
// *
// * @param id
// * @return
// */
// @Override
// public boolean removeById(Serializable id) {
// boolean remove = super.removeById(id);
// if (remove ==false) {
// log.warn("删除管理车辆数据:[/-{}-/]失败!", id);
// throw new RuntimeException("删除管理车辆数据失败");
// } else {
// return true;
// }
// }
//
// /**
// * 获取所有在线车辆
// * @return
// */
// @Override
// public Result<List<VehicleMessage>> onlineVehicle() {
// List<String> ids = carMapper.getOnlineCarIds();
// 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);
// }
//
// @Override
// 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);
// Integer onlineCount = carMapper.getOnlineCarCount();
// Integer unOnlineCount = carMapper.getUnOnlineCount();
// 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.update.UpdateWrapper;
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.TopicCar;
import com.god.base.domain.request.GetTopicReq;

View File

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

View File

@ -1,90 +1,90 @@
<?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.god.base.server.mapper.CarMapper">
<!--<?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.god.base.server.mapper.CarMapper">-->
<!-- 车辆列表-->
<!-- <select id="getList" resultType="com.god.base.server.common.domain.Car">-->
<!-- SELECT-->
<!-- t_car.car_vin_id as vin ,-->
<!-- t_car.car_type_id as 车辆类型 ,-->
<!-- t_car.fence_id as 电子围栏ID ,-->
<!-- t_car.battery_manufacturer as 电池厂商 ,-->
<!-- t_car.motor_manufacturer as 电机厂商 ,-->
<!-- t_car.motor_number as 电机编号 ,-->
<!-- t_car.battery_number as 电池编号 ,-->
<!-- t_car.status as 车辆状态-->
<!--&lt;!&ndash; 车辆列表&ndash;&gt;-->
<!--&lt;!&ndash; <select id="getList" resultType="com.god.base.server.common.domain.Car">&ndash;&gt;-->
<!--&lt;!&ndash; SELECT&ndash;&gt;-->
<!--&lt;!&ndash; t_car.car_vin_id as vin ,&ndash;&gt;-->
<!--&lt;!&ndash; t_car.car_type_id as 车辆类型 ,&ndash;&gt;-->
<!--&lt;!&ndash; t_car.fence_id as 电子围栏ID ,&ndash;&gt;-->
<!--&lt;!&ndash; t_car.battery_manufacturer as 电池厂商 ,&ndash;&gt;-->
<!--&lt;!&ndash; t_car.motor_manufacturer as 电机厂商 ,&ndash;&gt;-->
<!--&lt;!&ndash; t_car.motor_number as 电机编号 ,&ndash;&gt;-->
<!--&lt;!&ndash; t_car.battery_number as 电池编号 ,&ndash;&gt;-->
<!--&lt;!&ndash; t_car.status as 车辆状态&ndash;&gt;-->
<!-- FROM-->
<!-- t_car-->
<!-- JOIN t_fence ON t_car.fence_id = t_fence.fence_id-->
<!-- JOIN t_car_type ON t_car.car_type_id = t_car_type.id-->
<!-- where t_car.user_id = #{userId1}-->
<!--&lt;!&ndash; FROM&ndash;&gt;-->
<!--&lt;!&ndash; t_car&ndash;&gt;-->
<!--&lt;!&ndash; JOIN t_fence ON t_car.fence_id = t_fence.fence_id&ndash;&gt;-->
<!--&lt;!&ndash; JOIN t_car_type ON t_car.car_type_id = t_car_type.id&ndash;&gt;-->
<!--&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>-->
<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>
<!--车辆列表查询-->
<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 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>-->
<!--&lt;!&ndash; 根据vin查询当前对象的所有信息&ndash;&gt;-->
<!-- <select id="HuiCarSelect" resultType="com.god.base.domain.Car">-->
<!-- <include refid="selectVehicleInfoVo"/>-->
<!-- where car_vin_id = #{vinId}-->
<!-- </select>-->
<!--&lt;!&ndash; 根据电子围栏 获取电子围栏信息&ndash;&gt;-->
<!-- <select id="fenceId" resultType="com.god.base.domain.Fence">-->
<!-- 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 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>
<!-- </select>-->
<!--</mapper>-->