package com.hzy.project.business.payment.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.payment.mapper.PaymentMapper;
import com.hzy.project.business.payment.domain.Payment;
import com.hzy.project.business.payment.service.IPaymentService;
import com.hzy.common.utils.text.Convert;

/**
 * 支出Service业务层处理
 * 
 * @author ruoyi
 * @date 2026-01-02
 */
@Service
public class PaymentServiceImpl implements IPaymentService 
{
    @Autowired
    private PaymentMapper paymentMapper;

    /**
     * 查询支出
     * 
     * @param paymentId 支出主键
     * @return 支出
     */
    @Override
    public Payment selectPaymentByPaymentId(Long paymentId)
    {
        return paymentMapper.selectPaymentByPaymentId(paymentId);
    }

    /**
     * 查询支出列表
     * 
     * @param payment 支出
     * @return 支出
     */
    @Override
    public List<Payment> selectPaymentList(Payment payment)
    {
        return paymentMapper.selectPaymentList(payment);
    }

    /**
     * 新增支出
     * 
     * @param payment 支出
     * @return 结果
     */
    @Override
    public int insertPayment(Payment payment)
    {
        payment.setCreateTime(DateUtils.getNowDate());
        return paymentMapper.insertPayment(payment);
    }

    /**
     * 修改支出
     * 
     * @param payment 支出
     * @return 结果
     */
    @Override
    public int updatePayment(Payment payment)
    {
        payment.setUpdateTime(DateUtils.getNowDate());
        return paymentMapper.updatePayment(payment);
    }

    /**
     * 批量删除支出
     * 
     * @param paymentIds 需要删除的支出主键
     * @return 结果
     */
    @Override
    public int deletePaymentByPaymentIds(String paymentIds)
    {
        return paymentMapper.deletePaymentByPaymentIds(Convert.toStrArray(paymentIds));
    }

    /**
     * 删除支出信息
     * 
     * @param paymentId 支出主键
     * @return 结果
     */
    @Override
    public int deletePaymentByPaymentId(Long paymentId)
    {
        return paymentMapper.deletePaymentByPaymentId(paymentId);
    }
}
