feat():新增预警方法
parent
bdf77f24a4
commit
e7e9f73ef5
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
|
@ -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));
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>
|
|
@ -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">
|
||||||
|
|
Loading…
Reference in New Issue