package com.hzy.project.business.invoice.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.invoice.mapper.InvoiceMapper;
import com.hzy.project.business.invoice.domain.Invoice;
import com.hzy.project.business.invoice.service.IInvoiceService;
import com.hzy.common.utils.text.Convert;

/**
 * 发票Service业务层处理
 * 
 * @author ruoyi
 * @date 2026-01-02
 */
@Service
public class InvoiceServiceImpl implements IInvoiceService 
{
    @Autowired
    private InvoiceMapper invoiceMapper;

    /**
     * 查询发票
     * 
     * @param invoiceId 发票主键
     * @return 发票
     */
    @Override
    public Invoice selectInvoiceByInvoiceId(Long invoiceId)
    {
        return invoiceMapper.selectInvoiceByInvoiceId(invoiceId);
    }

    /**
     * 查询发票列表
     * 
     * @param invoice 发票
     * @return 发票
     */
    @Override
    public List<Invoice> selectInvoiceList(Invoice invoice)
    {
        return invoiceMapper.selectInvoiceList(invoice);
    }

    /**
     * 新增发票
     * 
     * @param invoice 发票
     * @return 结果
     */
    @Override
    public int insertInvoice(Invoice invoice)
    {
        invoice.setCreateTime(DateUtils.getNowDate());
        return invoiceMapper.insertInvoice(invoice);
    }

    /**
     * 修改发票
     * 
     * @param invoice 发票
     * @return 结果
     */
    @Override
    public int updateInvoice(Invoice invoice)
    {
        invoice.setUpdateTime(DateUtils.getNowDate());
        return invoiceMapper.updateInvoice(invoice);
    }

    /**
     * 批量删除发票
     * 
     * @param invoiceIds 需要删除的发票主键
     * @return 结果
     */
    @Override
    public int deleteInvoiceByInvoiceIds(String invoiceIds)
    {
        return invoiceMapper.deleteInvoiceByInvoiceIds(Convert.toStrArray(invoiceIds));
    }

    /**
     * 删除发票信息
     * 
     * @param invoiceId 发票主键
     * @return 结果
     */
    @Override
    public int deleteInvoiceByInvoiceId(Long invoiceId)
    {
        return invoiceMapper.deleteInvoiceByInvoiceId(invoiceId);
    }
}
