fix():故障规则重构
parent
26c0d3d4c8
commit
a2f2d2ec52
|
@ -26,6 +26,7 @@ logs
|
||||||
*.iws
|
*.iws
|
||||||
*.iml
|
*.iml
|
||||||
*.ipr
|
*.ipr
|
||||||
|
*.yml
|
||||||
|
|
||||||
### JRebel ###
|
### JRebel ###
|
||||||
rebel.xml
|
rebel.xml
|
||||||
|
|
|
@ -8,12 +8,12 @@ import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报文模版表--实体类
|
* 故障规则
|
||||||
* @ClassName CarTemplate
|
* @Author: chenruijia
|
||||||
* @Description 报文模版表
|
* @Date 2024/9/28 12.23
|
||||||
* @author MingWei.Zong
|
* @Description FaultRule:故障规则
|
||||||
* @Date 2024/9/28 16:52
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
|
|
@ -12,7 +12,7 @@ import lombok.experimental.SuperBuilder;
|
||||||
* 故障规则
|
* 故障规则
|
||||||
* @Author: chenruijia
|
* @Author: chenruijia
|
||||||
* @Date 2024/9/28 12.23
|
* @Date 2024/9/28 12.23
|
||||||
* @Description FaultrRule:故障规则
|
* @Description FaultRule:故障规则
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
|
|
|
@ -14,42 +14,42 @@ import java.util.List;
|
||||||
* 故障的规则控制层
|
* 故障的规则控制层
|
||||||
* @author chenruijia
|
* @author chenruijia
|
||||||
* @Date 2024/9/28 11:58
|
* @Date 2024/9/28 11:58
|
||||||
* @Description FaultrRuleController:故障的规则控制层
|
* @Description FaultRuleController:故障的规则控制层
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/rule")
|
@RequestMapping("/rule")
|
||||||
@Tag(name = "故障的规则",description = "对故障数据规则的判断")
|
@Tag(name = "故障的规则",description = "对故障数据规则的判断")
|
||||||
public class FaultrRuleController {
|
public class FaultRuleController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FaultrRuleService faultrRuleService;
|
private FaultRuleService FaultRuleService;
|
||||||
/**
|
/**
|
||||||
* 查询车辆故障列表
|
* 查询车辆故障列表
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/faultRuleList", method = RequestMethod.GET)
|
@RequestMapping(value = "/faultRuleList", method = RequestMethod.GET)
|
||||||
public Result<List<FaultRule>> faultRuleList(FaultRule faultrRule)
|
public Result<List<FaultRule>> faultRuleList(FaultRule faultRule)
|
||||||
{
|
{
|
||||||
List<FaultRule> list = faultrRuleService.faultRuleList(faultrRule);
|
List<FaultRule> list = FaultRuleService.faultRuleList(faultRule);
|
||||||
return Result.success(list);
|
return Result.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加车辆规则
|
* 添加车辆规则
|
||||||
* @param faultrRule
|
* @param faultRule
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/insertRule",method = RequestMethod.POST)
|
@RequestMapping(value = "/insertRule",method = RequestMethod.POST)
|
||||||
public Result insertRule(@RequestBody FaultRule faultrRule){
|
public Result insertRule(@RequestBody FaultRule faultRule){
|
||||||
return Result.success(faultrRuleService.save(faultrRule));
|
return Result.success(FaultRuleService.save(faultRule));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改车辆规则
|
* 修改车辆规则
|
||||||
* @param faultrRule
|
* @param faultRule
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/updateRule",method = RequestMethod.POST)
|
@RequestMapping(value = "/updateRule",method = RequestMethod.POST)
|
||||||
public Result updateRule(@RequestBody FaultRule faultrRule){
|
public Result updateRule(@RequestBody FaultRule faultRule){
|
||||||
return Result.success(faultrRuleService.updateById(faultrRule));
|
return Result.success(FaultRuleService.updateById(faultRule));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +59,7 @@ public class FaultrRuleController {
|
||||||
*/
|
*/
|
||||||
@RequestMapping(value = "/byidRuleId/{faultRuleId}",method = RequestMethod.GET)
|
@RequestMapping(value = "/byidRuleId/{faultRuleId}",method = RequestMethod.GET)
|
||||||
public Result byidRuleId(@PathVariable Long faultRuleId){
|
public Result byidRuleId(@PathVariable Long faultRuleId){
|
||||||
FaultRule byid = faultrRuleService.byidRuleId(faultRuleId);
|
FaultRule byid = FaultRuleService.byidRuleId(faultRuleId);
|
||||||
return Result.success(byid);
|
return Result.success(byid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class FaultrRuleController {
|
||||||
@RequestMapping(value = "/remove/{ids}",method = RequestMethod.DELETE)
|
@RequestMapping(value = "/remove/{ids}",method = RequestMethod.DELETE)
|
||||||
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
{
|
{
|
||||||
faultrRuleService.removeBatchByIds(Arrays.asList(ids));
|
FaultRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||||
return Result.success();
|
return Result.success();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
* 故障规则持久层
|
* 故障规则持久层
|
||||||
* @Author: chenruijia
|
* @Author: chenruijia
|
||||||
* @Date 2024/9/28 12.17
|
* @Date 2024/9/28 12.17
|
||||||
* @Description FaultrRuleMapper:故障规则持久层
|
* @Description FaultRuleMapper:故障规则持久层
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface FaultrRuleMapper extends BaseMapper<FaultRule> {
|
public interface FaultRuleMapper extends BaseMapper<FaultRule> {
|
||||||
}
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.muyu.enterprise.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.enterprise.domain.FaultRule;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* 故障规则业务层
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.19
|
||||||
|
* @Description FaultRuleService:故障规则业务层
|
||||||
|
*/
|
||||||
|
public interface FaultRuleService extends IService<FaultRule> {
|
||||||
|
List<FaultRule> faultRuleList(FaultRule faultRule);
|
||||||
|
|
||||||
|
FaultRule byidRuleId(Long faultRuleId);
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
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.common.core.utils.StringUtils;
|
||||||
|
import com.muyu.enterprise.domain.FaultRule;
|
||||||
|
import com.muyu.enterprise.mapper.FaultRuleMapper;
|
||||||
|
import com.muyu.enterprise.service.FaultRuleService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
/**
|
||||||
|
* 故障规则业务实现层
|
||||||
|
* @Author: chenruijia
|
||||||
|
* @Date 2024/9/28 12.19
|
||||||
|
* @Description FaultRuleServiceImpl:故障规则业务实现层
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FaultRuleServiceImpl extends ServiceImpl<FaultRuleMapper, FaultRule> implements FaultRuleService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FaultRule> faultRuleList(FaultRule faultRule) {
|
||||||
|
LambdaQueryWrapper<FaultRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(faultRule.getFaultRuleName())) {
|
||||||
|
queryWrapper.eq(FaultRule::getFaultRuleName,faultRule.getFaultRuleName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(faultRule.getFaultRuleParameter())) {
|
||||||
|
queryWrapper.eq(FaultRule::getFaultRuleParameter,faultRule.getFaultRuleParameter());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FaultRule byidRuleId(Long faultRuleId) {
|
||||||
|
LambdaQueryWrapper<FaultRule> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(faultRuleId, "规则ID不可为空");
|
||||||
|
queryWrapper.eq(FaultRule::getFaultRuleId, faultRuleId);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue