添加车辆行驶记录
parent
247df398ea
commit
e415654abd
|
@ -1,6 +1,8 @@
|
|||
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;
|
||||
|
@ -25,7 +27,7 @@ public class Drive extends BaseEntity {
|
|||
|
||||
|
||||
@ApiModelProperty("驱动零件ID")
|
||||
@TableField("drive_id")
|
||||
@TableId(value = "drive_id",type = IdType.AUTO)
|
||||
private String driveId;
|
||||
|
||||
@ApiModelProperty("配件型号")
|
||||
|
|
|
@ -24,22 +24,30 @@ import java.util.Date;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("t_driving")
|
||||
@TableName("car_record")
|
||||
public class DrivingRecord extends BaseEntity {
|
||||
|
||||
@ApiModelProperty("状态ID")
|
||||
@TableId(value = "driving_id", type = IdType.AUTO)
|
||||
private Integer drivingId ;
|
||||
@ApiModelProperty("行驶记录ID")
|
||||
@TableId(value = "record_id",type = IdType.AUTO)
|
||||
private Integer recordId ;
|
||||
|
||||
@ApiModelProperty("车辆vin")
|
||||
@TableField("driving_vin")
|
||||
private String drivingVin ;
|
||||
@ApiModelProperty(name = "车辆vin")
|
||||
@TableField("car_vin")
|
||||
private String carVin ;
|
||||
|
||||
@ApiModelProperty("上线时间")
|
||||
@TableId(value = "driving_starttime")
|
||||
private Date drivingStarttime ;
|
||||
@ApiModelProperty(name = "开始时间")
|
||||
@TableField("start_time")
|
||||
private Date startTime ;
|
||||
|
||||
@ApiModelProperty("下线时间")
|
||||
@TableId(value = "driving_endtime")
|
||||
private Date drivingEndtime ;
|
||||
@ApiModelProperty(name = "结束时间")
|
||||
@TableField("end_time")
|
||||
private Date endTime ;
|
||||
|
||||
@ApiModelProperty(name = "开始标识")
|
||||
@TableField("start_key")
|
||||
private String startKey ;
|
||||
|
||||
@ApiModelProperty(name = "结束标识")
|
||||
@TableField("end_key")
|
||||
private String endKey ;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
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.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fate.common.core.web.domain.BaseEntity;
|
||||
|
@ -26,23 +29,27 @@ import java.util.Date;
|
|||
@TableName("t_fencing")
|
||||
public class Fencing extends BaseEntity {
|
||||
|
||||
@ApiModelProperty(name = "电子围栏ID",notes = "")
|
||||
@ApiModelProperty("电子围栏ID")
|
||||
@TableId(value = "fencing_id",type = IdType.AUTO)
|
||||
private Integer fencingId ;
|
||||
/** 围栏名称 */
|
||||
@ApiModelProperty(name = "围栏名称",notes = "")
|
||||
|
||||
@ApiModelProperty("围栏名称")
|
||||
@TableField(value = "fencing_name")
|
||||
private String fencingName ;
|
||||
/** 围栏经纬度 */
|
||||
@ApiModelProperty(name = "围栏经纬度",notes = "")
|
||||
|
||||
@ApiModelProperty("围栏经纬度")
|
||||
@TableField(value = "fencing_lat")
|
||||
private String fencingLat ;
|
||||
/** 激活状态 */
|
||||
@ApiModelProperty(name = "激活状态",notes = "")
|
||||
|
||||
@ApiModelProperty("激活状态")
|
||||
@TableField(value = "fencing_status")
|
||||
private Integer fencingStatus ;
|
||||
/** 操作时间 */
|
||||
@ApiModelProperty(name = "操作时间",notes = "")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
|
||||
@ApiModelProperty("操作时间")
|
||||
@TableField(value = "fencing_time")
|
||||
private Date fencingTime ;
|
||||
/** 操作者 */
|
||||
@ApiModelProperty(name = "操作者",notes = "")
|
||||
|
||||
@ApiModelProperty("操作者")
|
||||
@TableField(value = "create_user_id")
|
||||
private Integer createUserId ;
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||
public class FencingApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FencingApplication.class,args);
|
||||
System.out.println("/**\n" +
|
||||
"\n" +
|
||||
System.out.println("(♥◠‿◠)ノ゙ 模块启动成功 ლ(´ڡ`ლ)゙ \n" +
|
||||
" \n" +
|
||||
" _oo0oo_\n" +
|
||||
" o8888888o\n" +
|
||||
" 88\" . \"88\n" +
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
package com.shiyi.internet.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fate.common.core.domain.Result;
|
||||
import com.fate.common.core.utils.poi.ExcelUtil;
|
||||
import com.fate.common.core.web.controller.BaseController;
|
||||
import com.fate.common.log.annotation.Log;
|
||||
import com.fate.common.log.enums.BusinessType;
|
||||
import com.fate.common.security.annotation.RequiresPermissions;
|
||||
import com.shiyi.internet.domain.DrivingRecord;
|
||||
import com.shiyi.internet.service.DrivingRecordService;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 车辆行驶控制层
|
||||
* @Author : YangHaoYu
|
||||
* @Date: 2023-11-21 14:14
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/record")
|
||||
@Log4j2
|
||||
public class DrivingRecordController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DrivingRecordService drivingRecordService;
|
||||
private HttpServletRequest request;
|
||||
|
||||
/**
|
||||
* @Description:车辆行驶记录
|
||||
No such property: code for class: Script1
|
||||
* @return: com.fate.common.core.domain.Result<java.util.List<com.shiyi.internet.domain.DrivingRecord>>
|
||||
* @Author: YHY
|
||||
* @Updator: YHY
|
||||
* @Date 2023/11/21 14:38
|
||||
*/
|
||||
@RequiresPermissions("record:record:list")
|
||||
@GetMapping("/list")
|
||||
public Result<List<DrivingRecord>> list(DrivingRecord drivingRecord){
|
||||
log.info("功能名称:车辆行驶记录,请求URL:【{}】,请求方法:【{}】",request.getRequestURI(),
|
||||
request.getMethod());
|
||||
Result<List<DrivingRecord>> result = drivingRecordService.listDriving(drivingRecord);
|
||||
log.info("功能名称:车辆行驶记录,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||
request.getMethod(), JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出车辆行驶记录
|
||||
* @param response
|
||||
* @param drivingRecord
|
||||
*/
|
||||
@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); //车辆行驶车辆对象
|
||||
ExcelUtil<DrivingRecord> util = new ExcelUtil<>(DrivingRecord.class);
|
||||
util.exportExcel(response, list.getData(), "车辆行驶数据"); //对list数据源将其里面的数据导入到Excel中
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询详细车辆行驶记录
|
||||
* @param recordId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("fingCarRecordById/{recordId}")
|
||||
public Result fingCarRecordById(@PathVariable Integer recordId){
|
||||
log.info("功能名称:查询详细车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),recordId);
|
||||
DrivingRecord drivingRecord = drivingRecordService.fingCarRecordById(recordId);
|
||||
Result result = Result.success(drivingRecord);
|
||||
log.info("功能名称:查询详细车辆行驶记录,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加车辆行驶记录
|
||||
* @param drivingRecord
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("record:record:add")
|
||||
@Log(title = "车辆行驶记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping()
|
||||
public Result add(@RequestBody DrivingRecord drivingRecord){
|
||||
log.info("功能名称:添加车辆行驶记录,请求URL:【{}】,请求防范:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),drivingRecord);
|
||||
drivingRecordService.insertDriving(drivingRecord);
|
||||
Result result = Result.success();
|
||||
log.info("功能名称:添加车辆行驶记录,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆行驶记录
|
||||
* @param drivingRecord
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("record:record:edit")
|
||||
@Log(title = "修改车辆行驶记录", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
public Result edit(@RequestBody DrivingRecord drivingRecord){
|
||||
log.info("功能名称:修改车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{】】",request.getRequestURI(),
|
||||
request.getMethod(),drivingRecord);
|
||||
drivingRecordService.updateDrivingRecord(drivingRecord);
|
||||
Result result = Result.success();
|
||||
log.info("功能名称:修改车辆行驶记录,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除车辆行驶记录
|
||||
* @param recordId
|
||||
* @return
|
||||
*/
|
||||
@RequiresPermissions("record:record:remove")
|
||||
@Log(title = "根据ID删除车辆行驶记录", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/remove/{recordId}")
|
||||
public Result remove(@PathVariable Integer recordId){
|
||||
log.info("功能名称:根据ID删除车辆行驶记录,请求URL:【{}】,请求方法:【{}】,请求参数:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),recordId);
|
||||
drivingRecordService.deleteDrivingRecord(recordId);
|
||||
Result result = Result.success();
|
||||
log.info("功能名称:根据ID删除车辆行驶记录,请求URL:【{}】,请求方法:【{}】,响应结果:【{}】",request.getRequestURI(),
|
||||
request.getMethod(),JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.shiyi.internet.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.shiyi.internet.domain.DrivingRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 车辆行驶控制层
|
||||
* @Author : YangHaoYu
|
||||
* @Date: 2023-11-21 14:29
|
||||
*/
|
||||
@Mapper
|
||||
public interface DrivingRecordMapper extends BaseMapper<DrivingRecord> {
|
||||
/**
|
||||
* @param drivingRecord
|
||||
* @return
|
||||
*/
|
||||
List<DrivingRecord> listDriving(DrivingRecord drivingRecord);
|
||||
|
||||
/**
|
||||
* @param recordId
|
||||
* @return
|
||||
*/
|
||||
DrivingRecord fingCarRecordById(@Param("recordId") Integer recordId);
|
||||
|
||||
/**
|
||||
* @param drivingRecord
|
||||
*/
|
||||
void insertDriving(DrivingRecord drivingRecord);
|
||||
|
||||
/**
|
||||
* @param drivingRecord
|
||||
*/
|
||||
void updateDrivingRecord(DrivingRecord drivingRecord);
|
||||
|
||||
void deleteDrivingRecord(@Param("recordId") Integer recordId);
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.shiyi.internet.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.fate.common.core.domain.Result;
|
||||
import com.shiyi.internet.domain.DrivingRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description :DrivingRecordService
|
||||
* @Author : YangHaoYu
|
||||
* @Date: 2023-11-21 14:26
|
||||
*/
|
||||
public interface DrivingRecordService extends IService<DrivingRecord> {
|
||||
|
||||
Result<List<DrivingRecord>> listDriving(DrivingRecord drivingRecord);
|
||||
|
||||
DrivingRecord fingCarRecordById(Integer recordId);
|
||||
|
||||
void insertDriving(DrivingRecord drivingRecord);
|
||||
|
||||
void updateDrivingRecord(DrivingRecord drivingRecord);
|
||||
|
||||
void deleteDrivingRecord(Integer recordId);
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package com.shiyi.internet.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fate.common.core.domain.Result;
|
||||
import com.shiyi.internet.domain.DrivingRecord;
|
||||
import com.shiyi.internet.mapper.DrivingRecordMapper;
|
||||
import com.shiyi.internet.service.DrivingRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 车辆行驶业务层
|
||||
* @Author : YangHaoYu
|
||||
* @Date: 2023-11-21 14:27
|
||||
*/
|
||||
@Service
|
||||
public class DrivingRecordServiceimpl extends ServiceImpl<DrivingRecordMapper, DrivingRecord> implements DrivingRecordService {
|
||||
|
||||
@Autowired
|
||||
private DrivingRecordMapper drivingRecordMapper;
|
||||
|
||||
/**
|
||||
* 车辆行驶记录
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result<List<DrivingRecord>> listDriving(DrivingRecord drivingRecord) {
|
||||
List<DrivingRecord> list = drivingRecordMapper.listDriving(drivingRecord);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询详细车辆行驶记录
|
||||
* @param recordId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public DrivingRecord fingCarRecordById(Integer recordId) {
|
||||
return drivingRecordMapper.fingCarRecordById(recordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加车辆行驶记录
|
||||
* @param drivingRecord
|
||||
*/
|
||||
@Override
|
||||
public void insertDriving(DrivingRecord drivingRecord) {
|
||||
drivingRecordMapper.insertDriving(drivingRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆行驶记录
|
||||
* @param drivingRecord
|
||||
*/
|
||||
@Override
|
||||
public void updateDrivingRecord(DrivingRecord drivingRecord) {
|
||||
drivingRecordMapper.updateDrivingRecord(drivingRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDrivingRecord(Integer recordId) {
|
||||
drivingRecordMapper.deleteDrivingRecord(recordId);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
<?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">
|
||||
<insert id="insertDriving">
|
||||
insert into car_record (
|
||||
record_id,
|
||||
car_vin,
|
||||
start_time,
|
||||
end_time,
|
||||
start_key,
|
||||
end_key) values(
|
||||
#{recordId},
|
||||
#{carVin},
|
||||
#{startTime},
|
||||
#{endTime},
|
||||
#{startKey},
|
||||
#{endKey})
|
||||
</insert>
|
||||
<update id="updateDrivingRecord">
|
||||
update car_record set
|
||||
car_vin=#{carVin},
|
||||
start_time=#{startTime},
|
||||
end_time=#{endTime},
|
||||
start_key=#{startKey},
|
||||
end_key=#{endKey} where record_id=#{recordId}
|
||||
</update>
|
||||
<delete id="deleteDrivingRecord">
|
||||
delete from car_record where record_id=#{recordId}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="listDriving" resultType="com.shiyi.internet.domain.DrivingRecord">
|
||||
select * from car_record
|
||||
</select>
|
||||
<select id="fingCarRecordById" resultType="com.shiyi.internet.domain.DrivingRecord">
|
||||
select * from car_record where record_id=#{recordId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue