package com.ruoyi.business.service.impl;

import java.util.List;

import cn.hutool.core.date.DateTime;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.TbPaymentMapper;
import com.ruoyi.business.domain.TbPayment;
import com.ruoyi.business.service.ITbPaymentService;
import com.ruoyi.common.core.text.Convert;

/**
 * 支付Service业务层处理
 * 
 * @author xiatao
 * @date 2022-01-18
 */
@Service
public class TbPaymentServiceImpl implements ITbPaymentService 
{
    @Autowired
    private TbPaymentMapper tbPaymentMapper;

    /**
     * 查询支付
     * 
     * @param id 支付主键
     * @return 支付
     */
    @Override
    public TbPayment selectTbPaymentById(Long id)
    {
        return tbPaymentMapper.selectTbPaymentById(id);
    }

    /**
     * 查询支付列表
     * 
     * @param tbPayment 支付
     * @return 支付
     */
    @Override
    public List<TbPayment> selectTbPaymentList(TbPayment tbPayment)
    {
        return tbPaymentMapper.selectTbPaymentList(tbPayment);
    }

    /**
     * 新增支付
     * 
     * @param tbPayment 支付
     * @return 结果
     */
    @Override
    public int insertTbPayment(TbPayment tbPayment)
    {
        tbPayment.setCreateTime(DateUtils.getNowDate());
        return tbPaymentMapper.insertTbPayment(tbPayment);
    }

    /**
     * 修改支付
     * 
     * @param tbPayment 支付
     * @return 结果
     */
    @Override
    public int updateTbPayment(TbPayment tbPayment)
    {
        return tbPaymentMapper.updateTbPayment(tbPayment);
    }

    /**
     * 批量删除支付
     * 
     * @param ids 需要删除的支付主键
     * @return 结果
     */
    @Override
    public int deleteTbPaymentByIds(String ids)
    {
        return tbPaymentMapper.deleteTbPaymentByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除支付信息
     * 
     * @param id 支付主键
     * @return 结果
     */
    @Override
    public int deleteTbPaymentById(Long id)
    {
        return tbPaymentMapper.deleteTbPaymentById(id);
    }

    @Override
    public int selectCount(DateTime startTime, DateTime endTime) {
        return tbPaymentMapper.selectCount(startTime, endTime);
    }

    @Override
    public Double selectSumAmt(DateTime startTime, DateTime endTime) {
        return tbPaymentMapper.selectSumAmt(startTime, endTime);
    }
}