feat:()添加故障规则信息
parent
d472b8d326
commit
ac8e4bcc94
|
@ -0,0 +1,21 @@
|
|||
package com.muyu.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
/**
|
||||
* 故障规则表
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName(value = "fault_rule", autoResultMap = true)
|
||||
public class FaultRule {
|
||||
private Long faultRuleId;
|
||||
private Long vehicleTypeId;
|
||||
private Long messageValueId;
|
||||
private String faultCondition;
|
||||
private Double triggerValue;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.muyu.domain.resp;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Tag(name = "故障规则列表响应数据")
|
||||
public class FaultRuleResp {
|
||||
|
||||
private Long faultRuleId;
|
||||
|
||||
private String vehicleTypeName;
|
||||
|
||||
private String messageValueName;
|
||||
|
||||
private String faultCondition;
|
||||
|
||||
private Double triggerValue;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.muyu.enterprise.controller;
|
||||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.FaultRule;
|
||||
import com.muyu.domain.resp.FaultRuleResp;
|
||||
import com.muyu.enterprise.service.FaultRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 故障规则
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/faultRule")
|
||||
public class FaultRuleController {
|
||||
|
||||
@Autowired
|
||||
private FaultRuleService faultRuleService;
|
||||
|
||||
/**
|
||||
* 故障规则列表
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public Result<List<FaultRuleResp>> list() {
|
||||
List<FaultRuleResp> list = faultRuleService.selectList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param faultRule
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result<String> add(@RequestBody FaultRule faultRule) {
|
||||
faultRuleService.save(faultRule);
|
||||
return Result.success("新增成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param faultRule
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/update")
|
||||
public Result<String> update(@RequestBody FaultRule faultRule) {
|
||||
faultRuleService.updateById(faultRule);
|
||||
return Result.success("更新成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param faultRuleId
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping("delete/{faultRuleId}")
|
||||
public Result<String> delete(@PathVariable("faultRuleId") Long faultRuleId) {
|
||||
faultRuleService.removeById(faultRuleId);
|
||||
return Result.success("删除成功");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.enterprise.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.muyu.domain.FaultRule;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface FaultRuleMapper extends MPJBaseMapper<FaultRule> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.enterprise.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.domain.FaultRule;
|
||||
import com.muyu.domain.resp.FaultRuleResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FaultRuleService extends IService<FaultRule> {
|
||||
|
||||
/**
|
||||
* 查询故障规则列表
|
||||
* @return
|
||||
*/
|
||||
List<FaultRuleResp> selectList();
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.muyu.enterprise.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.muyu.domain.Fault;
|
||||
import com.muyu.domain.FaultRule;
|
||||
import com.muyu.domain.MessageValue;
|
||||
import com.muyu.domain.VehicleType;
|
||||
import com.muyu.domain.resp.FaultRuleResp;
|
||||
import com.muyu.enterprise.mapper.FaultRuleMapper;
|
||||
import com.muyu.enterprise.service.FaultRuleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, FaultRule> implements FaultRuleService {
|
||||
|
||||
@Autowired
|
||||
private FaultRuleMapper faultRuleMapper;
|
||||
|
||||
/**
|
||||
* 查询故障规则列表
|
||||
* @return 故障规则列表
|
||||
*/
|
||||
@Override
|
||||
public List<FaultRuleResp> selectList() {
|
||||
MPJLambdaWrapper<FaultRule> wrapper = new MPJLambdaWrapper<>();
|
||||
wrapper.selectAs(FaultRule::getFaultRuleId, "faultRuleId")
|
||||
.selectAs(FaultRule::getFaultCondition, "faultCondition")
|
||||
.selectAs(FaultRule::getTriggerValue, "triggerValue")
|
||||
.selectAs(VehicleType::getVehicleTypeName, "vehicleTypeName")
|
||||
.selectAs(MessageValue::getMessageLabel, "messageValueName")
|
||||
.leftJoin(VehicleType.class, VehicleType::getVehicleTypeId, FaultRule::getVehicleTypeId)
|
||||
.leftJoin(MessageValue.class, MessageValue::getMessageId, FaultRule::getMessageValueId);
|
||||
List<FaultRuleResp> list = faultRuleMapper.selectJoinList(FaultRuleResp.class, wrapper);
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -7,7 +7,7 @@ nacos:
|
|||
addr: 47.101.49.53:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: seven
|
||||
namespace: warn
|
||||
# SPRING_AMQP_DESERIALIZATION_TRUST_ALL=true spring.amqp.deserialization.trust.all
|
||||
# Spring
|
||||
spring:
|
||||
|
@ -58,3 +58,13 @@ spring:
|
|||
logging:
|
||||
level:
|
||||
com.muyu.system.mapper: DEBUG
|
||||
aliyun:
|
||||
access-key-id: LTAI5t7Fnx2QLTYLSu9357wP
|
||||
access-key-secret: 3LOnydNZ25ytsTGczuSygElx0HJ6nN
|
||||
endpoint: ecs-cn-hangzhou.aliyuncs.com
|
||||
region-id: cn-shanghai
|
||||
image-id: m-uf66taa8r57ky0pg3e7s
|
||||
instance-type: ecs.t6-c1m1.large
|
||||
security-group-id: sg-uf6hyictocodexptlgiv
|
||||
switch-id: vsw-uf6ags5luz17qd6ckn2tb
|
||||
amount: 1
|
||||
|
|
Loading…
Reference in New Issue