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.SltProjectMonthMapper;
import com.bonus.material.settlement.domain.SltProjectMonth;
import com.bonus.material.settlement.service.ISltProjectMonthService;

/**
 * 月结算任务索引Service业务层处理
 * 
 * @author xsheng
 * @date 2024-10-16
 */
@Service
public class SltProjectMonthServiceImpl implements ISltProjectMonthService {
    @Autowired
    private SltProjectMonthMapper sltProjectMonthMapper;

    /**
     * 查询月结算任务索引
     * 
     * @param id 月结算任务索引主键
     * @return 月结算任务索引
     */
    @Override
    public SltProjectMonth selectSltProjectMonthById(Long id) {
        return sltProjectMonthMapper.selectSltProjectMonthById(id);
    }

    /**
     * 查询月结算任务索引列表
     * 
     * @param sltProjectMonth 月结算任务索引
     * @return 月结算任务索引
     */
    @Override
    public List<SltProjectMonth> selectSltProjectMonthList(SltProjectMonth sltProjectMonth) {
        return sltProjectMonthMapper.selectSltProjectMonthList(sltProjectMonth);
    }

    /**
     * 新增月结算任务索引
     * 
     * @param sltProjectMonth 月结算任务索引
     * @return 结果
     */
    @Override
    public int insertSltProjectMonth(SltProjectMonth sltProjectMonth) {
        sltProjectMonth.setCreateTime(DateUtils.getNowDate());
        try {
            return sltProjectMonthMapper.insertSltProjectMonth(sltProjectMonth);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 修改月结算任务索引
     * 
     * @param sltProjectMonth 月结算任务索引
     * @return 结果
     */
    @Override
    public int updateSltProjectMonth(SltProjectMonth sltProjectMonth) {
        sltProjectMonth.setUpdateTime(DateUtils.getNowDate());
        try {
            return sltProjectMonthMapper.updateSltProjectMonth(sltProjectMonth);
        } catch (Exception e) {
            throw new ServiceException("错误信息描述");
        }
    }

    /**
     * 批量删除月结算任务索引
     * 
     * @param ids 需要删除的月结算任务索引主键
     * @return 结果
     */
    @Override
    public int deleteSltProjectMonthByIds(Long[] ids) {
        return sltProjectMonthMapper.deleteSltProjectMonthByIds(ids);
    }

    /**
     * 删除月结算任务索引信息
     * 
     * @param id 月结算任务索引主键
     * @return 结果
     */
    @Override
    public int deleteSltProjectMonthById(Long id) {
        return sltProjectMonthMapper.deleteSltProjectMonthById(id);
    }
}
