package com.hzy.project.business.income.service.impl;

import java.util.List;
import com.hzy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hzy.project.business.income.mapper.IncomeMapper;
import com.hzy.project.business.income.domain.Income;
import com.hzy.project.business.income.service.IIncomeService;
import com.hzy.common.utils.text.Convert;

/**
 * 收入Service业务层处理
 * 
 * @author ruoyi
 * @date 2026-01-02
 */
@Service
public class IncomeServiceImpl implements IIncomeService 
{
    @Autowired
    private IncomeMapper incomeMapper;

    /**
     * 查询收入
     * 
     * @param incomeId 收入主键
     * @return 收入
     */
    @Override
    public Income selectIncomeByIncomeId(Long incomeId)
    {
        return incomeMapper.selectIncomeByIncomeId(incomeId);
    }

    /**
     * 查询收入列表
     * 
     * @param income 收入
     * @return 收入
     */
    @Override
    public List<Income> selectIncomeList(Income income)
    {
        return incomeMapper.selectIncomeList(income);
    }

    /**
     * 新增收入
     * 
     * @param income 收入
     * @return 结果
     */
    @Override
    public int insertIncome(Income income)
    {
        income.setCreateTime(DateUtils.getNowDate());
        return incomeMapper.insertIncome(income);
    }

    /**
     * 修改收入
     * 
     * @param income 收入
     * @return 结果
     */
    @Override
    public int updateIncome(Income income)
    {
        income.setUpdateTime(DateUtils.getNowDate());
        return incomeMapper.updateIncome(income);
    }

    /**
     * 批量删除收入
     * 
     * @param incomeIds 需要删除的收入主键
     * @return 结果
     */
    @Override
    public int deleteIncomeByIncomeIds(String incomeIds)
    {
        return incomeMapper.deleteIncomeByIncomeIds(Convert.toStrArray(incomeIds));
    }

    /**
     * 删除收入信息
     * 
     * @param incomeId 收入主键
     * @return 结果
     */
    @Override
    public int deleteIncomeByIncomeId(Long incomeId)
    {
        return incomeMapper.deleteIncomeByIncomeId(incomeId);
    }
}
