package com.fizz.business.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fizz.business.domain.SetupTensionAnnealingFurnace;
import com.fizz.business.mapper.SetupTensionAnnealingFurnaceMapper;
import com.fizz.business.service.ISetupTensionAnnealingFurnaceService;

/**
 * 退火炉张力Service业务层处理
 */
@Service
public class SetupTensionAnnealingFurnaceServiceImpl implements ISetupTensionAnnealingFurnaceService
{
    @Autowired
    private SetupTensionAnnealingFurnaceMapper mapper;

    @Override
    public SetupTensionAnnealingFurnace selectByKey(String steelGrade, Float thick, Float yieldStren)
    {
        return mapper.selectByKey(steelGrade, thick, yieldStren);
    }

    @Override
    public List<SetupTensionAnnealingFurnace> selectList(SetupTensionAnnealingFurnace query)
    {
        return mapper.selectList(query);
    }

    @Override
    public int insert(SetupTensionAnnealingFurnace entity)
    {
        if (mapper.selectByKey(entity.getSteelGrade(), entity.getThick(), entity.getYieldStren()) != null) {
            throw new RuntimeException("This parameter already exists");
        }
        entity.setCreateTime(DateUtils.getNowDate());
        entity.setUpdateTime(DateUtils.getNowDate());
        return mapper.insert(entity);
    }

    @Override
    public int updateByKey(SetupTensionAnnealingFurnace entity)
    {
        entity.setUpdateTime(DateUtils.getNowDate());
        return mapper.updateByKey(entity);
    }

    @Override
    public int deleteByKey(String steelGrade, Float thick, Float yieldStren)
    {
        return mapper.deleteByKey(steelGrade, thick, yieldStren);
    }
}

