feat():.根据车辆vin查询车辆类型,根据车辆类型查询报文模板id,根据报文模板id查询策略

liuyibo 2024-09-24 09:26:19 +08:00
parent dd30d17c40
commit 027e3df9d0
15 changed files with 301 additions and 12 deletions

View File

@ -81,12 +81,6 @@
<groupId>com.muyu</groupId>
<artifactId>cloud-common-rabbit</artifactId>
</dependency>
<!-- SaaS模块 -->
<dependency>
<groupId>com.muyu</groupId>
<artifactId>cloud-common-saas</artifactId>
</dependency>
</dependencies>
<build>

View File

@ -14,13 +14,8 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
* @author muyu
*/
@EnableCustomConfig
//@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication(exclude = {
DataSourceAutoConfiguration.class,
DruidDataSourceAutoConfigure.class,
DynamicDataSourceAutoConfiguration.class
})
@SpringBootApplication
public class CloudCarApplication {
public static void main (String[] args) {
SpringApplication.run(CloudCarApplication.class, args);

View File

@ -73,6 +73,12 @@
<artifactId>cloud-common-api-doc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>3.3.2</version>
</dependency>
</dependencies>
<build>

View File

@ -0,0 +1,38 @@
package com.muyu.warn.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.warn.domain.Car;
import com.muyu.warn.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* @ClassName CarController
* @Description
* @Author YiBo.Liu
* @Date 2024/9/23 22:42
*/
@RequestMapping("/car")
@RestController
public class CarController {
@Autowired
private CarService carService;
/**
* vin
* @param vin
* @return
*/
@PostMapping("/ByVin")
public Result<Car> findByVin(@RequestParam("vin") String vin) {
Car car = carService.findByVin(vin);
return Result.success(car);
}
}

View File

@ -3,6 +3,7 @@ package com.muyu.warn.controller;
import java.util.Arrays;
import java.util.List;
import com.muyu.warn.domain.Resp.StrategyRespList;
import com.muyu.warn.domain.Resp.WarnStrategyList;
import jakarta.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
@ -120,4 +121,15 @@ public class WarnStrategyController extends BaseController
List<WarnStrategyList> list = warnStrategyService.strategyList(warnStrategy);
return Result.success(list);
}
/**
*
* @param warnStrategy
* @return
*/
@PostMapping("/strategyList")
public Result<List<StrategyRespList>> StrategyList(@RequestBody WarnStrategy warnStrategy){
List<StrategyRespList> list = warnStrategyService.strategyRespList(warnStrategy);
return Result.success(list);
}
}

View File

@ -0,0 +1,103 @@
package com.muyu.warn.domain;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.annotation.security.DenyAll;
/**
* @ClassName Car
* @Description
* @Author YiBo.Liu
* @Date 2024/9/23 22:42
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "车辆表")
public class Car {
/**
*
*/
private String carId;
/**
*
*/
private String carFrame;
/**
*
*/
private String carCoed;
/**
*
*/
private String carColor;
/**
*
*/
private String carVin;
/**
*
*/
private String userId;
/**
*
*/
private String typeId;
/**
*
*/
private String audditTime;
/**
*
*/
private String licenseTime;
/**
*
*/
private String insuranceTime;
/**
*
*/
private String carStatus;
/**
*
*/
private String createdTime;
/**
*
*/
private String carGears;
/**
*
*/
private String carModel;
/**
*
*/
private String carBrand;
/**
*
*/
private String carLastJoinTime;
/**
*
*/
private String carLastOfflineTime;
/**
*
*/
private String companyId;
/**
*
*/
private String carType;
}

View File

@ -0,0 +1,48 @@
package com.muyu.warn.domain.Resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.muyu.common.core.annotation.Excel;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName StrategyRespList
* @Description
* @Author YiBo.Liu
* @Date 2024/9/23 14:39
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Tag(name = "三表联查")
public class StrategyRespList {
/** 策略id */
@TableId( type = IdType.AUTO)
private Long id;
/** 车辆类型id */
@Excel(name = "车辆类型id")
private Long carTypeId;
/** 策略名称 */
@Excel(name = "策略名称")
private String strategyName;
/** 报文模版id */
@Excel(name = "报文模版id")
private Long templateId;
/** 车辆类型 */
private String carTypeName;
/** 模板名称*/
private String templateName;
}

View File

@ -0,0 +1,11 @@
package com.muyu.warn.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.warn.domain.Car;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface CarMapper extends BaseMapper<Car> {
Car findByVin(@Param("vin") String vin);
}

View File

@ -1,5 +1,6 @@
package com.muyu.warn.mapper;
import com.muyu.warn.domain.Resp.StrategyRespList;
import com.muyu.warn.domain.Resp.WarnStrategyList;
import com.muyu.warn.domain.WarnStrategy;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -17,4 +18,6 @@ import java.util.List;
public interface WarnStrategyMapper extends BaseMapper<WarnStrategy>{
List<WarnStrategyList> strategyList(WarnStrategy warnStrategy);
List<StrategyRespList> strategyRespList(WarnStrategy warnStrategy);
}

View File

@ -0,0 +1,11 @@
package com.muyu.warn.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.warn.domain.Car;
import org.springframework.stereotype.Service;
@Service
public interface CarService extends IService<Car> {
Car findByVin(String vin);
}

View File

@ -2,6 +2,7 @@ package com.muyu.warn.service;
import java.util.List;
import com.muyu.warn.domain.Resp.StrategyRespList;
import com.muyu.warn.domain.Resp.WarnStrategyList;
import com.muyu.warn.domain.WarnStrategy;
import com.baomidou.mybatisplus.extension.service.IService;
@ -37,6 +38,17 @@ public interface IWarnStrategyService extends IService<WarnStrategy> {
Boolean checkIdUnique(WarnStrategy warnStrategy);
/**
*
* @param warnStrategy
* @return
*/
List<WarnStrategyList> strategyList(WarnStrategy warnStrategy);
/**
*
* @param warnStrategy
* @return
*/
List<StrategyRespList> strategyRespList(WarnStrategy warnStrategy);
}

View File

@ -0,0 +1,33 @@
package com.muyu.warn.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.warn.domain.Car;
import com.muyu.warn.mapper.CarMapper;
import com.muyu.warn.service.CarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @ClassName CarServiceImpl
* @Description
* @Author YiBo.Liu
* @Date 2024/9/24 0:27
*/
@Service
public class CarServiceImpl
extends ServiceImpl<CarMapper, Car>
implements CarService {
@Autowired
private CarMapper carMapper;
/**
* vin
* @param vin
* @return
*/
@Override
public Car findByVin(String vin) {
return carMapper.findByVin(vin);
}
}

View File

@ -3,6 +3,7 @@ package com.muyu.warn.service.impl;
import java.util.List;
import com.muyu.common.core.domain.Result;
import com.muyu.warn.domain.Resp.StrategyRespList;
import com.muyu.warn.domain.Resp.WarnStrategyList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
@ -85,4 +86,9 @@ public class WarnStrategyServiceImpl
}
@Override
public List<StrategyRespList> strategyRespList(WarnStrategy warnStrategy) {
return warnStrategyMapper.strategyRespList(warnStrategy);
}
}

View File

@ -0,0 +1,9 @@
<?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.warn.mapper.CarMapper">
<select id="findByVin" resultType="com.muyu.warn.domain.Car">
select * from t_car where car_vin = #{vin}
</select>
</mapper>

View File

@ -23,4 +23,12 @@
LEFT JOIN warn_rule r ON s.id = r.strategy_id
LEFT JOIN t_message_type on r.msg_type_id = t_message_type.message_type_id
</select>
<select id="strategyRespList" resultType="com.muyu.warn.domain.Resp.StrategyRespList">
SELECT
*
FROM
warn_strategy s
LEFT JOIN t_car_type c ON c.car_type_id = s.car_type_id
LEFT JOIN t_template t ON t.template_id = s.template_id
</select>
</mapper>