Merge remote-tracking branch 'origin/xiaofan'
# Conflicts: # muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/EnterpriseInfoMapper.xml # muyu-modules/muyu-system/muyu-system-server/src/main/resources/mapper/system/SysDeptMapper.xmlvehicle-yinyuyang
commit
5a4aad808c
|
@ -105,6 +105,22 @@
|
|||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<!-- mybatis - plus 依赖 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.3.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.github.jsqlparser</groupId>
|
||||
<artifactId>jsqlparser</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- excel工具 -->
|
||||
<dependency>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.common.core.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 列表返回结果集
|
||||
* @author XiaoFan
|
||||
* @description: 列表返回结果集
|
||||
*/
|
||||
@Data
|
||||
public class PageResult<T> implements Serializable {
|
||||
/**
|
||||
* 总条数
|
||||
*/
|
||||
private long total;
|
||||
/**
|
||||
* 结果集合
|
||||
*/
|
||||
private List<T> list;
|
||||
public PageResult() {
|
||||
}
|
||||
public PageResult(long total, List<T> list) {
|
||||
this.total = total;
|
||||
this.list = list;
|
||||
}
|
||||
public static <T> PageResult<T> toPageResult(long total, List<T> list){
|
||||
return new PageResult(total , list);
|
||||
}
|
||||
public static <T> Result<PageResult<T>> toResult(long total, List<T> list){
|
||||
return Result.success(PageResult.toPageResult(total,list));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
package com.muyu.system.common.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.system.common.domain.req.CarAddReq;
|
||||
import com.muyu.system.common.domain.req.CarUpdateReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车辆管理表 car
|
||||
* @ProjectName: colud-vehicles
|
||||
* @PackageName: com.muyu.system.common.domain
|
||||
* @Description TODO
|
||||
* @Author XiaoFan
|
||||
* @Date 2024/3/28 21:49
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("car")
|
||||
public class Car {
|
||||
@TableId(value = "car_id",type = IdType.AUTO)
|
||||
/**
|
||||
* 车辆表ID
|
||||
*/
|
||||
private Long carId;
|
||||
/**
|
||||
* 车辆表vin
|
||||
*/
|
||||
private String carVin;
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
private String carType;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
*/
|
||||
private String carFenceId;
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
private Integer state;
|
||||
/**
|
||||
* 电机厂商
|
||||
*/
|
||||
private String carElectricalmachiney;
|
||||
/**
|
||||
* 电池厂商
|
||||
*/
|
||||
private String carBattery;
|
||||
/**
|
||||
* 电机编号
|
||||
*/
|
||||
private Integer carElectricalmachineyId;
|
||||
/**
|
||||
* 电池厂商
|
||||
*/
|
||||
private Integer carBatteryId;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
public static Car addReqBuild(CarAddReq carAddReq){
|
||||
return Car.builder()
|
||||
.carVin(carAddReq.getCarVin())
|
||||
.carType(carAddReq.getCarType())
|
||||
.carFenceId(carAddReq.getCarFenceId())
|
||||
.state(carAddReq.getState())
|
||||
.carElectricalmachiney(carAddReq.getCarElectricalmachiney())
|
||||
.carBattery(carAddReq.getCarBattery())
|
||||
.carElectricalmachineyId(carAddReq.getCarElectricalmachineyId())
|
||||
.carBatteryId(carAddReq.getCarBatteryId())
|
||||
.remark(carAddReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
public static Car updateReqBuild(CarUpdateReq carUpdateReq){
|
||||
return Car.builder()
|
||||
.carId(carUpdateReq.getCarId())
|
||||
.carVin(carUpdateReq.getCarVin())
|
||||
.carType(carUpdateReq.getCarType())
|
||||
.carFenceId(carUpdateReq.getCarFenceId())
|
||||
.state(carUpdateReq.getState())
|
||||
.carElectricalmachiney(carUpdateReq.getCarElectricalmachiney())
|
||||
.carBattery(carUpdateReq.getCarBattery())
|
||||
.carElectricalmachineyId(carUpdateReq.getCarElectricalmachineyId())
|
||||
.carBatteryId(carUpdateReq.getCarBatteryId())
|
||||
.remark(carUpdateReq.getRemark())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package com.muyu.system.common.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 车辆上线记录 car_info
|
||||
* @ProjectName: colud-vehicles
|
||||
* @PackageName: com.muyu.system.common.domain
|
||||
* @Description TODO
|
||||
* @Author XiaoFan
|
||||
* @Date 2024/3/26 19:46
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CarInfo extends BaseEntity{
|
||||
/**
|
||||
* 日志表ID
|
||||
*/
|
||||
private Integer logId;
|
||||
/**
|
||||
* 车辆表vin
|
||||
*/
|
||||
private String carVin;
|
||||
/**
|
||||
* 上线时间
|
||||
*/
|
||||
private Date logDate;
|
||||
/**
|
||||
* 创建者
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新者
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.muyu.system.common.domain;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 电子围栏实体类 Fence
|
||||
* @ClassName Fence
|
||||
* @Description 电子围栏实体类
|
||||
* @Author YinYuYang
|
||||
* @Date 2024/3/26 20:48
|
||||
* Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("fence_info")
|
||||
public class Fence{
|
||||
|
||||
/**
|
||||
* 围栏ID
|
||||
*/
|
||||
@TableId(value = "fence_id", type = IdType.AUTO)
|
||||
private Integer fenceId;
|
||||
|
||||
/**
|
||||
* 围栏编码
|
||||
*/
|
||||
@TableField("fence_encoding")
|
||||
private String fenceEncoding;
|
||||
|
||||
/**
|
||||
* 围栏名称
|
||||
*/
|
||||
@TableField("fence_name")
|
||||
private String fenceName;
|
||||
|
||||
/**
|
||||
* 围栏类型
|
||||
*/
|
||||
@TableField("fence_type")
|
||||
private Integer fenceType;
|
||||
|
||||
/**
|
||||
* 围栏状态
|
||||
*/
|
||||
@TableField("fence_state")
|
||||
private Integer fenceState;
|
||||
|
||||
/**
|
||||
* 经纬度信息
|
||||
*/
|
||||
@TableField("fence_radius")
|
||||
private String fenceRadius;
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
package com.muyu.system.common.domain.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 车辆表添加
|
||||
* @ProjectName: cloud-vehicles
|
||||
* @PackageName: com.muyu.system.common.domain.req
|
||||
* @Description TODO
|
||||
* @Author XiaoFan
|
||||
* @Date 2024/3/29 19:04
|
||||
* @Version 1.0
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "请求参数")
|
||||
public class CarAddReq {
|
||||
/**
|
||||
* 车俩表vin
|
||||
*/
|
||||
// @NotEmpty
|
||||
// @Length(max = 255)
|
||||
// @Pattern(regexp = "^[0-9a-zA-Z]{17}$",message = "请输入正确的vin码")
|
||||
@ApiModelProperty(value = "车辆vin码")
|
||||
private String carVin;
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
@NotNull
|
||||
@Length(max = 255)
|
||||
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的车辆类型")
|
||||
@ApiModelProperty(value = "车辆类型")
|
||||
private String carType;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
*/
|
||||
@NotNull
|
||||
@Length(max = 255)
|
||||
@ApiModelProperty(value = "电子围栏ID")
|
||||
private String carFenceId;
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
@NotNull
|
||||
@Min(value = 0, message = "车辆状态必须大于等于0")
|
||||
@ApiModelProperty(value = "车辆状态")
|
||||
private Integer state;
|
||||
/**
|
||||
* 电机厂商
|
||||
*/
|
||||
@NotEmpty
|
||||
@Length(max = 255)
|
||||
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的电机厂商")
|
||||
@ApiModelProperty(value = "电机厂商")
|
||||
private String carElectricalmachiney;
|
||||
/**
|
||||
* 电池厂商
|
||||
*/
|
||||
@NotEmpty
|
||||
@Length(max = 255)
|
||||
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的电池厂商")
|
||||
@ApiModelProperty(value = "电池厂商")
|
||||
private String carBattery;
|
||||
/**
|
||||
* 电机编号
|
||||
*/
|
||||
@NotNull
|
||||
@Min(value = 1, message = "电机编号必须大于等于1")
|
||||
@ApiModelProperty(value = "电机编号")
|
||||
private Integer carElectricalmachineyId;
|
||||
/**
|
||||
* 电池编号
|
||||
*/
|
||||
@NotNull
|
||||
@Min(value = 1, message = "电池编号必须大于等于1")
|
||||
@ApiModelProperty(value = "电池编号")
|
||||
private Integer carBatteryId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotEmpty
|
||||
@Length(max = 255)
|
||||
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.muyu.system.common.domain.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 列表分页参数
|
||||
* @ProjectName: cloud-vehicles
|
||||
* @PackageName: com.muyu.system.common.domain.req
|
||||
* @Description TODO
|
||||
* @Author XiaoFan
|
||||
* @Date 2024/3/29 19:03
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
public class CarRequest {
|
||||
private Integer pageNum=1;
|
||||
private Integer pageSize=10;
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.muyu.system.common.domain.req;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* 车辆表修改
|
||||
* @ProjectName: cloud-vehicles
|
||||
* @PackageName: com.muyu.system.common.domain.req
|
||||
* @Description TODO
|
||||
* @Author XiaoFan
|
||||
* @Date 2024/3/29 19:05
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "请求参数")
|
||||
public class CarUpdateReq {
|
||||
/**
|
||||
* 车辆表id
|
||||
*/
|
||||
@ApiModelProperty(value = "车辆表id")
|
||||
private Long carId;
|
||||
/**
|
||||
* 车俩表vin
|
||||
*/
|
||||
// @NotEmpty
|
||||
// @Length(max = 255)
|
||||
// @Pattern(regexp = "^[0-9a-zA-Z]{17}$",message = "请输入正确的vin码")
|
||||
@ApiModelProperty(value = "车辆vin码")
|
||||
private String carVin;
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
@NotNull
|
||||
@Length(max = 255)
|
||||
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的车辆类型")
|
||||
@ApiModelProperty(value = "车辆类型")
|
||||
private String carType;
|
||||
/**
|
||||
* 电子围栏ID
|
||||
*/
|
||||
@NotNull
|
||||
@Length(max = 255)
|
||||
@ApiModelProperty(value = "电子围栏ID")
|
||||
private String carFenceId;
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
@NotNull
|
||||
@Min(value = 0, message = "车辆状态必须大于等于0")
|
||||
@ApiModelProperty(value = "车辆状态")
|
||||
private Integer state;
|
||||
/**
|
||||
* 电机厂商
|
||||
*/
|
||||
@NotEmpty
|
||||
@Length(max = 255)
|
||||
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的电机厂商")
|
||||
@ApiModelProperty(value = "电机厂商")
|
||||
private String carElectricalmachiney;
|
||||
/**
|
||||
* 电池厂商
|
||||
*/
|
||||
@NotEmpty
|
||||
@Length(max = 255)
|
||||
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的电池厂商")
|
||||
@ApiModelProperty(value = "电池厂商")
|
||||
private String carBattery;
|
||||
/**
|
||||
* 电机编号
|
||||
*/
|
||||
@NotNull
|
||||
@Min(value = 1, message = "电机编号必须大于等于1")
|
||||
@ApiModelProperty(value = "电机编号")
|
||||
private Integer carElectricalmachineyId;
|
||||
/**
|
||||
* 电池编号
|
||||
*/
|
||||
@NotNull
|
||||
@Min(value = 1, message = "电池编号必须大于等于1")
|
||||
@ApiModelProperty(value = "电池编号")
|
||||
private Integer carBatteryId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotEmpty
|
||||
@Length(max = 255)
|
||||
@Pattern(regexp = "^[\\u4e00-\\u9fa5]{1,20}$",message = "请输入正确的备注")
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.muyu.system.common.domain.vo;
|
||||
|
||||
import com.muyu.system.common.domain.req.CarRequest;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 列表条件查询参数
|
||||
* @ProjectName: cloud-vehicles
|
||||
* @PackageName: com.muyu.system.common.domain.vo
|
||||
* @Description TODO
|
||||
* @Author XiaoFan
|
||||
* @Date 2024/3/29 19:03
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "请求参数")
|
||||
public class CarVo extends CarRequest {
|
||||
@ApiModelProperty(value = "车辆vin码")
|
||||
private String carVin;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -22,6 +22,12 @@
|
|||
<groupId>com.muyu</groupId>
|
||||
<artifactId>muyu-system-common</artifactId>
|
||||
</dependency>
|
||||
<!-- 引入swagger-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
<version>3.0.0</version>
|
||||
</dependency>
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.system;
|
|||
import com.muyu.common.security.annotation.EnableCustomConfig;
|
||||
import com.muyu.common.security.annotation.EnableRyFeignClients;
|
||||
import com.muyu.common.swagger.annotation.EnableCustomSwagger2;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
|
@ -15,6 +16,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
@EnableCustomSwagger2
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication
|
||||
@MapperScan("com.muyu.system.mapper")
|
||||
public class MuYuSystemApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
package com.muyu.system.controller;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.muyu.common.core.domain.PageResult;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.system.common.domain.Car;
|
||||
import com.muyu.system.common.domain.Fence;
|
||||
import com.muyu.system.common.domain.req.CarAddReq;
|
||||
import com.muyu.system.common.domain.req.CarUpdateReq;
|
||||
import com.muyu.system.common.domain.vo.CarVo;
|
||||
import com.muyu.system.service.CarService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
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.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车辆信息Controller
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/car")
|
||||
@Slf4j
|
||||
public class CarController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private CarService carService;
|
||||
@Autowired
|
||||
private HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* 查询车辆信息列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
// @RequiresPermissions("system:car:list")
|
||||
@Log(title = "车辆列表")
|
||||
public Result<PageResult<Car>> list(@Validated CarVo carVo){
|
||||
log.info("执行操作:查询车辆列表,请求URL:{},请求方法:{},请求参数:{}",request.getRequestURI(),
|
||||
request.getMethod(), carVo);
|
||||
Result<PageResult<Car>> list=carService.list(carVo);
|
||||
log.info("执行操作:查询车辆列表,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
|
||||
request.getMethod(), JSONObject.toJSONString(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")
|
||||
// @RequiresPermissions("system:car:add")
|
||||
@Log(title = "车辆管理",businessType = BusinessType.INSERT)
|
||||
public Result add(@RequestBody @Validated CarAddReq carAddReq){
|
||||
log.info("执行操作:添加车辆数据,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
||||
request.getMethod(),JSONObject.toJSONString(carAddReq));
|
||||
Result result=Result.success(carAddReq);
|
||||
carService.add(Car.addReqBuild(carAddReq));
|
||||
log.info("执行操作:添加车辆数据,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
|
||||
request.getMethod(),JSONObject.toJSONString(carAddReq));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆信息
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
// @RequiresPermissions("system:car:edit")
|
||||
@Log(title = "车辆管理",businessType = BusinessType.UPDATE)
|
||||
public Result update(@RequestBody @Validated CarUpdateReq carUpdateReq){
|
||||
log.info("执行操作:修改车辆数据,请求URL:{},请求方式:{},请求参数:{}",request.getRequestURI(),
|
||||
request.getMethod(),JSONObject.toJSONString(carUpdateReq));
|
||||
Result result=Result.success(carUpdateReq);
|
||||
carService.update(Car.updateReqBuild(carUpdateReq));
|
||||
log.info("执行操作:修改车辆数据,请求URL:{},请求方式:{},响应结果:{}",request.getRequestURI(),
|
||||
request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除车辆信息
|
||||
*/
|
||||
@PostMapping("/del/{carIds}")
|
||||
// @RequiresPermissions("system:car:remove")
|
||||
@Log(title = "车辆管理", businessType = BusinessType.DELETE)
|
||||
public Result deleteBatch(@PathVariable Long[] carIds) {
|
||||
return Result.success(carService.deleteBatch(carIds)); // 调用服务层方法,获取被删除的记录数
|
||||
}
|
||||
@GetMapping("/selectFence")
|
||||
@Log(title = "查询电子围栏表")
|
||||
public Result<List<Fence>> selectFence(){
|
||||
log.info("执行操作:根据id查询电子围栏表,请求URL:{},请求方式:{}",request.getRequestURI(),
|
||||
request.getMethod());
|
||||
List<Fence> list=carService.selectFence();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.system.common.domain.Car;
|
||||
import com.muyu.system.common.domain.Fence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆信息Mapper接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
public interface CarMapper extends BaseMapper<Car>
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆信息列表
|
||||
*
|
||||
* @param car 车辆信息
|
||||
* @return 车辆信息集合
|
||||
*/
|
||||
public List<Car> selectCarList(Car car);
|
||||
|
||||
|
||||
List<Fence> selectFence();
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.domain.PageResult;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.system.common.domain.Car;
|
||||
import com.muyu.system.common.domain.Fence;
|
||||
import com.muyu.system.common.domain.vo.CarVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 车辆信息Service接口
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
public interface CarService extends IService<Car>
|
||||
{
|
||||
/**
|
||||
* 查询车辆列表
|
||||
*/
|
||||
Result<PageResult<Car>> list(CarVo carVo);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆信息列表
|
||||
*
|
||||
* @param car 车辆信息
|
||||
* @return 车辆信息集合
|
||||
*/
|
||||
public List<Car> selectCarList(Car car);
|
||||
|
||||
void add(Car car);
|
||||
|
||||
void update(Car car);
|
||||
|
||||
|
||||
int deleteBatch(Long[] carIds);
|
||||
|
||||
Car findById(Integer carId);
|
||||
|
||||
List<Fence> selectFence();
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
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.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.muyu.common.core.domain.PageResult;
|
||||
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.uuid.IdUtils;
|
||||
import com.muyu.system.common.domain.Car;
|
||||
import com.muyu.system.common.domain.Fence;
|
||||
import com.muyu.system.common.domain.vo.CarVo;
|
||||
import com.muyu.system.mapper.CarMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.muyu.system.service.CarService;
|
||||
|
||||
/**
|
||||
* 车辆信息Service业务层处理
|
||||
*
|
||||
* @author muyu
|
||||
* @date 2024-03-29
|
||||
*/
|
||||
@Service
|
||||
public class CarServiceImpl extends ServiceImpl<CarMapper,Car> implements CarService
|
||||
{
|
||||
@Autowired
|
||||
private CarMapper carMapper;
|
||||
|
||||
/**
|
||||
* 查询车辆信息
|
||||
* @param carVo
|
||||
*/
|
||||
@Override
|
||||
public Result<PageResult<Car>> list(CarVo carVo) {
|
||||
PageHelper.startPage(carVo.getPageNum(),carVo.getPageSize());
|
||||
LambdaQueryWrapper<Car> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
//判断一个字符串是否为空字符串
|
||||
if (StringUtils.isNotEmpty(carVo.getCarVin())){
|
||||
lambdaQueryWrapper.like(Car::getCarVin,carVo.getCarVin());
|
||||
}
|
||||
List<Car> list=this.list(lambdaQueryWrapper);
|
||||
PageInfo<Car> info = new PageInfo<>(list);
|
||||
return PageResult.toResult(info.getTotal(),info.getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询车辆信息列表
|
||||
*
|
||||
* @param car 车辆信息
|
||||
* @return 车辆信息
|
||||
*/
|
||||
@Override
|
||||
public List<Car> selectCarList(Car 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
|
||||
public void update(Car car) {
|
||||
car.setUpdateTime(DateUtils.getNowDate());
|
||||
carMapper.updateById(car);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBatch(Long[] carIds) {
|
||||
System.out.println(Arrays.toString(carIds));
|
||||
return carMapper.deleteBatchIds(Arrays.asList(carIds));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Car findById(Integer carId) {
|
||||
return carMapper.selectById(carId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Fence> selectFence() {
|
||||
return carMapper.selectFence();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?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.muyu.system.mapper.CarMapper">
|
||||
|
||||
<sql id="list">
|
||||
select car_id,car_vin,car_type,car_fence_id,state,
|
||||
car_electricalmachiney,car_battery,
|
||||
car_electricalmachiney_id,car_battery_id,
|
||||
create_by,create_time,update_by,update_time,
|
||||
remark
|
||||
from car
|
||||
</sql>
|
||||
<select id="selectCarList" resultType="com.muyu.system.common.domain.Car">
|
||||
<include refid="list"></include>
|
||||
</select>
|
||||
<select id="selectFence" resultType="com.muyu.system.common.domain.Fence">
|
||||
select fence_id,fence_name from fence
|
||||
</select>
|
||||
</mapper>
|
|
@ -2,36 +2,39 @@
|
|||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.system.mapper.EnterpriseInfoMapper">
|
||||
<mapper namespace="com.muyu.business.mapper.EnterpriseInfoMapper">
|
||||
|
||||
<resultMap type="EnterpriseInfo" id="EnterpriseInfoResult">
|
||||
<resultMap type="com.muyu.business.domain.EnterpriseInfo" id="EnterpriseInfoResult">
|
||||
<result property="enterpriseId" column="enterprise_id" />
|
||||
<result property="enterpriseName" column="enterprise_name" />
|
||||
<result property="email" column="email" />
|
||||
<result property="contactPerson" column="contact_person" />
|
||||
<result property="contactEmail" column="contact_email" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="enterpriseAddress" column="enterprise_address" />
|
||||
<result property="phoneNumber" column="phone_number" />
|
||||
<result property="industry" column="industry" />
|
||||
<result property="employeeCount" column="employee_count" />
|
||||
<result property="status" column="status" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="leader" column="leader" />
|
||||
<result property="identifier" column="identifier" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEnterpriseInfoVo">
|
||||
select enterprise_id, enterprise_name, email, enterprise_address, phone_number, industry, status, dept_id, update_time, create_time, del_flag, leader from enterprise_info
|
||||
select enterprise_id, enterprise_name, contact_person, contact_email, user_id, enterprise_address, phone_number, industry, employee_count, status, identifier from enterprise_info
|
||||
</sql>
|
||||
|
||||
<select id="selectEnterpriseInfoList" parameterType="EnterpriseInfo" resultMap="EnterpriseInfoResult">
|
||||
<select id="selectEnterpriseInfoList" parameterType="com.muyu.business.domain.EnterpriseInfo" resultMap="EnterpriseInfoResult">
|
||||
<include refid="selectEnterpriseInfoVo"/>
|
||||
<where>
|
||||
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
|
||||
<if test="contactPerson != null and contactPerson != ''"> and contact_person = #{contactPerson}</if>
|
||||
<if test="contactEmail != null and contactEmail != ''"> and contact_email = #{contactEmail}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="enterpriseAddress != null and enterpriseAddress != ''"> and enterprise_address = #{enterpriseAddress}</if>
|
||||
<if test="phoneNumber != null and phoneNumber != ''"> and phone_number = #{phoneNumber}</if>
|
||||
<if test="industry != null and industry != ''"> and industry = #{industry}</if>
|
||||
<if test="employeeCount != null "> and employee_count = #{employeeCount}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if>
|
||||
<if test="leader != null and leader != ''"> and leader = #{leader}</if>
|
||||
<if test="identifier != null and identifier != ''"> and identifier = #{identifier}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
@ -40,57 +43,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where enterprise_id = #{enterpriseId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectList1" resultType="com.muyu.system.common.domain.SysDept">
|
||||
select a.* from sys_dept a INNER join enterprise_info b on a.enterprise_id=b.enterprise_id
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<insert id="insertEnterpriseInfo" parameterType="EnterpriseInfo" useGeneratedKeys="true" keyProperty="enterpriseId">
|
||||
<insert id="insertEnterpriseInfo" parameterType="com.muyu.business.domain.EnterpriseInfo" useGeneratedKeys="true" keyProperty="enterpriseId">
|
||||
insert into enterprise_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="enterpriseName != null">enterprise_name,</if>
|
||||
<if test="email != null">email,</if>
|
||||
<if test="contactPerson != null">contact_person,</if>
|
||||
<if test="contactEmail != null">contact_email,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="enterpriseAddress != null">enterprise_address,</if>
|
||||
<if test="phoneNumber != null">phone_number,</if>
|
||||
<if test="industry != null">industry,</if>
|
||||
<if test="employeeCount != null">employee_count,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="leader != null">leader,</if>
|
||||
<if test="identifier != null">identifier,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="enterpriseName != null">#{enterpriseName},</if>
|
||||
<if test="email != null">#{email},</if>
|
||||
<if test="contactPerson != null">#{contactPerson},</if>
|
||||
<if test="contactEmail != null">#{contactEmail},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="enterpriseAddress != null">#{enterpriseAddress},</if>
|
||||
<if test="phoneNumber != null">#{phoneNumber},</if>
|
||||
<if test="industry != null">#{industry},</if>
|
||||
<if test="employeeCount != null">#{employeeCount},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="leader != null">#{leader},</if>
|
||||
<if test="identifier != null">#{identifier},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEnterpriseInfo" parameterType="EnterpriseInfo">
|
||||
<update id="updateEnterpriseInfo" parameterType="com.muyu.business.domain.EnterpriseInfo">
|
||||
update enterprise_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="enterpriseName != null">enterprise_name = #{enterpriseName},</if>
|
||||
<if test="email != null">email = #{email},</if>
|
||||
<if test="contactPerson != null">contact_person = #{contactPerson},</if>
|
||||
<if test="contactEmail != null">contact_email = #{contactEmail},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="enterpriseAddress != null">enterprise_address = #{enterpriseAddress},</if>
|
||||
<if test="phoneNumber != null">phone_number = #{phoneNumber},</if>
|
||||
<if test="industry != null">industry = #{industry},</if>
|
||||
<if test="employeeCount != null">employee_count = #{employeeCount},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="leader != null">leader = #{leader},</if>
|
||||
<if test="identifier != null">identifier = #{identifier},</if>
|
||||
</trim>
|
||||
where enterprise_id = #{enterpriseId}
|
||||
</update>
|
||||
|
|
Loading…
Reference in New Issue