package com.ruoyi.cs.service.impl;

import java.util.List;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.cs.mapper.CsPaymentDetailsMapper;
import com.ruoyi.cs.domain.CsPaymentDetails;
import com.ruoyi.cs.service.ICsPaymentDetailsService;

import javax.annotation.Resource;

/**
 * 充值付费明细Service业务层处理
 *
 * @author ruoyi
 * @date 2024-06-20
 */
@Service
public class CsPaymentDetailsServiceImpl implements ICsPaymentDetailsService
{
    @Resource
    private CsPaymentDetailsMapper csPaymentDetailsMapper;

    /**
     * 查询充值付费明细
     *
     * @param paymentDetailsId 充值付费明细主键
     * @return 充值付费明细
     */
    @Override
    public CsPaymentDetails selectCsPaymentDetailsByPaymentDetailsId(String paymentDetailsId)
    {
        return csPaymentDetailsMapper.selectCsPaymentDetailsByPaymentDetailsId(paymentDetailsId);
    }

    /**
     * 查询充值付费明细列表
     *
     * @param csPaymentDetails 充值付费明细
     * @return 充值付费明细
     */
    @Override
    public List<CsPaymentDetails> selectCsPaymentDetailsList(CsPaymentDetails csPaymentDetails)
    {
        return csPaymentDetailsMapper.selectCsPaymentDetailsList(csPaymentDetails);
    }

    /**
     * 新增充值付费明细
     *
     * @param csPaymentDetails 充值付费明细
     * @return 结果
     */
    @Override
    public int insertCsPaymentDetails(CsPaymentDetails csPaymentDetails)
    {
        csPaymentDetails.setPaymentDetailsId(IdUtil.getSnowflakeNextIdStr());
        csPaymentDetails.setCreateAt(DateUtils.getTime());
        csPaymentDetails.setDelFlag("0");
        return csPaymentDetailsMapper.insertCsPaymentDetails(csPaymentDetails);
    }

    /**
     * 修改充值付费明细
     *
     * @param csPaymentDetails 充值付费明细
     * @return 结果
     */
    @Override
    public int updateCsPaymentDetails(CsPaymentDetails csPaymentDetails)
    {
        csPaymentDetails.setUpdateAt(DateUtils.getTime());
        return csPaymentDetailsMapper.updateCsPaymentDetails(csPaymentDetails);
    }

    /**
     * 批量删除充值付费明细
     *
     * @param paymentDetailsIds 需要删除的充值付费明细主键
     * @return 结果
     */
    @Override
    public int deleteCsPaymentDetailsByPaymentDetailsIds(String[] paymentDetailsIds)
    {
        return csPaymentDetailsMapper.deleteCsPaymentDetailsByPaymentDetailsIds(paymentDetailsIds);
    }

    /**
     * 删除充值付费明细信息
     *
     * @param paymentDetailsId 充值付费明细主键
     * @return 结果
     */
    @Override
    public int deleteCsPaymentDetailsByPaymentDetailsId(String paymentDetailsId)
    {
        return csPaymentDetailsMapper.deleteCsPaymentDetailsByPaymentDetailsId(paymentDetailsId);
    }
}
