车辆上线
parent
0dc53b7794
commit
c271260efc
|
@ -0,0 +1,23 @@
|
|||
package com.dragon.car.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class Car {
|
||||
|
||||
private int id;
|
||||
private String vin;
|
||||
private String carName;
|
||||
private String carBrand;
|
||||
private int carTypeId;
|
||||
private int fenceId;
|
||||
private String carStatus;
|
||||
private boolean isDelete;
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.dragon.car.domain.req;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -13,9 +14,15 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName ("car")
|
||||
public class RequestCar {
|
||||
private String firmId;
|
||||
private String firmName;
|
||||
private String carId;
|
||||
private String id;
|
||||
private String vin;
|
||||
private String carName;
|
||||
private String carBrand;
|
||||
private String carTypeId;
|
||||
private String fenceId;
|
||||
private String carStatus;
|
||||
private String isDelete;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package com.dragon.car.service.controller;
|
||||
|
||||
import com.dragon.car.domain.req.RequestCar;
|
||||
import com.dragon.car.domain.resp.ResquestFaultCode;
|
||||
import com.dragon.car.service.service.CarManageService;
|
||||
import com.dragon.common.core.domain.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : Administrator
|
||||
* @description : 汽车管理控制层
|
||||
|
@ -22,63 +16,18 @@ public class CarController {
|
|||
@Autowired
|
||||
CarManageService carManageService;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆初始化
|
||||
*
|
||||
* @return List<CarInit> 初始化企业车辆列表
|
||||
*/
|
||||
@PostMapping ("/carInit")
|
||||
public Result<List<RequestCar>> carInit () {
|
||||
|
||||
return carManageService.carInit ();
|
||||
//传入车辆vin查看是否有
|
||||
@RequestMapping ("/carInit")
|
||||
public Result carInit (String vin) {
|
||||
return carManageService.carInit (vin);
|
||||
}
|
||||
//新增车辆
|
||||
|
||||
/**
|
||||
* 车辆添加
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping ("/carInsert")
|
||||
public Result carInsert (@RequestBody RequestCar request) {
|
||||
//修改车辆信息(文件读取)
|
||||
|
||||
return carManageService.carInsert (request);
|
||||
}
|
||||
//删除车辆
|
||||
|
||||
/**
|
||||
* 辆修改参数
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping ("/carUpdate")
|
||||
public Result carUpdate (@RequestBody RequestCar request) {
|
||||
return carManageService.carUpdate (request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆删除
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping ("/carDelect")
|
||||
public Result carDelect (@RequestBody RequestCar request) {
|
||||
return carManageService.carDelect (request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆故障码
|
||||
*/
|
||||
@PostMapping ("/faultCode")
|
||||
public Result<List<ResquestFaultCode>> faultCodeList () {
|
||||
|
||||
return carManageService.faultCodeList ();
|
||||
}
|
||||
|
||||
//查询车辆列表
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
package com.dragon.car.service.service;
|
||||
|
||||
import com.dragon.car.domain.req.RequestCar;
|
||||
import com.dragon.car.domain.resp.ResquestFaultCode;
|
||||
import com.dragon.common.core.domain.Result;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : Administrator
|
||||
* @description :
|
||||
|
@ -16,36 +12,7 @@ public interface CarManageService {
|
|||
*
|
||||
* @return List<CarInit> 企业管理的车-列表
|
||||
*/
|
||||
Result<List<RequestCar>> carInit ();
|
||||
Result carInit (String vin);
|
||||
|
||||
/**
|
||||
* 车俩添加方法
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return 是否成功 i=1 成功 i=0 失败
|
||||
*/
|
||||
Result carInsert (RequestCar request);
|
||||
|
||||
/**
|
||||
* 车辆修改方法
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return 是否成功 i=1 成功 i=0 失败
|
||||
*/
|
||||
Result carUpdate (RequestCar request);
|
||||
|
||||
|
||||
/**
|
||||
* 车辆删除
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return 是否成功 i=1 成功 i=0 失败
|
||||
*/
|
||||
Result carDelect (RequestCar request);
|
||||
|
||||
Result<List<ResquestFaultCode>> faultCodeList ();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.dragon.car.service.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.dragon.car.domain.req.RequestCar;
|
||||
import com.dragon.car.domain.resp.ResquestFaultCode;
|
||||
import com.dragon.car.service.mapper.CarManageMapper;
|
||||
import com.dragon.car.service.service.CarManageService;
|
||||
import com.dragon.common.core.domain.Result;
|
||||
|
@ -11,7 +9,6 @@ import lombok.extern.log4j.Log4j2;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : Administrator
|
||||
|
@ -31,65 +28,19 @@ public class CarManageServiceImpl implements CarManageService {
|
|||
* @return List<CarInit> 企业管理的车-列表
|
||||
*/
|
||||
@Override
|
||||
public Result<List<RequestCar>> carInit () {
|
||||
LambdaQueryWrapper<RequestCar> aclqw = new LambdaQueryWrapper<> ();
|
||||
|
||||
List<RequestCar> carInits = carMapper.selectList (aclqw);
|
||||
|
||||
log.info ("信息是:{}", carInits.stream ().toArray ());
|
||||
return Result.success (carInits);
|
||||
public Result carInit (String vin) {
|
||||
// 用车辆的vin查询是否有该车辆,车辆的vin字段和String vin是一致的
|
||||
int i = 0;
|
||||
RequestCar car = carMapper.selectOne (new QueryWrapper<RequestCar> ().eq ("vin", vin));
|
||||
if (car != null) {
|
||||
// 当查询到有该车辆时,修改字段car_status的值为'1'
|
||||
car.setCarStatus ("1");
|
||||
i = carMapper.updateById (car);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车俩添加方法
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return 是否成功 i=1 成功 i=0 失败
|
||||
*/
|
||||
@Override
|
||||
public Result carInsert (RequestCar request) {
|
||||
|
||||
|
||||
int i = carMapper.insert (request);
|
||||
|
||||
return Result.success (i > 0 ? "成功" : "失败");
|
||||
else {
|
||||
return Result.error ("没有这车");
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆修改方法
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return 是否成功 i=1 成功 i=0 失败
|
||||
*/
|
||||
@Override
|
||||
public Result carUpdate (RequestCar request) {
|
||||
LambdaUpdateWrapper luw = new LambdaUpdateWrapper ();
|
||||
int i = carMapper.update (request, luw);
|
||||
return Result.success (i > 0 ? "成功" : "失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 车辆删除
|
||||
*
|
||||
* @param request
|
||||
*
|
||||
* @return 是否成功 i=1 成功 i=0 失败
|
||||
*/
|
||||
@Override
|
||||
public Result carDelect (RequestCar request) {
|
||||
int i = carMapper.deleteById (request.getCarId ());
|
||||
|
||||
return Result.success (i > 0 ? "成功" : "失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<List<ResquestFaultCode>> faultCodeList () {
|
||||
return null;
|
||||
return Result.success (i > 0 ? "车辆上线" : "上线失败");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue