package com.dcsoft.system.consume.service.impl;

import com.dcsoft.common.core.utils.DateUtils;
import com.dcsoft.system.consume.domain.ConsumeRechargeRecord;
import com.dcsoft.system.consume.mapper.ConsumeRechargeRecordMapper;
import com.dcsoft.system.consume.service.IConsumeRechargeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 充值记录Service业务层处理
 *
 * @author dcsoft
 * @date 2023-09-12
 */
@Service
public class ConsumeRechargeRecordServiceImpl implements IConsumeRechargeRecordService
{
    @Autowired
    private ConsumeRechargeRecordMapper consumeRechargeRecordMapper;

    /**
     * 查询充值记录
     *
     * @param id 充值记录主键
     * @return 充值记录
     */
    @Override
    public ConsumeRechargeRecord selectConsumeRechargeRecordById(Long id)
    {
        return consumeRechargeRecordMapper.selectConsumeRechargeRecordById(id);
    }

    /**
     * 查询充值记录列表
     *
     * @param consumeRechargeRecord 充值记录
     * @return 充值记录
     */
    @Override
    public List<ConsumeRechargeRecord> selectConsumeRechargeRecordList(ConsumeRechargeRecord consumeRechargeRecord)
    {
        return consumeRechargeRecordMapper.selectConsumeRechargeRecordList(consumeRechargeRecord);
    }

    /**
     * 新增充值记录
     *
     * @param consumeRechargeRecord 充值记录
     * @return 结果
     */
    @Override
    public int insertConsumeRechargeRecord(ConsumeRechargeRecord consumeRechargeRecord)
    {
        consumeRechargeRecord.setCreateTime(DateUtils.getNowDate());
        return consumeRechargeRecordMapper.insertConsumeRechargeRecord(consumeRechargeRecord);
    }

    /**
     * 修改充值记录
     *
     * @param consumeRechargeRecord 充值记录
     * @return 结果
     */
    @Override
    public int updateConsumeRechargeRecord(ConsumeRechargeRecord consumeRechargeRecord)
    {
        consumeRechargeRecord.setUpdateTime(DateUtils.getNowDate());
        return consumeRechargeRecordMapper.updateConsumeRechargeRecord(consumeRechargeRecord);
    }

    /**
     * 批量删除充值记录
     *
     * @param ids 需要删除的充值记录主键
     * @return 结果
     */
    @Override
    public int deleteConsumeRechargeRecordByIds(Long[] ids)
    {
        return consumeRechargeRecordMapper.deleteConsumeRechargeRecordByIds(ids);
    }

    /**
     * 删除充值记录信息
     *
     * @param id 充值记录主键
     * @return 结果
     */
    @Override
    public int deleteConsumeRechargeRecordById(Long id)
    {
        return consumeRechargeRecordMapper.deleteConsumeRechargeRecordById(id);
    }
}
