fix():故障规则重构
parent
eef7d19aeb
commit
222b2ad30f
|
@ -26,6 +26,7 @@ logs
|
|||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
*.yml
|
||||
|
||||
### JRebel ###
|
||||
rebel.xml
|
||||
|
|
|
@ -8,12 +8,12 @@ import lombok.AllArgsConstructor;
|
|||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 报文模版表--实体类
|
||||
* @ClassName CarTemplate
|
||||
* @Description 报文模版表
|
||||
* @author MingWei.Zong
|
||||
* @Date 2024/9/28 16:52
|
||||
* 故障规则
|
||||
* @Author: chenruijia
|
||||
* @Date 2024/9/28 12.23
|
||||
* @Description FaultRule:故障规则
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
|
|
|
@ -12,7 +12,7 @@ import lombok.experimental.SuperBuilder;
|
|||
* 故障规则
|
||||
* @Author: chenruijia
|
||||
* @Date 2024/9/28 12.23
|
||||
* @Description FaultrRule:故障规则
|
||||
* @Description FaultRule:故障规则
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
|
|
|
@ -14,42 +14,42 @@ import java.util.List;
|
|||
* 故障的规则控制层
|
||||
* @author chenruijia
|
||||
* @Date 2024/9/28 11:58
|
||||
* @Description FaultrRuleController:故障的规则控制层
|
||||
* @Description FaultRuleController:故障的规则控制层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rule")
|
||||
@Tag(name = "故障的规则",description = "对故障数据规则的判断")
|
||||
public class FaultrRuleController {
|
||||
public class FaultRuleController {
|
||||
@Autowired
|
||||
private FaultrRuleService faultrRuleService;
|
||||
private FaultRuleService FaultRuleService;
|
||||
/**
|
||||
* 查询车辆故障列表
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加车辆规则
|
||||
* @param faultrRule
|
||||
* @param faultRule
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/insertRule",method = RequestMethod.POST)
|
||||
public Result insertRule(@RequestBody FaultRule faultrRule){
|
||||
return Result.success(faultrRuleService.save(faultrRule));
|
||||
public Result insertRule(@RequestBody FaultRule faultRule){
|
||||
return Result.success(FaultRuleService.save(faultRule));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改车辆规则
|
||||
* @param faultrRule
|
||||
* @param faultRule
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/updateRule",method = RequestMethod.POST)
|
||||
public Result updateRule(@RequestBody FaultRule faultrRule){
|
||||
return Result.success(faultrRuleService.updateById(faultrRule));
|
||||
public Result updateRule(@RequestBody FaultRule faultRule){
|
||||
return Result.success(FaultRuleService.updateById(faultRule));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,7 +59,7 @@ public class FaultrRuleController {
|
|||
*/
|
||||
@RequestMapping(value = "/byidRuleId/{faultRuleId}",method = RequestMethod.GET)
|
||||
public Result byidRuleId(@PathVariable Long faultRuleId){
|
||||
FaultRule byid = faultrRuleService.byidRuleId(faultRuleId);
|
||||
FaultRule byid = FaultRuleService.byidRuleId(faultRuleId);
|
||||
return Result.success(byid);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class FaultrRuleController {
|
|||
@RequestMapping(value = "/remove/{ids}",method = RequestMethod.DELETE)
|
||||
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||
{
|
||||
faultrRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||
FaultRuleService.removeBatchByIds(Arrays.asList(ids));
|
||||
return Result.success();
|
||||
}
|
||||
|
|
@ -8,8 +8,8 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
* 故障规则持久层
|
||||
* @Author: chenruijia
|
||||
* @Date 2024/9/28 12.17
|
||||
* @Description FaultrRuleMapper:故障规则持久层
|
||||
* @Description FaultRuleMapper:故障规则持久层
|
||||
*/
|
||||
@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