package com.aucma.production.service.impl;

import com.aucma.common.utils.DateUtils;
import com.aucma.production.domain.AndonRule;
import com.aucma.production.mapper.AndonRuleMapper;
import com.aucma.production.service.IAndonRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 安灯规则配置Service业务层处理
 * 
 * @author Yinq
 * @date 2025-10-28
 */
@Service
public class AndonRuleServiceImpl implements IAndonRuleService 
{
    @Autowired
    private AndonRuleMapper andonRuleMapper;

    /**
     * 查询安灯规则配置
     * 
     * @param ruleId 安灯规则配置主键
     * @return 安灯规则配置
     */
    @Override
    public AndonRule selectAndonRuleByRuleId(Long ruleId)
    {
        return andonRuleMapper.selectAndonRuleByRuleId(ruleId);
    }

    /**
     * 查询安灯规则配置列表
     * 
     * @param andonRule 安灯规则配置
     * @return 安灯规则配置
     */
    @Override
    public List<AndonRule> selectAndonRuleList(AndonRule andonRule)
    {
        return andonRuleMapper.selectAndonRuleList(andonRule);
    }

    /**
     * 新增安灯规则配置
     * 
     * @param andonRule 安灯规则配置
     * @return 结果
     */
    @Override
    public int insertAndonRule(AndonRule andonRule)
    {
        andonRule.setCreateTime(DateUtils.getNowDate());
        return andonRuleMapper.insertAndonRule(andonRule);
    }

    /**
     * 修改安灯规则配置
     * 
     * @param andonRule 安灯规则配置
     * @return 结果
     */
    @Override
    public int updateAndonRule(AndonRule andonRule)
    {
        andonRule.setUpdateTime(DateUtils.getNowDate());
        return andonRuleMapper.updateAndonRule(andonRule);
    }

    /**
     * 批量删除安灯规则配置
     * 
     * @param ruleIds 需要删除的安灯规则配置主键
     * @return 结果
     */
    @Override
    public int deleteAndonRuleByRuleIds(Long[] ruleIds)
    {
        return andonRuleMapper.deleteAndonRuleByRuleIds(ruleIds);
    }

    /**
     * 删除安灯规则配置信息
     * 
     * @param ruleId 安灯规则配置主键
     * @return 结果
     */
    @Override
    public int deleteAndonRuleByRuleId(Long ruleId)
    {
        return andonRuleMapper.deleteAndonRuleByRuleId(ruleId);
    }
}
