package com.muyu.service.impl;

import java.util.List;

import com.muyu.domain.resp.WarnRuleResp;
import com.muyu.mapper.WarnRuleMapper;
import com.muyu.service.WarnRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.muyu.domain.WarnRule ;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.util.Assert;

/**
 * 预警规则Service业务层处理
 *
 * @author muyu
 * @date 2024-09-20
 */
@Service
public class WarnRuleServiceImpl
        extends ServiceImpl<WarnRuleMapper, WarnRule>
        implements WarnRuleService {
    @Autowired
    private WarnRuleMapper warnRuleMapper;

    /**
     * 精确查询预警规则
     *
     * @param id 预警规则主键
     * @return 预警规则
     */
    @Override
    public WarnRule selectWarnRuleById(Long id)
    {
        return warnRuleMapper.selectById(id);
    }


    /**
     * 查询预警规则列表
     *
     * @param
     * @return 预警规则
     */
    @Override
    public List<WarnRuleResp> selectWarnRuleResplist()
    {
        return warnRuleMapper.selectWarnRuleResplist();
    }

    @Override
    public Integer addWarnRule(WarnRule warnRule) {
        return warnRuleMapper.insert(warnRule);
    }

    @Override
    public Integer updWarnRule(WarnRule warnRule) {
        LambdaQueryWrapper<WarnRule> queryWrapper = new LambdaQueryWrapper<>();
        return warnRuleMapper.update(queryWrapper);
    }

    @Override
    public List<WarnRuleResp> selectListByStrategyId(Long strategyId) {
        return warnRuleMapper.selectListByStrategyId(strategyId);
    }


}
