肖凡3.31代码提交
parent
de5ebb32e7
commit
db1b9baa1e
|
@ -32,7 +32,7 @@ public class Car {
|
||||||
/**
|
/**
|
||||||
* 车辆表ID
|
* 车辆表ID
|
||||||
*/
|
*/
|
||||||
private Integer carId;
|
private Long carId;
|
||||||
/**
|
/**
|
||||||
* 车辆表vin
|
* 车辆表vin
|
||||||
*/
|
*/
|
||||||
|
@ -40,11 +40,11 @@ public class Car {
|
||||||
/**
|
/**
|
||||||
* 车辆类型
|
* 车辆类型
|
||||||
*/
|
*/
|
||||||
private Integer carType;
|
private String carType;
|
||||||
/**
|
/**
|
||||||
* 电子围栏ID
|
* 电子围栏ID
|
||||||
*/
|
*/
|
||||||
private Integer carFenceId;
|
private String carFenceId;
|
||||||
/**
|
/**
|
||||||
* 车辆状态
|
* 车辆状态
|
||||||
*/
|
*/
|
||||||
|
@ -98,6 +98,7 @@ public class Car {
|
||||||
.carBattery(carAddReq.getCarBattery())
|
.carBattery(carAddReq.getCarBattery())
|
||||||
.carElectricalmachineyId(carAddReq.getCarElectricalmachineyId())
|
.carElectricalmachineyId(carAddReq.getCarElectricalmachineyId())
|
||||||
.carBatteryId(carAddReq.getCarBatteryId())
|
.carBatteryId(carAddReq.getCarBatteryId())
|
||||||
|
.remark(carAddReq.getRemark())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,6 +113,7 @@ public class Car {
|
||||||
.carBattery(carUpdateReq.getCarBattery())
|
.carBattery(carUpdateReq.getCarBattery())
|
||||||
.carElectricalmachineyId(carUpdateReq.getCarElectricalmachineyId())
|
.carElectricalmachineyId(carUpdateReq.getCarElectricalmachineyId())
|
||||||
.carBatteryId(carUpdateReq.getCarBatteryId())
|
.carBatteryId(carUpdateReq.getCarBatteryId())
|
||||||
|
.remark(carUpdateReq.getRemark())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,30 +23,31 @@ public class CarAddReq {
|
||||||
/**
|
/**
|
||||||
* 车俩表vin
|
* 车俩表vin
|
||||||
*/
|
*/
|
||||||
@NotEmpty
|
// @NotEmpty
|
||||||
@Length(max = 255)
|
// @Length(max = 255)
|
||||||
@Pattern(regexp = "^[0-9a-zA-Z]{17}$",message = "请输入正确的vin码")
|
// @Pattern(regexp = "^[0-9a-zA-Z]{17}$",message = "请输入正确的vin码")
|
||||||
@ApiModelProperty(value = "车辆vin码")
|
@ApiModelProperty(value = "车辆vin码")
|
||||||
private String carVin;
|
private String carVin;
|
||||||
/**
|
/**
|
||||||
* 车辆类型
|
* 车辆类型
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Min(value = 1, message = "车辆类型必须大于等于1")
|
@Length(max = 255)
|
||||||
|
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的车辆类型")
|
||||||
@ApiModelProperty(value = "车辆类型")
|
@ApiModelProperty(value = "车辆类型")
|
||||||
private Integer carType;
|
private String carType;
|
||||||
/**
|
/**
|
||||||
* 电子围栏ID
|
* 电子围栏ID
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Min(value = 1, message = "电子围栏必须大于等于1")
|
@Length(max = 255)
|
||||||
@ApiModelProperty(value = "电子围栏ID")
|
@ApiModelProperty(value = "电子围栏ID")
|
||||||
private Integer carFenceId;
|
private String carFenceId;
|
||||||
/**
|
/**
|
||||||
* 车辆状态
|
* 车辆状态
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Min(value = 1, message = "车辆状态必须大于等于1")
|
@Min(value = 0, message = "车辆状态必须大于等于0")
|
||||||
@ApiModelProperty(value = "车辆状态")
|
@ApiModelProperty(value = "车辆状态")
|
||||||
private Integer state;
|
private Integer state;
|
||||||
/**
|
/**
|
||||||
|
@ -80,4 +81,13 @@ public class CarAddReq {
|
||||||
@ApiModelProperty(value = "电池编号")
|
@ApiModelProperty(value = "电池编号")
|
||||||
private Integer carBatteryId;
|
private Integer carBatteryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@NotEmpty
|
||||||
|
@Length(max = 255)
|
||||||
|
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的备注")
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class CarRequest {
|
public class CarRequest {
|
||||||
private Integer pageNum;
|
private Integer pageNum=1;
|
||||||
private Integer pageSize;
|
private Integer pageSize=10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,34 +26,35 @@ public class CarUpdateReq {
|
||||||
* 车辆表id
|
* 车辆表id
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "车辆表id")
|
@ApiModelProperty(value = "车辆表id")
|
||||||
private Integer carId;
|
private Long carId;
|
||||||
/**
|
/**
|
||||||
* 车俩表vin
|
* 车俩表vin
|
||||||
*/
|
*/
|
||||||
@NotEmpty
|
// @NotEmpty
|
||||||
@Length(max = 255)
|
// @Length(max = 255)
|
||||||
@Pattern(regexp = "^[0-9a-zA-Z]{17}$",message = "请输入正确的vin码")
|
// @Pattern(regexp = "^[0-9a-zA-Z]{17}$",message = "请输入正确的vin码")
|
||||||
@ApiModelProperty(value = "车辆vin码")
|
@ApiModelProperty(value = "车辆vin码")
|
||||||
private String carVin;
|
private String carVin;
|
||||||
/**
|
/**
|
||||||
* 车辆类型
|
* 车辆类型
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Min(value = 1, message = "车辆类型必须大于等于1")
|
@Length(max = 255)
|
||||||
|
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的车辆类型")
|
||||||
@ApiModelProperty(value = "车辆类型")
|
@ApiModelProperty(value = "车辆类型")
|
||||||
private Integer carType;
|
private String carType;
|
||||||
/**
|
/**
|
||||||
* 电子围栏ID
|
* 电子围栏ID
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Min(value = 1, message = "电子围栏必须大于等于1")
|
@Length(max = 255)
|
||||||
@ApiModelProperty(value = "电子围栏ID")
|
@ApiModelProperty(value = "电子围栏ID")
|
||||||
private Integer carFenceId;
|
private String carFenceId;
|
||||||
/**
|
/**
|
||||||
* 车辆状态
|
* 车辆状态
|
||||||
*/
|
*/
|
||||||
@NotNull
|
@NotNull
|
||||||
@Min(value = 1, message = "车辆状态必须大于等于1")
|
@Min(value = 0, message = "车辆状态必须大于等于0")
|
||||||
@ApiModelProperty(value = "车辆状态")
|
@ApiModelProperty(value = "车辆状态")
|
||||||
private Integer state;
|
private Integer state;
|
||||||
/**
|
/**
|
||||||
|
@ -86,5 +87,13 @@ public class CarUpdateReq {
|
||||||
@Min(value = 1, message = "电池编号必须大于等于1")
|
@Min(value = 1, message = "电池编号必须大于等于1")
|
||||||
@ApiModelProperty(value = "电池编号")
|
@ApiModelProperty(value = "电池编号")
|
||||||
private Integer carBatteryId;
|
private Integer carBatteryId;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
@NotEmpty
|
||||||
|
@Length(max = 255)
|
||||||
|
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的备注")
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,62 +1,100 @@
|
||||||
package com.muyu.system.controller;
|
package com.muyu.system.controller;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||||
import com.muyu.common.core.domain.PageResult;
|
import com.muyu.common.core.domain.PageResult;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.common.core.web.controller.BaseController;
|
|
||||||
import com.muyu.common.log.annotation.Log;
|
|
||||||
import com.muyu.common.log.enums.BusinessType;
|
|
||||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
|
||||||
import com.muyu.system.common.domain.Car;
|
import com.muyu.system.common.domain.Car;
|
||||||
import com.muyu.system.common.domain.Fence;
|
import com.muyu.system.common.domain.Fence;
|
||||||
import com.muyu.system.common.domain.SysDept;
|
|
||||||
import com.muyu.system.common.domain.SysDictData;
|
|
||||||
import com.muyu.system.common.domain.req.CarAddReq;
|
import com.muyu.system.common.domain.req.CarAddReq;
|
||||||
import com.muyu.system.common.domain.req.CarUpdateReq;
|
import com.muyu.system.common.domain.req.CarUpdateReq;
|
||||||
import com.muyu.system.common.domain.vo.CarVo;
|
import com.muyu.system.common.domain.vo.CarVo;
|
||||||
import com.muyu.system.service.CarService;
|
import com.muyu.system.service.CarService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.muyu.common.log.annotation.Log;
|
||||||
|
import com.muyu.common.log.enums.BusinessType;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆管理
|
* 车辆信息Controller
|
||||||
* @ProjectName: colud-vehicles
|
*
|
||||||
* @PackageName: com.muyu.system.controller
|
* @author muyu
|
||||||
* @Description TODO
|
* @date 2024-03-29
|
||||||
* @Author XiaoFan
|
|
||||||
* @Date 2024/3/26 19:57
|
|
||||||
* @Version 1.0
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@Slf4j
|
|
||||||
@RequestMapping("/car")
|
@RequestMapping("/car")
|
||||||
public class CarController extends BaseController{
|
@Slf4j
|
||||||
|
public class CarController extends BaseController
|
||||||
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private CarService carService;
|
private CarService carService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpServletRequest request;
|
private HttpServletRequest request;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆信息列表
|
||||||
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@RequiresPermissions("system:car:list")
|
// @RequiresPermissions("system:car:list")
|
||||||
@Log(title = "车辆列表")
|
@Log(title = "车辆列表")
|
||||||
public Result<PageResult<Car>> list(@Validated CarVo carVo){
|
public Result<PageResult<Car>> list(@Validated CarVo carVo){
|
||||||
log.info("执行操作:查询车辆列表,请求URL:{},请求方法:{},请求参数:{}",request.getRequestURI(),
|
log.info("执行操作:查询车辆列表,请求URL:{},请求方法:{},请求参数:{}",request.getRequestURI(),
|
||||||
request.getMethod(), carVo);
|
request.getMethod(), carVo);
|
||||||
Result<PageResult<Car>> list=carService.list(carVo);
|
Result<PageResult<Car>> list=carService.list(carVo);
|
||||||
log.info("执行操作:查询车辆列表,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
|
log.info("执行操作:查询车辆列表,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
|
||||||
request.getMethod(),JSONObject.toJSONString(list));
|
request.getMethod(), JSONObject.toJSONString(list));
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出车辆信息列表
|
||||||
|
*/
|
||||||
|
// @RequiresPermissions("system:car:export")
|
||||||
|
@Log(title = "车辆信息", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/exportA")
|
||||||
|
public void exportA(HttpServletResponse response, Car car)
|
||||||
|
{
|
||||||
|
List<Car> list = carService.selectCarList(car);
|
||||||
|
ExcelUtil<Car> util = new ExcelUtil<>(Car.class);
|
||||||
|
util.exportExcel(response, list, "车辆信息数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取车辆信息详细信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/findById/{carId}")
|
||||||
|
// @RequiresPermissions("system:car:query")
|
||||||
|
@Log(title = "车辆管理")
|
||||||
|
public Result<Car> findById(@PathVariable Integer carId){
|
||||||
|
Car car=carService.findById(carId);
|
||||||
|
return Result.success(car);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 新增车辆信息
|
||||||
|
*/
|
||||||
@PostMapping("/add")
|
@PostMapping("/add")
|
||||||
@RequiresPermissions("system:config:add")
|
// @RequiresPermissions("system:car:add")
|
||||||
@Log(title = "车辆管理",businessType = BusinessType.INSERT)
|
@Log(title = "车辆管理",businessType = BusinessType.INSERT)
|
||||||
public Result add(@RequestBody @Validated CarAddReq carAddReq){
|
public Result add(@RequestBody @Validated CarAddReq carAddReq){
|
||||||
log.info("执行操作:添加车辆数据,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
log.info("执行操作:添加车辆数据,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
||||||
|
@ -67,8 +105,12 @@ public class CarController extends BaseController{
|
||||||
request.getMethod(),JSONObject.toJSONString(carAddReq));
|
request.getMethod(),JSONObject.toJSONString(carAddReq));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆信息
|
||||||
|
*/
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@RequiresPermissions("system:config:edit")
|
// @RequiresPermissions("system:car:edit")
|
||||||
@Log(title = "车辆管理",businessType = BusinessType.UPDATE)
|
@Log(title = "车辆管理",businessType = BusinessType.UPDATE)
|
||||||
public Result update(@RequestBody @Validated CarUpdateReq carUpdateReq){
|
public Result update(@RequestBody @Validated CarUpdateReq carUpdateReq){
|
||||||
log.info("执行操作:修改车辆数据,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
log.info("执行操作:修改车辆数据,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
||||||
|
@ -79,28 +121,15 @@ public class CarController extends BaseController{
|
||||||
request.getMethod(),JSONObject.toJSONString(result));
|
request.getMethod(),JSONObject.toJSONString(result));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@PostMapping("/del/{carId}")
|
|
||||||
@RequiresPermissions("system:config:remove")
|
/**
|
||||||
@Log(title = "车辆管理",businessType = BusinessType.DELETE)
|
* 删除车辆信息
|
||||||
public Result del(@PathVariable Integer carId){
|
*/
|
||||||
log.info("执行操作:删除,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
@PostMapping("/del/{carIds}")
|
||||||
request.getMethod(),JSONObject.toJSONString(carId));
|
// @RequiresPermissions("system:car:remove")
|
||||||
Result result=Result.success(carId);
|
@Log(title = "车辆管理", businessType = BusinessType.DELETE)
|
||||||
carService.del(carId);
|
public Result deleteBatch(@PathVariable Long[] carIds) {
|
||||||
log.info("执行操作:删除,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
|
return Result.success(carService.deleteBatch(carIds)); // 调用服务层方法,获取被删除的记录数
|
||||||
request.getMethod(),JSONObject.toJSONString(result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
@GetMapping("/findById/{carId}")
|
|
||||||
@RequiresPermissions("system:car:query")
|
|
||||||
@Log(title = "车辆管理")
|
|
||||||
public Car findById(@PathVariable Integer carId){
|
|
||||||
log.info("执行操作:根据id查询数据,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
|
||||||
request.getMethod(),JSONObject.toJSONString(carId));
|
|
||||||
Car car=carService.findById(carId);
|
|
||||||
log.info("执行操作:根据id查询数据,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
|
||||||
request.getMethod(), JSONObject.toJSONString(car));
|
|
||||||
return car;
|
|
||||||
}
|
}
|
||||||
@GetMapping("/selectFence")
|
@GetMapping("/selectFence")
|
||||||
@Log(title = "查询电子围栏表")
|
@Log(title = "查询电子围栏表")
|
||||||
|
@ -110,12 +139,5 @@ public class CarController extends BaseController{
|
||||||
List<Fence> list=carService.selectFence();
|
List<Fence> list=carService.selectFence();
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
@GetMapping("/selectState")
|
|
||||||
@Log(title = "查询字典表")
|
|
||||||
public Result<List<SysDictData>> selectState(){
|
|
||||||
log.info("执行操作:查询规则,请求URL:{},请求方式:{}",request.getRequestURI(),
|
|
||||||
request.getMethod());
|
|
||||||
List<SysDictData> list=carService.selectState();
|
|
||||||
return Result.success(list);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,31 @@
|
||||||
package com.muyu.system.mapper;
|
package com.muyu.system.mapper;
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.muyu.system.common.domain.Car;
|
import com.muyu.system.common.domain.Car;
|
||||||
import com.muyu.system.common.domain.Fence;
|
import com.muyu.system.common.domain.Fence;
|
||||||
import com.muyu.system.common.domain.SysDictData;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆管理 数据层
|
* 车辆信息Mapper接口
|
||||||
* @ProjectName: colud-vehicles
|
*
|
||||||
* @PackageName: com.muyu.system.mapper
|
* @author muyu
|
||||||
* @Description TODO
|
* @date 2024-03-29
|
||||||
* @Author XiaoFan
|
|
||||||
* @Date 2024/3/26 19:59
|
|
||||||
* @Version 1.0
|
|
||||||
*/
|
*/
|
||||||
@Mapper
|
public interface CarMapper extends BaseMapper<Car>
|
||||||
public interface CarMapper extends BaseMapper<Car> {
|
{
|
||||||
List<SysDictData> selectState();
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆信息列表
|
||||||
|
*
|
||||||
|
* @param car 车辆信息
|
||||||
|
* @return 车辆信息集合
|
||||||
|
*/
|
||||||
|
public List<Car> selectCarList(Car car);
|
||||||
|
|
||||||
|
|
||||||
List<Fence> selectFence();
|
List<Fence> selectFence();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// List<Car> list(carVo carVo);
|
|
||||||
|
|
||||||
// void add(Car car);
|
|
||||||
//
|
|
||||||
//void update(car car);
|
|
||||||
//
|
|
||||||
// void del(Integer carId);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,39 +5,43 @@ import com.muyu.common.core.domain.PageResult;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
import com.muyu.system.common.domain.Car;
|
import com.muyu.system.common.domain.Car;
|
||||||
import com.muyu.system.common.domain.Fence;
|
import com.muyu.system.common.domain.Fence;
|
||||||
import com.muyu.system.common.domain.SysDept;
|
|
||||||
import com.muyu.system.common.domain.SysDictData;
|
|
||||||
import com.muyu.system.common.domain.vo.CarVo;
|
import com.muyu.system.common.domain.vo.CarVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆管理 服务层
|
* 车辆信息Service接口
|
||||||
* @ProjectName: colud-vehicles
|
*
|
||||||
* @PackageName: com.muyu.system.service
|
* @author muyu
|
||||||
* @Description TODO
|
* @date 2024-03-29
|
||||||
* @Author XiaoFan
|
|
||||||
* @Date 2024/3/26 19:58
|
|
||||||
* @Version 1.0
|
|
||||||
*/
|
*/
|
||||||
public interface CarService extends IService<Car> {
|
public interface CarService extends IService<Car>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询车辆列表
|
||||||
|
*/
|
||||||
Result<PageResult<Car>> list(CarVo carVo);
|
Result<PageResult<Car>> list(CarVo carVo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆信息列表
|
||||||
|
*
|
||||||
|
* @param car 车辆信息
|
||||||
|
* @return 车辆信息集合
|
||||||
|
*/
|
||||||
|
public List<Car> selectCarList(Car car);
|
||||||
|
|
||||||
void add(Car car);
|
void add(Car car);
|
||||||
|
|
||||||
void update(Car car);
|
void update(Car car);
|
||||||
|
|
||||||
void del(Integer carId);
|
|
||||||
|
|
||||||
|
int deleteBatch(Long[] carIds);
|
||||||
|
|
||||||
Car findById(Integer carId);
|
Car findById(Integer carId);
|
||||||
|
|
||||||
List<SysDictData> selectState();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<Fence> selectFence();
|
List<Fence> selectFence();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,44 @@
|
||||||
package com.muyu.system.service.impl;
|
package com.muyu.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||||
|
import com.alibaba.nacos.common.utils.UuidUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.muyu.common.core.domain.PageResult;
|
import com.muyu.common.core.domain.PageResult;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.DateUtils;
|
||||||
import com.muyu.common.core.utils.StringUtils;
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
import com.muyu.common.core.utils.uuid.IdUtils;
|
import com.muyu.common.core.utils.uuid.IdUtils;
|
||||||
import com.muyu.system.common.domain.Car;
|
import com.muyu.system.common.domain.Car;
|
||||||
import com.muyu.system.common.domain.Fence;
|
import com.muyu.system.common.domain.Fence;
|
||||||
import com.muyu.system.common.domain.SysDept;
|
|
||||||
import com.muyu.system.common.domain.SysDictData;
|
|
||||||
import com.muyu.system.common.domain.vo.CarVo;
|
import com.muyu.system.common.domain.vo.CarVo;
|
||||||
import com.muyu.system.mapper.CarMapper;
|
import com.muyu.system.mapper.CarMapper;
|
||||||
import com.muyu.system.service.CarService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import com.muyu.system.service.CarService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆管理 业务层
|
* 车辆信息Service业务层处理
|
||||||
* @ProjectName: colud-vehicles
|
*
|
||||||
* @PackageName: com.muyu.system.service.impl
|
* @author muyu
|
||||||
* @Description TODO
|
* @date 2024-03-29
|
||||||
* @Author XiaoFan
|
|
||||||
* @Date 2024/3/26 19:58
|
|
||||||
* @Version 1.0
|
|
||||||
*/
|
*/
|
||||||
@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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆信息
|
||||||
|
* @param carVo
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result<PageResult<Car>> list(CarVo carVo) {
|
public Result<PageResult<Car>> list(CarVo carVo) {
|
||||||
PageHelper.startPage(carVo.getPageNum(),carVo.getPageSize());
|
PageHelper.startPage(carVo.getPageNum(),carVo.getPageSize());
|
||||||
|
@ -48,20 +52,46 @@ public class CarServiceImpl extends ServiceImpl<CarMapper,Car> implements CarSer
|
||||||
return PageResult.toResult(info.getTotal(),info.getList());
|
return PageResult.toResult(info.getTotal(),info.getList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆信息列表
|
||||||
|
*
|
||||||
|
* @param car 车辆信息
|
||||||
|
* @return 车辆信息
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void add(Car car) {
|
public List<Car> selectCarList(Car car)
|
||||||
car.setCarVin("vin"+IdUtils.fastSimpleUUID());
|
{
|
||||||
carMapper.insert(car);
|
return carMapper.selectCarList(car);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆信息
|
||||||
|
*
|
||||||
|
* @param car 车辆信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void add(Car car) {
|
||||||
|
car.setCreateTime(DateUtils.getNowDate());
|
||||||
|
car.setCarVin("vin"+ IdUtils.fastSimpleUUID());
|
||||||
|
carMapper.insert(car);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 修改车辆信息
|
||||||
|
*
|
||||||
|
* @param car 车辆信息
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void update(Car car) {
|
public void update(Car car) {
|
||||||
|
car.setUpdateTime(DateUtils.getNowDate());
|
||||||
carMapper.updateById(car);
|
carMapper.updateById(car);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void del(Integer carId) {
|
public int deleteBatch(Long[] carIds) {
|
||||||
carMapper.deleteById(carId);
|
System.out.println(Arrays.toString(carIds));
|
||||||
|
return carMapper.deleteBatchIds(Arrays.asList(carIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -69,15 +99,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper,Car> implements CarSer
|
||||||
return carMapper.selectById(carId);
|
return carMapper.selectById(carId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<SysDictData> selectState() {
|
|
||||||
return carMapper.selectState();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Fence> selectFence() {
|
public List<Fence> selectFence() {
|
||||||
return carMapper.selectFence();
|
return carMapper.selectFence();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,103 +1,21 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.muyu.system.mapper.CarMapper">
|
<mapper namespace="com.muyu.system.mapper.CarMapper">
|
||||||
|
|
||||||
<!-- <resultMap type="com.muyu.system.common.domain.Car" id="list">-->
|
<sql id="list">
|
||||||
<!-- <id property="carId" column="cat_id"></id>-->
|
select car_id,car_vin,car_type,car_fence_id,state,
|
||||||
<!-- <result property="carVin" column="car_vin"></result>-->
|
car_electricalmachiney,car_battery,
|
||||||
<!-- <result property="carType" column="car_type"></result>-->
|
car_electricalmachiney_id,car_battery_id,
|
||||||
<!-- <result property="carFenceId" column="car_fence_id"></result>-->
|
create_by,create_time,update_by,update_time,
|
||||||
<!-- <result property="carState" column="car_state"></result>-->
|
remark
|
||||||
<!-- <result property="carElectricalmachiney" column="car_electricalmachiney"></result>-->
|
from car
|
||||||
<!-- <result property="carBattery" column="car_battery"></result>-->
|
</sql>
|
||||||
<!-- <result property="carElectricalmachineyId" column="car_electricalmachiney_id"></result>-->
|
<select id="selectCarList" resultType="com.muyu.system.common.domain.Car">
|
||||||
<!-- <result property="carBatteryId" column="car_battery_id"></result>-->
|
<include refid="list"></include>
|
||||||
<!-- </resultMap>-->
|
|
||||||
|
|
||||||
<!-- <insert id="add">-->
|
|
||||||
<!-- insert into t_car(-->
|
|
||||||
<!-- <if test="carVin!=null and carVin!=''">car_vin,</if>-->
|
|
||||||
<!-- <if test="carType!=null">car_type,</if>-->
|
|
||||||
<!-- <if test="carFenceId!=null">car_fence_id,</if>-->
|
|
||||||
<!-- <if test="carState!=null">car_state,</if>-->
|
|
||||||
<!-- <if test="carElectricalmachiney!=null and carElectricalmachiney!=''">car_electricalmachiney,</if>-->
|
|
||||||
<!-- <if test="carBattery!=null and carBattery!=''">car_battery,</if>-->
|
|
||||||
<!-- <if test="carElectricalmachineyId!=null">car_electricalmachiney_id,</if>-->
|
|
||||||
<!-- <if test="carBatteryId!=null">car_battery_id</if>-->
|
|
||||||
<!-- )values (-->
|
|
||||||
<!-- <if test="carVin!=null and carVin!=''">#{carVin,jdbcType=VARCHAR},</if>-->
|
|
||||||
<!-- <if test="carType!=null">#{carType,jdbcType=BIGINT},</if>-->
|
|
||||||
<!-- <if test="carFenceId!=null">#{carFenceId,jdbcType=BIGINT},</if>-->
|
|
||||||
<!-- <if test="carState!=null">#{carState,jdbcType=BIGINT},</if>-->
|
|
||||||
<!-- <if test="carElectricalmachiney!=null and carElectricalmachiney!=''">#{carElectricalmachiney,jdbcType=VARCHAR},</if>-->
|
|
||||||
<!-- <if test="carBattery!=null and carBattery!=''">#{carBattery,jdbcType=VARCHAR},</if>-->
|
|
||||||
<!-- <if test="carElectricalmachineyId!=null">#{carElectricalmachineyId,jdbcType=BIGINT},</if>-->
|
|
||||||
<!-- <if test="carBatteryId!=null">#{carBatteryId,jdbcType=BIGINT}</if>-->
|
|
||||||
<!-- )-->
|
|
||||||
<!-- </insert>-->
|
|
||||||
<!-- <update id="update">-->
|
|
||||||
<!-- update t_car set-->
|
|
||||||
<!-- <if test="carVin!=null and carVin!=''">car_vin=#{carVin,jdbcType=VARCHAR},</if>-->
|
|
||||||
<!-- <if test="carType!=null">car_type=#{carType,jdbcType=BIGINT},</if>-->
|
|
||||||
<!-- <if test="carFenceId!=null">car_fence_id=#{carFenceId,jdbcType=BIGINT},</if>-->
|
|
||||||
<!-- <if test="carState!=null">car_state=#{carState,jdbcType=BIGINT},</if>-->
|
|
||||||
<!-- <if test="carElectricalmachiney!=null and carElectricalmachiney!=''">car_electricalmachiney=#{carElectricalmachiney,jdbcType=VARCHAR},</if>-->
|
|
||||||
<!-- <if test="carBattery!=null and carBattery!=''">car_battery=#{carBattery,jdbcType=VARCHAR},</if>-->
|
|
||||||
<!-- <if test="carElectricalmachineyId!=null">car_electricalmachiney_id=#{carElectricalmachineyId,jdbcType=BIGINT},</if>-->
|
|
||||||
<!-- <if test="carBatteryId!=null">car_battery_id=#{carBatteryId,jdbcType=BIGINT}</if>-->
|
|
||||||
<!-- where-->
|
|
||||||
<!-- <if test="carId!=null">car_id=#{carId,jdbcType=BIGINT}</if>-->
|
|
||||||
<!-- </update>-->
|
|
||||||
<!-- <delete id="del">-->
|
|
||||||
<!-- delete from t_car-->
|
|
||||||
<!-- <where>-->
|
|
||||||
<!-- <if test="carId!=null">car_id=#{carId,jdbcType=BIGINT}</if>-->
|
|
||||||
<!-- </where>-->
|
|
||||||
<!-- </delete>-->
|
|
||||||
|
|
||||||
<!-- <select id="list" parameterType="com.muyu.system.common.domain.Car" resultMap="list">-->
|
|
||||||
<!-- <include refid="list"></include>-->
|
|
||||||
<!-- <where>-->
|
|
||||||
<!-- <if test="carVin!=null and carVin!=''">-->
|
|
||||||
<!-- and car_vin like concat('%',#{carVin},'%')-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="carType!=null">-->
|
|
||||||
<!-- and car_type = #{carType}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="carFenceId!=null">-->
|
|
||||||
<!-- and car_fence_id=#{carFenceId}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="carState!=null">-->
|
|
||||||
<!-- and car_state=#{carState}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="carElectricalmachiney!=null and carElectricalmachiney!=''">-->
|
|
||||||
<!-- and car_electricalmachiney like concat('%',#{carElectricalmachiney},'%')-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="carBattery!=null and carBattery!=''">-->
|
|
||||||
<!-- and car_battery like concat('%',#{carBattery},'%')-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="carElectricalmachineyId!=null">-->
|
|
||||||
<!-- and car_electricalmachiney_id=#{carElectricalmachineyId}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- <if test="carBatteryId!=null">-->
|
|
||||||
<!-- and car_battery_id=#{carBatteryId}-->
|
|
||||||
<!-- </if>-->
|
|
||||||
<!-- </where>-->
|
|
||||||
<!-- </select>-->
|
|
||||||
|
|
||||||
<!-- <sql id="list">-->
|
|
||||||
<!-- select car_id,car_vin,car_type,car_fence_id,car_state,-->
|
|
||||||
<!-- car_electricalmachiney,car_battery,-->
|
|
||||||
<!-- car_electricalmachiney_id,car_battery_id-->
|
|
||||||
<!-- from t_car-->
|
|
||||||
<!-- </sql>-->
|
|
||||||
|
|
||||||
<select id="selectState" resultType="com.muyu.system.common.domain.SysDictData">
|
|
||||||
select dict_value,dict_label from sys_dict_data where dict_type='car_state'
|
|
||||||
</select>
|
</select>
|
||||||
<select id="selectFence" resultType="com.muyu.system.common.domain.Fence">
|
<select id="selectFence" resultType="com.muyu.system.common.domain.Fence">
|
||||||
select fence_id,fence_name from t_fence
|
select fence_id,fence_name from fence
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue