代码优化
parent
38485e0fda
commit
e931b2e6c0
|
@ -37,10 +37,6 @@ public class Car extends BaseEntity {
|
|||
@TableField("car_license")
|
||||
private String carLicense;
|
||||
|
||||
@ApiModelProperty("车辆状态")
|
||||
@TableField("driving_id")
|
||||
private Integer drivingId;
|
||||
|
||||
@ApiModelProperty("车辆类型")
|
||||
@TableField("type_id")
|
||||
private Integer typeId;
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
package com.shiyi.internet.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fate.common.core.web.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -28,7 +24,7 @@ import java.util.Date;
|
|||
public class DrivingRecord extends BaseEntity {
|
||||
|
||||
@ApiModelProperty("行驶记录ID")
|
||||
@TableId(value = "record_id",type = IdType.AUTO)
|
||||
@TableId("record_id")
|
||||
private Integer recordId ;
|
||||
|
||||
@ApiModelProperty(name = "车辆vin")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.shiyi.internet.response;
|
||||
package com.shiyi.internet.domain.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
|
@ -8,6 +8,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -24,59 +25,60 @@ import java.util.Date;
|
|||
@NoArgsConstructor
|
||||
public class ResponseCar {
|
||||
/** 车辆ID */
|
||||
@ApiModelProperty(name = "车辆ID",notes = "")
|
||||
@ApiModelProperty(name = "车辆ID")
|
||||
@TableField("car_id")
|
||||
private Integer carId ;
|
||||
/** 车辆名称 */
|
||||
@ApiModelProperty(name = "车辆名称",notes = "")
|
||||
@ApiModelProperty(name = "车辆名称")
|
||||
@TableField("car_name")
|
||||
private String carName ;
|
||||
/** 车辆牌号 */
|
||||
@ApiModelProperty(name = "车辆牌号",notes = "")
|
||||
@ApiModelProperty(name = "车辆牌号")
|
||||
@TableField("car_license")
|
||||
private String carLicense ;
|
||||
/** 状态ID */
|
||||
@ApiModelProperty(name = "状态ID",notes = "")
|
||||
private Integer drivingId ;
|
||||
/** 车辆vin */
|
||||
@ApiModelProperty(name = "车辆vin",notes = "")
|
||||
@ApiModelProperty(name = "车辆vin")
|
||||
@TableField("driving_vin")
|
||||
private String drivingVin ;
|
||||
/** 上线时间 */
|
||||
@ApiModelProperty(name = "上线时间",notes = "")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date drivingStarttime ;
|
||||
/** 下线时间 */
|
||||
@ApiModelProperty(name = "下线时间",notes = "")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date drivingEndtime ;
|
||||
/** 车辆类型 */
|
||||
@ApiModelProperty(name = "车辆类型",notes = "")
|
||||
@ApiModelProperty(name = "车辆类型")
|
||||
@TableField("type_id")
|
||||
private Integer typeId ;
|
||||
/** 车辆围栏 */
|
||||
@ApiModelProperty(name = "车辆围栏",notes = "")
|
||||
@ApiModelProperty(name = "车辆围栏")
|
||||
@TableField("fence_id")
|
||||
private Integer fenceId ;
|
||||
/** 围栏名称 */
|
||||
@ApiModelProperty(name = "围栏名称",notes = "")
|
||||
@ApiModelProperty(name = "围栏名称")
|
||||
@TableField("fencing_name")
|
||||
private String fencingName ;
|
||||
/** 围栏经纬度 */
|
||||
@ApiModelProperty(name = "围栏经纬度",notes = "")
|
||||
@ApiModelProperty(name = "围栏经纬度")
|
||||
@TableField("fencing_lat")
|
||||
private String fencingLat ;
|
||||
/** 激活状态 */
|
||||
@ApiModelProperty(name = "激活状态",notes = "")
|
||||
@ApiModelProperty(name = "激活状态(驶入/驶出)")
|
||||
@TableField("fencing_status")
|
||||
private Integer fencingStatus ;
|
||||
/** 车辆零件ID */
|
||||
@ApiModelProperty(name = "车辆零件ID",notes = "")
|
||||
@ApiModelProperty(name = "车辆零件ID")
|
||||
@TableField("drive_id")
|
||||
private Integer driveId ;
|
||||
/** 配件型号 */
|
||||
@ApiModelProperty(name = "配件型号",notes = "")
|
||||
@ApiModelProperty(name = "配件型号")
|
||||
@TableField("drive_name")
|
||||
private String driveName ;
|
||||
/** 配件编号 */
|
||||
@ApiModelProperty(name = "配件编号",notes = "")
|
||||
@ApiModelProperty(name = "配件编号")
|
||||
@TableField("drive_part_number")
|
||||
private String drivePartNumber ;
|
||||
/** 生产厂商名称 */
|
||||
@ApiModelProperty(name = "生产厂商名称",notes = "")
|
||||
@ApiModelProperty(name = "生产厂商名称")
|
||||
@TableField("drive_generate_name")
|
||||
private String driveGenerateName ;
|
||||
|
||||
@ApiModelProperty("电池ID")
|
||||
@TableId(value = "battery_id", type = IdType.AUTO)
|
||||
@TableField("battery_id")
|
||||
private Integer batteryId;
|
||||
|
||||
@ApiModelProperty("电池编号")
|
||||
|
@ -104,6 +106,7 @@ public class ResponseCar {
|
|||
private Date batteryDeliveryTime;
|
||||
|
||||
/** 车辆位置 */
|
||||
@ApiModelProperty(name = "车辆位置",notes = "")
|
||||
@ApiModelProperty(name = "车辆位置")
|
||||
@TableField("car_address")
|
||||
private String carAddress ;
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.shiyi.internet.domain.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName : RequestFencing
|
||||
* @Description : 电子围栏响应实体类
|
||||
* @Author : YHY
|
||||
* @Date: 2023-11-18 13:17
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResponseFencing {
|
||||
@ApiModelProperty(name = "电子围栏ID")
|
||||
@TableField("fencing_id")
|
||||
private Integer fencingId ;
|
||||
|
||||
@ApiModelProperty(name = "围栏名称")
|
||||
@TableField("fencing_name")
|
||||
private String fencingName ;
|
||||
|
||||
@ApiModelProperty(name = "围栏经纬度")
|
||||
@TableField("fencing_lat")
|
||||
private String fencingLat ;
|
||||
|
||||
@ApiModelProperty(name = "激活状态")
|
||||
@TableField("fencing_status")
|
||||
private Integer fencingStatus ;
|
||||
|
||||
@ApiModelProperty(name = "操作时间")
|
||||
@TableField("fencing_time")
|
||||
private String fencingTime ;
|
||||
|
||||
@ApiModelProperty(name = "操作者")
|
||||
@TableField("create_user_id")
|
||||
private Integer createUserId ;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package com.shiyi.internet.response;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @ClassName : RequestFencing
|
||||
* @Description : 电子围栏响应实体类
|
||||
* @Author : YHY
|
||||
* @Date: 2023-11-18 13:17
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ResponseFencing {
|
||||
/** 电子围栏ID */
|
||||
@ApiModelProperty(name = "电子围栏ID",notes = "")
|
||||
private Integer fencingId ;
|
||||
/** 围栏名称 */
|
||||
@ApiModelProperty(name = "围栏名称",notes = "")
|
||||
private String fencingName ;
|
||||
/** 围栏经纬度 */
|
||||
@ApiModelProperty(name = "围栏经纬度",notes = "")
|
||||
private String fencingLat ;
|
||||
/** 激活状态 */
|
||||
@ApiModelProperty(name = "激活状态",notes = "")
|
||||
private Integer fencingStatus ;
|
||||
/** 操作时间 */
|
||||
@ApiModelProperty(name = "操作时间",notes = "")
|
||||
private String fencingTime ;
|
||||
/** 操作者 */
|
||||
@ApiModelProperty(name = "操作者",notes = "")
|
||||
private Integer createUserId ;
|
||||
}
|
|
@ -26,7 +26,7 @@
|
|||
<dependencies>
|
||||
<!-- 继承common依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<groupId>com.fate</groupId>
|
||||
<artifactId>fance-menghang-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<dependencies>
|
||||
<!-- 继承common依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.example</groupId>
|
||||
<groupId>com.fate</groupId>
|
||||
<artifactId>fance-menghang-common</artifactId>
|
||||
<version>3.6.3</version>
|
||||
</dependency>
|
||||
|
@ -58,6 +58,7 @@
|
|||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.7.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DrivingRecordController extends BaseController {
|
|||
* @Updator: YHY
|
||||
* @Date 2023/11/21 14:38
|
||||
*/
|
||||
@RequiresPermissions("record:record:list")
|
||||
//@RequiresPermissions("record:record:list")
|
||||
@GetMapping("/list")
|
||||
public Result<List<DrivingRecord>> list(DrivingRecord drivingRecord){
|
||||
log.info("功能名称:车辆行驶记录,请求URL:【{}】,请求方法:【{}】",request.getRequestURI(),
|
||||
|
@ -55,8 +55,8 @@ public class DrivingRecordController extends BaseController {
|
|||
* @param response
|
||||
* @param drivingRecord
|
||||
*/
|
||||
@RequiresPermissions("record:record:export")
|
||||
@Log(title = "导出车辆行驶记录", businessType = BusinessType.EXPORT)
|
||||
//@RequiresPermissions("record:record:export")
|
||||
//@Log(title = "导出车辆行驶记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response ,DrivingRecord drivingRecord){
|
||||
Result<List<DrivingRecord>> list = drivingRecordService.listDriving(drivingRecord); //车辆行驶车辆对象
|
||||
|
@ -87,10 +87,10 @@ public class DrivingRecordController extends BaseController {
|
|||
* @param drivingRecord
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("record:record:add")
|
||||
@Log(title = "车辆行驶记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping()
|
||||
public Result add(@RequestBody DrivingRecord drivingRecord){
|
||||
//@RequiresPermissions("record:record:insertDriving")
|
||||
//@Log(title = "车辆行驶记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/insertDriving")
|
||||
public Result insertDriving(@RequestBody DrivingRecord drivingRecord){
|
||||
log.info("功能名称:添加车辆行驶记录,请求URL:【{}】,请求防范:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),drivingRecord);
|
||||
drivingRecordService.insertDriving(drivingRecord);
|
||||
|
@ -105,10 +105,10 @@ public class DrivingRecordController extends BaseController {
|
|||
* @param drivingRecord
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("record:record:edit")
|
||||
@Log(title = "修改车辆行驶记录", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public Result edit(@RequestBody DrivingRecord drivingRecord){
|
||||
//@RequiresPermissions("record:record:updateDrivingRecord")
|
||||
//@Log(title = "修改车辆行驶记录", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/updateDrivingRecord")
|
||||
public Result updateDrivingRecord(@RequestBody DrivingRecord drivingRecord){
|
||||
log.info("功能名称:修改车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{】】",request.getRequestURI(),
|
||||
request.getMethod(),drivingRecord);
|
||||
drivingRecordService.updateDrivingRecord(drivingRecord);
|
||||
|
@ -123,10 +123,10 @@ public class DrivingRecordController extends BaseController {
|
|||
* @param recordId
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("record:record:remove")
|
||||
@Log(title = "根据ID删除车辆行驶记录", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove/{recordId}")
|
||||
public Result remove(@PathVariable Integer recordId){
|
||||
//@RequiresPermissions("record:record:deleteDrivingRecord")
|
||||
//@Log(title = "根据ID删除车辆行驶记录", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/deleteDrivingRecord/{recordId}")
|
||||
public Result deleteDrivingRecord(@PathVariable Integer recordId){
|
||||
log.info("功能名称:根据ID删除车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),recordId);
|
||||
drivingRecordService.deleteDrivingRecord(recordId);
|
||||
|
|
|
@ -59,6 +59,10 @@ public class DrivingRecordServiceimpl extends ServiceImpl<DrivingRecordMapper, D
|
|||
drivingRecordMapper.updateDrivingRecord(drivingRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除车辆行驶记录
|
||||
* @param recordId
|
||||
*/
|
||||
@Override
|
||||
public void deleteDrivingRecord(Integer recordId) {
|
||||
drivingRecordMapper.deleteDrivingRecord(recordId);
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
<?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.shiyi.internet.mapper.DrivingRecordMapper">
|
||||
<resultMap id="map" type="com.shiyi.internet.domain.DrivingRecord">
|
||||
<id column="record_id" property="recordId"></id>
|
||||
<result column="car_vin" property="carVin"></result>
|
||||
<result column="start_time" property="startTime"></result>
|
||||
<result column="end_time" property="endTime"></result>
|
||||
<result column="start_key" property="startKey"></result>
|
||||
<result column="end_key" property="endKey"></result>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
<insert id="insertDriving">
|
||||
insert into car_record (
|
||||
record_id,
|
||||
car_vin,
|
||||
start_time,
|
||||
end_time,
|
||||
start_key,
|
||||
end_key) values(
|
||||
#{recordId},
|
||||
#{carVin},
|
||||
#{startTime},
|
||||
#{endTime},
|
||||
|
@ -24,6 +33,8 @@
|
|||
start_key=#{startKey},
|
||||
end_key=#{endKey} where record_id=#{recordId}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteDrivingRecord">
|
||||
delete from car_record where record_id=#{recordId}
|
||||
</delete>
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
car_id,
|
||||
car_name,
|
||||
car_license,
|
||||
driving_id,
|
||||
typ_eId,
|
||||
fen_ceId,
|
||||
dri_veId,
|
||||
|
@ -15,7 +14,6 @@
|
|||
#{carId},
|
||||
#{carName},
|
||||
#{carLicense},
|
||||
#{drivingId},
|
||||
#{typeId},
|
||||
#{fenceId},
|
||||
#{driveId},
|
||||
|
@ -26,7 +24,6 @@
|
|||
update t_car set
|
||||
car_name=#{carName},
|
||||
car_license=#{carLicense},
|
||||
driving_id=#{drivingId},
|
||||
type_id=#{typeId},
|
||||
fence_id=#{fenceId},
|
||||
drive_id=#{driveId},
|
||||
|
@ -39,12 +36,11 @@
|
|||
|
||||
<select id="vehicleList" resultType="com.shiyi.internet.domain.response.ResponseCar">
|
||||
select * from t_car ca left join t_drive dr on ca.drive_id=dr.drive_id left join
|
||||
t_battery ba on ca.battery_id=ba.battery_id left join t_driving d on ca.driving_id=d.driving_id
|
||||
left join t_fence fe on ca.fence_id=fe.fence_id
|
||||
t_battery ba on ca.battery_id=ba.battery_id left join t_fence fe on ca.fence_id=fe.fence_id
|
||||
</select>
|
||||
<select id="findVehiclById" resultType="com.shiyi.internet.domain.response.ResponseCar">
|
||||
select * from t_car ca left join t_drive dr on ca.drive_id=dr.drive_id left join
|
||||
t_battery ba on ca.battery_id=ba.battery_id left join t_driving d on ca.driving_id=d.driving_id
|
||||
left join t_fence fe on ca.fence_id=fe.fence_id where car_id=#{carId}
|
||||
t_battery ba on ca.battery_id=ba.battery_id left join t_fence fe on ca.fence_id=fe.fence_id
|
||||
where car_id=#{carId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue