feat():新增预警方法

dev
SuiXxx 2024-09-22 19:19:57 +08:00
parent bdf77f24a4
commit e7e9f73ef5
14 changed files with 160 additions and 9 deletions

View File

@ -6,6 +6,7 @@ import com.muyu.domain.resp.CarTypeResp;
import com.muyu.service.CarTypeService; import com.muyu.service.CarTypeService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -25,9 +26,9 @@ public class CarTypeController {
} }
@GetMapping("/selectCarTypeRespList") @GetMapping("/selectCarTypeRespList/{id}")
public Result selectCarTypeRespList() { public Result selectCarTypeRespList(@PathVariable("id") Long id) {
return Result.success(carTypeService.selectCarTypeRespList()); return Result.success(carTypeService.selectCarTypeRespList(id));
} }

View File

@ -4,10 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.domain.CarType; import com.muyu.domain.CarType;
import com.muyu.domain.resp.CarTypeResp; import com.muyu.domain.resp.CarTypeResp;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface CarTypeMapper extends BaseMapper<CarType> { public interface CarTypeMapper extends BaseMapper<CarType> {
List<CarTypeResp> selectCarTypeRespList(); CarTypeResp selectCarTypeRespList(@Param("id")Long id);
} }

View File

@ -11,6 +11,6 @@ import java.util.List;
public interface CarTypeService extends IService<CarType> { public interface CarTypeService extends IService<CarType> {
List<CarType> selectCarTypeList(); List<CarType> selectCarTypeList();
List<CarTypeResp> selectCarTypeRespList(); CarTypeResp selectCarTypeRespList(Long id);
} }

View File

@ -22,7 +22,7 @@ private CarTypeMapper carTypeMapper;
} }
@Override @Override
public List<CarTypeResp> selectCarTypeRespList() { public CarTypeResp selectCarTypeRespList(Long id) {
return carTypeMapper.selectCarTypeRespList(); return carTypeMapper.selectCarTypeRespList(id);
} }
} }

View File

@ -11,5 +11,6 @@
FROM FROM
car_type car_type
LEFT JOIN t_template ON car_type.template_id = t_template.template_id LEFT JOIN t_template ON car_type.template_id = t_template.template_id
where car_type.id=#{id}
</select> </select>
</mapper> </mapper>

View File

@ -0,0 +1,23 @@
package com.muyu.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.service.TemplateNeedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/templateNeed")
public class TemplateNeedController {
@Autowired
private TemplateNeedService templateNeedService;
@GetMapping("/selectByTemplateId/{templateId}")
public Result selectByTemplateId(@PathVariable("templateId") Long templateId){
return Result.success(templateNeedService.selectByTemplateId(templateId));
}
}

View File

@ -39,7 +39,7 @@ public class WarnStrategyController extends BaseController
/** /**
* *
*/ */
@GetMapping("/selectWarnStrategyList") @PostMapping("/selectWarnStrategyList")
public Result selectWarnStrategyList(@RequestBody WarnStrategyReq warnStrategyReq) public Result selectWarnStrategyList(@RequestBody WarnStrategyReq warnStrategyReq)
{ {
return Result.success(warnStrategyService.selectWarnStrategyList(warnStrategyReq)); return Result.success(warnStrategyService.selectWarnStrategyList(warnStrategyReq));

View File

@ -0,0 +1,67 @@
package com.muyu.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@EqualsAndHashCode(callSuper=false)
@TableName(value = "message_template_type",autoResultMap = true)
public class MessageTemplateType implements Serializable {
/**
*
*/
@TableId(value = "message_template_type_id",type = IdType.AUTO)
private String messageTemplateTypeId;
/**
*
*/
private String messageClass;
/**
*
*/
private String messageCode;
/**
*
*/
private String messageField;
/**
*
*/
private Integer startIndex;
/**
*
*/
private Integer endIndex;
/**
*ID
*/
private Integer dataTypeId;
/**
*
*/
private String dataTypeName;
/**
*
*/
private String fixedValue;
/**
*
*/
private String rangeValue;
/**
* ID
*/
private Integer templateId;
}

View File

@ -12,4 +12,8 @@ import lombok.NoArgsConstructor;
public class WarnRuleResp extends WarnRule { public class WarnRuleResp extends WarnRule {
@Excel(name = "策略名称") @Excel(name = "策略名称")
private String strategyName; private String strategyName;
@Excel(name = "报文数值")
private String messageField;
} }

View File

@ -0,0 +1,11 @@
package com.muyu.mapper;
import com.muyu.domain.MessageTemplateType;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TemplateNeedMapper {
List<MessageTemplateType> selectByTemplateId(@Param("templateId")Long templateId);
}

View File

@ -0,0 +1,10 @@
package com.muyu.service;
import com.muyu.domain.MessageTemplateType;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TemplateNeedService {
List<MessageTemplateType> selectByTemplateId(Long templateId);
}

View File

@ -0,0 +1,21 @@
package com.muyu.service.impl;
import com.muyu.domain.MessageTemplateType;
import com.muyu.mapper.TemplateNeedMapper;
import com.muyu.service.TemplateNeedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TemplateNeedServiceImpl implements TemplateNeedService {
@Autowired
private TemplateNeedMapper templateNeedMapper;
@Override
public List<MessageTemplateType> selectByTemplateId(Long templateId) {
return templateNeedMapper.selectByTemplateId(templateId);
}
}

View File

@ -0,0 +1,10 @@
<?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.mapper.TemplateNeedMapper">
<select id="selectByTemplateId" resultType="com.muyu.domain.MessageTemplateType">
SELECT * FROM `message_template_type` WHERE template_id=#{templateId}
</select>
</mapper>

View File

@ -6,9 +6,11 @@
<mapper namespace="com.muyu.mapper.WarnRuleMapper"> <mapper namespace="com.muyu.mapper.WarnRuleMapper">
<select id="selectListByStrategyId" resultType="com.muyu.domain.resp.WarnRuleResp"> <select id="selectListByStrategyId" resultType="com.muyu.domain.resp.WarnRuleResp">
SELECT * ,warn_strategy.strategy_name SELECT * ,warn_strategy.strategy_name,
message_template_type.message_field
FROM `warn_rule` FROM `warn_rule`
LEFT JOIN warn_strategy ON warn_rule.strategy_id=warn_strategy.id LEFT JOIN warn_strategy ON warn_rule.strategy_id=warn_strategy.id
LEFT JOIN message_template_type ON warn_rule.msg_type_id=message_template_type.message_template_type_id
WHERE warn_rule.strategy_id=#{strategyId} WHERE warn_rule.strategy_id=#{strategyId}
</select> </select>
<select id="selectWarnRuleResplist" resultType="com.muyu.domain.resp.WarnRuleResp"> <select id="selectWarnRuleResplist" resultType="com.muyu.domain.resp.WarnRuleResp">