package com.muyu.fault.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.fault.common.FaultLog;
import com.muyu.fault.common.FaultrRule;
import com.muyu.fault.mapper.FaultrRuleMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.List;

@Service
public class FaultrRuleServiceImpl extends ServiceImpl<FaultrRuleMapper, FaultrRule> implements FaultrRuleService{

    @Override
    public List<FaultrRule> faultRuleList(FaultrRule faultrRule) {
        LambdaQueryWrapper<FaultrRule> queryWrapper = new LambdaQueryWrapper<>();
        return this.list(queryWrapper);
    }

    @Override
    public FaultrRule byidRuleId(Long faultRuleId) {
        LambdaQueryWrapper<FaultrRule> queryWrapper = new LambdaQueryWrapper<>();
        Assert.notNull(faultRuleId, "规则ID不可为空");
        queryWrapper.eq(FaultrRule::getFaultRuleId, faultRuleId);
        return this.getOne(queryWrapper);
    }
}
