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.SltAgreementApplyMapper;
import com.bonus.material.settlement.domain.SltAgreementApply;
import com.bonus.material.settlement.service.ISltAgreementApplyService;

/**
 * 结算协议申请Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class SltAgreementApplyServiceImpl implements ISltAgreementApplyService {
    @Autowired
    private SltAgreementApplyMapper sltAgreementApplyMapper;

    /**
     * 查询结算协议申请
     * 
     * @param id 结算协议申请主键
     * @return 结算协议申请
     */
    @Override
    public SltAgreementApply selectSltAgreementApplyById(Long id) {
        return sltAgreementApplyMapper.selectSltAgreementApplyById(id);
    }

    /**
     * 查询结算协议申请列表
     * 
     * @param sltAgreementApply 结算协议申请
     * @return 结算协议申请
     */
    @Override
    public List<SltAgreementApply> selectSltAgreementApplyList(SltAgreementApply sltAgreementApply) {
        return sltAgreementApplyMapper.selectSltAgreementApplyList(sltAgreementApply);
    }

    /**
     * 新增结算协议申请
     * 
     * @param sltAgreementApply 结算协议申请
     * @return 结果
     */
    @Override
    public int insertSltAgreementApply(SltAgreementApply sltAgreementApply) {
        sltAgreementApply.setCreateTime(DateUtils.getNowDate());
        try {
            return sltAgreementApplyMapper.insertSltAgreementApply(sltAgreementApply);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改结算协议申请
     * 
     * @param sltAgreementApply 结算协议申请
     * @return 结果
     */
    @Override
    public int updateSltAgreementApply(SltAgreementApply sltAgreementApply) {
        sltAgreementApply.setUpdateTime(DateUtils.getNowDate());
        try {
            return sltAgreementApplyMapper.updateSltAgreementApply(sltAgreementApply);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除结算协议申请
     * 
     * @param ids 需要删除的结算协议申请主键
     * @return 结果
     */
    @Override
    public int deleteSltAgreementApplyByIds(Long[] ids) {
        return sltAgreementApplyMapper.deleteSltAgreementApplyByIds(ids);
    }

    /**
     * 删除结算协议申请信息
     * 
     * @param id 结算协议申请主键
     * @return 结果
     */
    @Override
    public int deleteSltAgreementApplyById(Long id) {
        return sltAgreementApplyMapper.deleteSltAgreementApplyById(id);
    }
}
