package com.ff.common.service.impl;

import java.math.BigDecimal;
import java.util.List;
import com.ff.base.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ff.common.mapper.TenantGameQuotaFlowMapper;
import com.ff.common.domain.TenantGameQuotaFlow;
import com.ff.common.service.ITenantGameQuotaFlowService;

/**
 * 租户游戏额度流水Service业务层处理
 *
 * @author shi
 * @date 2025-02-12
 */
@Service
public class TenantGameQuotaFlowServiceImpl implements ITenantGameQuotaFlowService
{
    @Autowired
    private TenantGameQuotaFlowMapper tenantGameQuotaFlowMapper;

    /**
     * 查询租户游戏额度流水
     *
     * @param id 租户游戏额度流水主键
     * @return 租户游戏额度流水
     */
    @Override
    public TenantGameQuotaFlow selectTenantGameQuotaFlowById(Long id)
    {
        return tenantGameQuotaFlowMapper.selectTenantGameQuotaFlowById(id);
    }

    /**
     * 查询租户游戏额度流水列表
     *
     * @param tenantGameQuotaFlow 租户游戏额度流水
     * @return 租户游戏额度流水
     */
    @Override
    public List<TenantGameQuotaFlow> selectTenantGameQuotaFlowList(TenantGameQuotaFlow tenantGameQuotaFlow)
    {
        return tenantGameQuotaFlowMapper.selectTenantGameQuotaFlowList(tenantGameQuotaFlow);
    }

    /**
     * 新增租户游戏额度流水
     *
     * @param tenantGameQuotaFlow 租户游戏额度流水
     * @return 结果
     */
    @Override
    public int insertTenantGameQuotaFlow(TenantGameQuotaFlow tenantGameQuotaFlow)
    {
        tenantGameQuotaFlow.setCreateTime(DateUtils.getNowDate());
        return tenantGameQuotaFlowMapper.insertTenantGameQuotaFlow(tenantGameQuotaFlow);
    }

    /**
     * 修改租户游戏额度流水
     *
     * @param tenantGameQuotaFlow 租户游戏额度流水
     * @return 结果
     */
    @Override
    public int updateTenantGameQuotaFlow(TenantGameQuotaFlow tenantGameQuotaFlow)
    {
        tenantGameQuotaFlow.setUpdateTime(DateUtils.getNowDate());
        return tenantGameQuotaFlowMapper.updateTenantGameQuotaFlow(tenantGameQuotaFlow);
    }

    /**
     * 批量删除租户游戏额度流水
     *
     * @param ids 需要删除的租户游戏额度流水主键
     * @return 结果
     */
    @Override
    public int deleteTenantGameQuotaFlowByIds(Long[] ids)
    {
        return tenantGameQuotaFlowMapper.deleteTenantGameQuotaFlowByIds(ids);
    }

    /**
     * 删除租户游戏额度流水信息
     *
     * @param id 租户游戏额度流水主键
     * @return 结果
     */
    @Override
    public int deleteTenantGameQuotaFlowById(Long id)
    {
        return tenantGameQuotaFlowMapper.deleteTenantGameQuotaFlowById(id);
    }

    /**
     * 通过会员id获取余额
     *
     * @param tenantGameQuotaFlow 租户游戏配额流
     * @return {@link BigDecimal }
     */
    @Override
    public BigDecimal getBalanceByMemberId(TenantGameQuotaFlow tenantGameQuotaFlow) {
        return tenantGameQuotaFlowMapper.getBalanceByMemberId(tenantGameQuotaFlow);
    }
}
