feat(): 修改通过预警策略id查询预警规则列表方法
parent
880604da65
commit
d9e2c2e357
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author: LiDongJia
|
||||
* @Package: com.muyu.domain.resp
|
||||
* @Project: cloud-server
|
||||
* @name: WarnRuleListResp
|
||||
* @Date: 2024/10/10 10:37
|
||||
* @Description: 根据策略id查询规则响应值
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class WarnRuleListResp {
|
||||
|
||||
/** 规则id */
|
||||
@Schema(type = "Long",description = "规则id")
|
||||
private Long warnRuleId;
|
||||
|
||||
/** 规则名称 */
|
||||
@Schema(type = "String",description = "规则名称")
|
||||
private String ruleName;
|
||||
|
||||
/** 报文数据类型id */
|
||||
@Schema(type = "Long",description = "报文数据类型id")
|
||||
private Long msgTypeId;
|
||||
|
||||
/** 滑窗时间 */
|
||||
@Schema(type = "Date",description = "滑窗时间")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date slideTime;
|
||||
|
||||
/** 滑窗频率 */
|
||||
@Schema(type = "Integer",description = "滑窗频率")
|
||||
private Integer slideFrequency;
|
||||
|
||||
/** 最大值 */
|
||||
@Schema(type = "Integer",description = "最大值")
|
||||
private Integer maxValue;
|
||||
|
||||
/** 最小值 */
|
||||
@Schema(type = "Integer",description = "最小值")
|
||||
private Integer minValue;
|
||||
|
||||
/**
|
||||
* 策略外键id
|
||||
*/
|
||||
@Schema(type = "Integer",description = "策略外键id")
|
||||
private Integer warnStrategyId;
|
||||
|
||||
/**
|
||||
* 报文编码
|
||||
*/
|
||||
@Schema(type = "String",description = "报文编码")
|
||||
private String messageCode;
|
||||
}
|
|
@ -43,9 +43,9 @@ public class WarnRuleResp {
|
|||
|
||||
/** 规则集合 */
|
||||
@Schema(type = "List",description = "规则集合")
|
||||
private List<WarnRule> warnRuleList;
|
||||
private List<WarnRuleListResp> warnRuleList;
|
||||
|
||||
public static WarnRuleResp build(WarnStrategy warnStrategy, List<WarnRule> warnRuleList){
|
||||
public static WarnRuleResp build(WarnStrategy warnStrategy, List<WarnRuleListResp> warnRuleList){
|
||||
return WarnRuleResp.builder()
|
||||
.warnStrategyId(warnStrategy.getWarnStrategyId())
|
||||
.strategyName(warnStrategy.getStrategyName())
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.muyu.common.core.domain.Result;
|
|||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import com.muyu.common.system.domain.LoginUser;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.resp.WarnRuleListResp;
|
||||
import com.muyu.enterprise.cache.AllWarnRuleCacheService;
|
||||
import com.muyu.enterprise.cache.WarnRuleCacheService;
|
||||
import com.muyu.enterprise.service.WarnRuleService;
|
||||
|
@ -99,8 +100,8 @@ public class WarnRuleController {
|
|||
*/
|
||||
@GetMapping("/getWarnStrategyList/{warnStrategyId}")
|
||||
@Operation(summary = "根据外键id查询集合", description = "根据外键id查询集合")
|
||||
public Result<List<WarnRule>> findByWarnStrategyId(@PathVariable("warnStrategyId") Long warnStrategyId) {
|
||||
List<WarnRule> list = warnRuleService.findBywarnStrategyId(warnStrategyId);
|
||||
public Result<List<WarnRuleListResp>> findByWarnStrategyId(@PathVariable("warnStrategyId") Long warnStrategyId) {
|
||||
List<WarnRuleListResp> list = warnRuleService.findBywarnStrategyId(warnStrategyId);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.enterprise.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.resp.WarnRuleListResp;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
|
@ -10,7 +11,7 @@ import java.util.List;
|
|||
@Mapper
|
||||
public interface WarnRuleMapper extends BaseMapper<WarnRule> {
|
||||
|
||||
@Select("SELECT * FROM warn_rule WHERE warn_strategy_id=#{warnStrategyId}")
|
||||
List<WarnRule> findBywarnStrategyId(Long warnStrategyId);
|
||||
@Select("SELECT warn_rule.*,message_value.message_code FROM warn_rule LEFT JOIN message_value ON warn_rule.msg_type_id = message_value.message_id WHERE warn_strategy_id = #{warnStrategyId}")
|
||||
List<WarnRuleListResp> findBywarnStrategyId(Long warnStrategyId);
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.muyu.enterprise.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.resp.WarnRuleListResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,6 +13,6 @@ public interface WarnRuleService extends IService<WarnRule> {
|
|||
* @param warnStrategyId
|
||||
* @return
|
||||
*/
|
||||
List<WarnRule> findBywarnStrategyId(Long warnStrategyId);
|
||||
List<WarnRuleListResp> findBywarnStrategyId(Long warnStrategyId);
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.muyu.enterprise.service.impl;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.resp.WarnRuleListResp;
|
||||
import com.muyu.enterprise.mapper.WarnRuleMapper;
|
||||
import com.muyu.enterprise.service.WarnRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -18,8 +19,8 @@ public class WarnRuleServiceImpl extends ServiceImpl<WarnRuleMapper, WarnRule> i
|
|||
private WarnRuleMapper warnRuleMapper;
|
||||
|
||||
@Override
|
||||
public List<WarnRule> findBywarnStrategyId(Long warnStrategyId) {
|
||||
List<WarnRule> warnRules = warnRuleMapper.findBywarnStrategyId(warnStrategyId);
|
||||
public List<WarnRuleListResp> findBywarnStrategyId(Long warnStrategyId) {
|
||||
List<WarnRuleListResp> warnRules = warnRuleMapper.findBywarnStrategyId(warnStrategyId);
|
||||
return warnRules;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.domain.MessageTemplate;
|
||||
import com.muyu.domain.WarnRule;
|
||||
import com.muyu.domain.resp.WarnRuleListResp;
|
||||
import com.muyu.domain.resp.WarnRuleResp;
|
||||
import com.muyu.domain.resp.WarnStrategyAndVinResp;
|
||||
import com.muyu.enterprise.controller.WarnRuleController;
|
||||
|
@ -61,7 +62,7 @@ public class WarnStrategyServiceImpl extends ServiceImpl<WarnStrategyMapper, War
|
|||
public WarnRuleResp findByWarnStrategyId(Long warnStrategyId) {
|
||||
|
||||
WarnRuleResp warnRuleResp = warnStrategyMapper.findByWarnStrategyId(warnStrategyId);
|
||||
List<WarnRule> bywarnStrategyId = warnRuleService.findBywarnStrategyId(warnStrategyId);
|
||||
List<WarnRuleListResp> bywarnStrategyId = warnRuleService.findBywarnStrategyId(warnStrategyId);
|
||||
warnRuleResp.setWarnRuleList(bywarnStrategyId);
|
||||
return warnRuleResp;
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: vehicle
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
|
|
Loading…
Reference in New Issue