车辆管理
parent
a9be065140
commit
0c71aec748
|
@ -0,0 +1,27 @@
|
||||||
|
package com.couplet.common.domain.request;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author fufanrui
|
||||||
|
* @version 1.0
|
||||||
|
* @description: 车辆实时数据请求参数
|
||||||
|
* @date 2024/4/4 14:35
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@ToString
|
||||||
|
public class RealTimeDataRequest {
|
||||||
|
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
private String vin;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.couplet.business.server.controller;
|
||||||
|
|
||||||
|
import com.couplet.business.server.service.VehicleDetectionService;
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.domain.Vehicle;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author fufanrui
|
||||||
|
* @version 1.0
|
||||||
|
* @description: 车辆检测控制器
|
||||||
|
* @date 2024/4/4 10:11
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("detection")
|
||||||
|
public class VehicleDetectionController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VehicleDetectionService vehicleDetectionService;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param :
|
||||||
|
* @return Result<List<Vehicle>>
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 查询上线的车辆信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PostMapping("/detectionList")
|
||||||
|
public Result<List<Vehicle>> detectionList() {
|
||||||
|
return Result.success(vehicleDetectionService.detectionList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param vin:
|
||||||
|
* @return Result<List<Vehicle>>
|
||||||
|
* @author 付凡芮
|
||||||
|
* @description 根据vin查询车辆信息
|
||||||
|
* @date
|
||||||
|
*/
|
||||||
|
@PostMapping("/findByVin/{vehicleId}")
|
||||||
|
public Result<List<Vehicle>> findByVin(@PathVariable("vehicleId") Integer vehicleId) {
|
||||||
|
return Result.success(vehicleDetectionService.findByVin(vehicleId));
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.couplet.business.server.mapper;
|
||||||
|
|
||||||
|
import com.couplet.common.domain.Vehicle;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface VehicleDetectionMapper {
|
||||||
|
List<Vehicle> detectionList();
|
||||||
|
|
||||||
|
List<Vehicle> findByVin(Integer vehicleId);
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package com.couplet.business.server.service;
|
||||||
|
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.domain.Vehicle;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface VehicleDetectionService {
|
||||||
|
|
||||||
|
List<Vehicle> detectionList();
|
||||||
|
|
||||||
|
List<Vehicle> findByVin(Integer vehicleId);
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package com.couplet.business.server.service.impl;
|
||||||
|
|
||||||
|
import com.couplet.business.server.mapper.VehicleDetectionMapper;
|
||||||
|
import com.couplet.business.server.service.VehicleDetectionService;
|
||||||
|
import com.couplet.business.server.service.VehicleManageService;
|
||||||
|
import com.couplet.common.core.domain.Result;
|
||||||
|
import com.couplet.common.domain.Vehicle;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author fufanrui
|
||||||
|
* @version 1.0
|
||||||
|
* @description: 车辆检测服务实现类
|
||||||
|
* @date 2024/4/4 10:23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VehicleDetectionServiceImpl implements VehicleDetectionService{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VehicleDetectionMapper vehicleDetectionMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Vehicle> detectionList() {
|
||||||
|
return vehicleDetectionMapper.detectionList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Vehicle> findByVin(Integer vehicleId) {
|
||||||
|
return vehicleDetectionMapper.findByVin(vehicleId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?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.couplet.business.server.mapper.VehicleDetectionMapper">
|
||||||
|
|
||||||
|
<sql id="selectVehicle">
|
||||||
|
SELECT
|
||||||
|
v.vehicle_id,
|
||||||
|
v.vehicle_type,
|
||||||
|
v.motor_manufacturer,
|
||||||
|
v.battery_manufacturer,
|
||||||
|
v.motor_number,
|
||||||
|
v.battery_number,
|
||||||
|
v.vin,
|
||||||
|
v.vehicle_state,
|
||||||
|
v.isdelete,
|
||||||
|
t.vehicle_type_id,
|
||||||
|
t.vehicle_type_name
|
||||||
|
FROM
|
||||||
|
couplet_vehicle v
|
||||||
|
LEFT JOIN couplet_vehicle_type t ON v.vehicle_type = t.vehicle_type_id
|
||||||
|
WHERE v.isdelete = 0
|
||||||
|
</sql>
|
||||||
|
<select id="detectionList" resultType="com.couplet.common.domain.Vehicle">
|
||||||
|
<include refid="selectVehicle"/>
|
||||||
|
AND v.vehicle_state = 1
|
||||||
|
</select>
|
||||||
|
<select id="findByVin" resultType="com.couplet.common.domain.Vehicle">
|
||||||
|
<include refid="selectVehicle"/>
|
||||||
|
<if test="null!=vin and ''!=vin">
|
||||||
|
AND v.vehicle_id, = #{vehicleId}
|
||||||
|
</if>
|
||||||
|
AND v.vehicle_state = 1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue