package com.game.business.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;

import com.game.common.annotation.DataSource;
import com.game.common.enums.DataSourceType;
import com.game.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.game.business.mapper.FinTranRecordMapper;
import com.game.business.domain.FinTranRecord;
import com.game.business.service.IFinTranRecordService;

/**
 * 消费记录Service业务层处理
 *
 * @author game
 * @date 2024-06-18
 */
@Service
@DS("slave")
public class FinTranRecordServiceImpl extends ServiceImpl<FinTranRecordMapper, FinTranRecord> implements IFinTranRecordService {

    @Autowired
    private FinTranRecordMapper finTranRecordMapper;

    /**
     * 查询消费记录
     *
     * @param id 消费记录主键
     * @return 消费记录
     */
    @Override
    public FinTranRecord selectFinTranRecordById(Long id) {
        return finTranRecordMapper.selectFinTranRecordById(id);
    }

    /**
     * 查询消费记录列表
     *
     * @param finTranRecord 消费记录
     * @return 消费记录
     */
    @Override
    public List<FinTranRecord> selectFinTranRecordList(FinTranRecord finTranRecord) {
        return finTranRecordMapper.selectFinTranRecordList(finTranRecord);
    }

    /**
     * 新增消费记录
     *
     * @param finTranRecord 消费记录
     * @return 结果
     */
    @Override
    public int insertFinTranRecord(FinTranRecord finTranRecord) {
                finTranRecord.setCreateTime(DateUtils.getNowDate());
            return finTranRecordMapper.insertFinTranRecord(finTranRecord);
    }

    /**
     * 修改消费记录
     *
     * @param finTranRecord 消费记录
     * @return 结果
     */
    @Override
    public int updateFinTranRecord(FinTranRecord finTranRecord) {
        return finTranRecordMapper.updateFinTranRecord(finTranRecord);
    }

    /**
     * 批量删除消费记录
     *
     * @param ids 需要删除的消费记录主键
     * @return 结果
     */
    @Override
    public int deleteFinTranRecordByIds(Long[] ids) {
        return finTranRecordMapper.deleteFinTranRecordByIds(ids);
    }

    /**
     * 删除消费记录信息
     *
     * @param id 消费记录主键
     * @return 结果
     */
    @Override
    public int deleteFinTranRecordById(Long id) {
        return finTranRecordMapper.deleteFinTranRecordById(id);
    }
}