package com.bonus.material.settlement.service.impl;

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.material.settlement.mapper.SltAgreementRelationMapper;
import com.bonus.material.settlement.domain.SltAgreementRelation;
import com.bonus.material.settlement.service.ISltAgreementRelationService;

/**
 * 计算关系Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class SltAgreementRelationServiceImpl implements ISltAgreementRelationService {
    @Autowired
    private SltAgreementRelationMapper sltAgreementRelationMapper;

    /**
     * 查询计算关系
     * 
     * @param id 计算关系主键
     * @return 计算关系
     */
    @Override
    public SltAgreementRelation selectSltAgreementRelationById(Long id) {
        return sltAgreementRelationMapper.selectSltAgreementRelationById(id);
    }

    /**
     * 查询计算关系列表
     * 
     * @param sltAgreementRelation 计算关系
     * @return 计算关系
     */
    @Override
    public List<SltAgreementRelation> selectSltAgreementRelationList(SltAgreementRelation sltAgreementRelation) {
        return sltAgreementRelationMapper.selectSltAgreementRelationList(sltAgreementRelation);
    }

    /**
     * 新增计算关系
     * 
     * @param sltAgreementRelation 计算关系
     * @return 结果
     */
    @Override
    public int insertSltAgreementRelation(SltAgreementRelation sltAgreementRelation) {
        sltAgreementRelation.setCreateTime(DateUtils.getNowDate());
        try {
            return sltAgreementRelationMapper.insertSltAgreementRelation(sltAgreementRelation);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改计算关系
     * 
     * @param sltAgreementRelation 计算关系
     * @return 结果
     */
    @Override
    public int updateSltAgreementRelation(SltAgreementRelation sltAgreementRelation) {
        sltAgreementRelation.setUpdateTime(DateUtils.getNowDate());
        try {
            return sltAgreementRelationMapper.updateSltAgreementRelation(sltAgreementRelation);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除计算关系
     * 
     * @param ids 需要删除的计算关系主键
     * @return 结果
     */
    @Override
    public int deleteSltAgreementRelationByIds(Long[] ids) {
        return sltAgreementRelationMapper.deleteSltAgreementRelationByIds(ids);
    }

    /**
     * 删除计算关系信息
     * 
     * @param id 计算关系主键
     * @return 结果
     */
    @Override
    public int deleteSltAgreementRelationById(Long id) {
        return sltAgreementRelationMapper.deleteSltAgreementRelationById(id);
    }
}
