feat():连接车辆类型与模板
parent
b3ce3825ad
commit
833e554722
|
@ -12,6 +12,8 @@ out
|
|||
######################################################################
|
||||
# IDE
|
||||
|
||||
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
|
@ -26,6 +28,7 @@ logs
|
|||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
*.yml
|
||||
|
||||
### JRebel ###
|
||||
rebel.xml
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<module>cloud-common-xxl</module>
|
||||
<module>cloud-common-rabbit</module>
|
||||
<module>cloud-common-saas</module>
|
||||
<module>cloud-common-wechat</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>cloud-common</artifactId>
|
||||
|
|
|
@ -5,8 +5,9 @@ import com.muyu.common.core.utils.poi.ExcelUtil;
|
|||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.warn.domain.WarnRule;
|
||||
import com.muyu.warn.domain.car.CarMessageType;
|
||||
import com.muyu.warn.domain.car.resp.CarMessageResp;
|
||||
import com.muyu.warn.service.WarnRuleService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
@ -103,4 +104,17 @@ public class WarnRuleController extends BaseController
|
|||
warnRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆类型报文
|
||||
*/
|
||||
@RequiresPermissions("platform:rule:msg")
|
||||
@GetMapping("/msg/{id}")
|
||||
public Result<List<CarMessageResp>> findByMsg(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(warnRuleService.findByMsg(id));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.muyu.common.core.utils.poi.ExcelUtil;
|
|||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.warn.domain.car.CartType;
|
||||
import com.muyu.warn.domain.WarnStrategy;
|
||||
import com.muyu.warn.service.WarnStrategyService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
@ -103,4 +103,11 @@ public class WarnStrategyController extends BaseController
|
|||
warnStrategyService.removeBatchByIds(Arrays.asList(ids));
|
||||
return success();
|
||||
}
|
||||
|
||||
@RequiresPermissions("platform:strategy:cartype")
|
||||
@PostMapping("/findByCarType")
|
||||
public Result<List<CartType>> findByCarType(){
|
||||
return Result.success(warnStrategyService.findByCarType());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.muyu.warn.domain.car;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.warn.domain.car
|
||||
* @Project:cloud-server-8
|
||||
* @name:CarMessageType
|
||||
* @Date:2024/9/22 下午3:08
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CarMessage {
|
||||
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Integer carMessageId ;
|
||||
/**
|
||||
* 车辆类型外键
|
||||
*/
|
||||
private Integer carMessageCarype ;
|
||||
/**
|
||||
* 车辆报文外键
|
||||
*/
|
||||
private Integer carMessageType ;
|
||||
/**
|
||||
* 开始位下标
|
||||
*/
|
||||
private Integer carMessageStartIndex ;
|
||||
/**
|
||||
* 结束位下标
|
||||
*/
|
||||
private Integer carMessageEndIndex ;
|
||||
/**
|
||||
* 报文数据类型 (固定值 区间随机值)
|
||||
*/
|
||||
private String messageTypeClass ;
|
||||
/**
|
||||
* 报文是否开启故障检测(0默认未开启 1开启)
|
||||
*/
|
||||
private Integer carMessageState ;
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.muyu.warn.domain.car;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.warn.domain.car
|
||||
* @Project:cloud-server-8
|
||||
* @name:CarMessage
|
||||
* @Date:2024/9/22 下午3:07
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CarMessageType {
|
||||
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Integer messageTypeId ;
|
||||
/**
|
||||
* 报文编码
|
||||
*/
|
||||
private String messageTypeCode ;
|
||||
/**
|
||||
* 报文名称
|
||||
*/
|
||||
private String messageTypeName ;
|
||||
/**
|
||||
* 报文所属类别
|
||||
*/
|
||||
private String messageTypeBelongs ;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.muyu.warn.domain.car;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.warn.domain
|
||||
* @Project:cloud-server-8
|
||||
* @name:CartType
|
||||
* @Date:2024/9/21 下午7:38
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CartType {
|
||||
|
||||
/**
|
||||
* 车辆类型ID
|
||||
*/
|
||||
private String carTypeId ;
|
||||
/**
|
||||
* 车辆类型名
|
||||
*/
|
||||
private String carTypeName ;
|
||||
/**
|
||||
* 车辆规则外键ID
|
||||
*/
|
||||
private String carTypeRules ;
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.muyu.warn.domain.car.resp;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.warn.domain.car
|
||||
* @Project:cloud-server-8
|
||||
* @name:resp
|
||||
* @Date:2024/9/22 下午7:12
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CarMessageResp {
|
||||
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
private Integer carMessageId ;
|
||||
/**
|
||||
* 车辆类型外键
|
||||
*/
|
||||
private Integer carMessageCartype ;
|
||||
/**
|
||||
* 车辆报文外键
|
||||
*/
|
||||
private Integer carMessageType ;
|
||||
/**
|
||||
* 报文名称
|
||||
*/
|
||||
private String messageTypeName ;
|
||||
/**
|
||||
* 开始位下标
|
||||
*/
|
||||
private Integer carMessageStartIndex ;
|
||||
/**
|
||||
* 结束位下标
|
||||
*/
|
||||
private Integer carMessageEndIndex ;
|
||||
/**
|
||||
* 报文数据类型 (固定值 区间随机值)
|
||||
*/
|
||||
private String messageTypeClass ;
|
||||
/**
|
||||
* 报文是否开启故障检测(0默认未开启 1开启)
|
||||
*/
|
||||
private Integer carMessageState ;
|
||||
|
||||
}
|
|
@ -2,7 +2,12 @@ package com.muyu.warn.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.warn.domain.WarnRule;
|
||||
import com.muyu.warn.domain.car.CarMessageType;
|
||||
import com.muyu.warn.domain.car.resp.CarMessageResp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
|
@ -14,4 +19,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface WarnRuleMapper extends BaseMapper<WarnRule> {
|
||||
|
||||
List<CarMessageResp> findByMsg(@Param("id") Long id);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.muyu.warn.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.warn.domain.car.CartType;
|
||||
import com.muyu.warn.domain.WarnStrategy;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:蓬叁
|
||||
* @Package:com.muyu.warn.controller
|
||||
|
@ -14,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface WarnStrategyMapper extends BaseMapper<WarnStrategy> {
|
||||
|
||||
List<CartType> findByCarType();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.muyu.warn.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.warn.domain.WarnRule;
|
||||
import com.muyu.warn.domain.car.CarMessageType;
|
||||
import com.muyu.warn.domain.car.resp.CarMessageResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -36,4 +38,10 @@ public interface WarnRuleService extends IService<WarnRule> {
|
|||
*/
|
||||
Boolean checkIdUnique(WarnRule warnRule);
|
||||
|
||||
/**
|
||||
* 获取车辆类型报文
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<CarMessageResp> findByMsg(Long id);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.muyu.warn.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.warn.domain.car.CartType;
|
||||
import com.muyu.warn.domain.WarnStrategy;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -36,4 +37,5 @@ public interface WarnStrategyService extends IService<WarnStrategy> {
|
|||
*/
|
||||
Boolean checkIdUnique(WarnStrategy warnStrategy);
|
||||
|
||||
List<CartType> findByCarType();
|
||||
}
|
||||
|
|
|
@ -4,8 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.warn.domain.WarnRule;
|
||||
import com.muyu.warn.domain.car.CarMessageType;
|
||||
import com.muyu.warn.domain.car.resp.CarMessageResp;
|
||||
import com.muyu.warn.mapper.WarnRuleMapper;
|
||||
import com.muyu.warn.service.WarnRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
@ -23,6 +26,8 @@ public class WarnRuleServiceImpl
|
|||
extends ServiceImpl<WarnRuleMapper, WarnRule>
|
||||
implements WarnRuleService {
|
||||
|
||||
@Autowired private WarnRuleMapper warnRuleMapper;
|
||||
|
||||
/**
|
||||
* 精确查询预警规则
|
||||
*
|
||||
|
@ -85,4 +90,9 @@ public class WarnRuleServiceImpl
|
|||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CarMessageResp> findByMsg(Long id) {
|
||||
return warnRuleMapper.findByMsg(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,11 @@ package com.muyu.warn.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.warn.domain.car.CartType;
|
||||
import com.muyu.warn.domain.WarnStrategy;
|
||||
import com.muyu.warn.mapper.WarnStrategyMapper;
|
||||
import com.muyu.warn.service.WarnStrategyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
@ -23,6 +25,8 @@ public class WarnStrategyServiceImpl
|
|||
extends ServiceImpl<WarnStrategyMapper, WarnStrategy>
|
||||
implements WarnStrategyService {
|
||||
|
||||
@Autowired private WarnStrategyMapper warnStrategyMapper;
|
||||
|
||||
/**
|
||||
* 精确查询预警策略
|
||||
*
|
||||
|
@ -73,4 +77,9 @@ public class WarnStrategyServiceImpl
|
|||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CartType> findByCarType() {
|
||||
return warnStrategyMapper.findByCarType();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
<?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.WarnRuleMapper">
|
||||
<select id="findByMsg" resultType="com.muyu.warn.domain.car.resp.CarMessageResp">
|
||||
SELECT
|
||||
cm.car_message_id,
|
||||
cm.car_message_cartype,
|
||||
cm.car_message_type,
|
||||
cmt.message_type_name,
|
||||
cm.car_message_start_index,
|
||||
cm.car_message_end_index,
|
||||
cm.message_type_class,
|
||||
cm.car_message_state
|
||||
FROM
|
||||
car_message cm
|
||||
LEFT JOIN car_message_type cmt ON cm.car_message_type = cmt.message_type_id
|
||||
WHERE
|
||||
cm.car_message_cartype = #{id}
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,14 @@
|
|||
<?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.WarnStrategyMapper">
|
||||
<select id="findByCarType" resultType="com.muyu.warn.domain.car.CartType">
|
||||
select
|
||||
car_type_id,
|
||||
car_type_name,
|
||||
car_type_rules
|
||||
from
|
||||
car_type
|
||||
</select>
|
||||
</mapper>
|
|
@ -13,6 +13,7 @@
|
|||
<module>cloud-modules-gen</module>
|
||||
<module>cloud-modules-file</module>
|
||||
<module>cloud-modules-warn</module>
|
||||
<module>cloud-test</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>cloud-modules</artifactId>
|
||||
|
|
Loading…
Reference in New Issue