package com.yiqi.recharge.service.impl;

import java.util.List;
import com.yiqi.common.utils.DateUtils;
import com.yiqi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yiqi.recharge.mapper.RechargeTypeMapper;
import com.yiqi.recharge.domain.RechargeType;
import com.yiqi.recharge.service.IRechargeTypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * 充值规则管理Service业务层处理
 *
 * @author xiaohei
 * @date 2023-08-28
 */
@Service
public class RechargeTypeServiceImpl extends ServiceImpl<RechargeTypeMapper,RechargeType> implements IRechargeTypeService {

    /**
     * 查询充值规则管理
     *
     * @param id 充值规则管理主键
     * @return 充值规则管理
     */
    @Override
    public RechargeType selectRechargeTypeById(Long id) {
        return baseMapper.selectRechargeTypeById(id);
    }

    /**
     * 查询充值规则管理列表
     *
     * @param rechargeType 充值规则管理
     * @return 充值规则管理
     */
    @Override
    public List<RechargeType> selectRechargeTypeList(RechargeType rechargeType) {
        return baseMapper.selectRechargeTypeList(rechargeType);
    }

    /**
     * 新增充值规则管理
     *
     * @param rechargeType 充值规则管理
     * @return 结果
     */
    @Override
    public int insertRechargeType(RechargeType rechargeType) {
        rechargeType.setCreateTime(DateUtils.getNowDate());
        return baseMapper.insertRechargeType(rechargeType);
    }

    /**
     * 修改充值规则管理
     *
     * @param rechargeType 充值规则管理
     * @return 结果
     */
    @Override
    public int updateRechargeType(RechargeType rechargeType) {
        rechargeType.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateRechargeType(rechargeType);
    }

    /**
     * 批量删除充值规则管理
     *
     * @param ids 需要删除的充值规则管理主键
     * @return 结果
     */
    @Override
    public int deleteRechargeTypeByIds(Long[] ids) {
        return baseMapper.deleteRechargeTypeByIds(ids);
    }

    /**
     * 删除充值规则管理信息
     *
     * @param id 充值规则管理主键
     * @return 结果
     */
    @Override
    public int deleteRechargeTypeById(Long id) {
        return baseMapper.deleteRechargeTypeById(id);
    }

    /**
     * 修改充值规则管理状态
     *
     * @param rechargeType 充值规则管理
     * @return 结果
     */
    @Override
    public int updateRechargeTypeStatus(RechargeType rechargeType) {
        rechargeType.setUpdateById(SecurityUtils.getUserId());
        rechargeType.setUpdateBy(SecurityUtils.getUsername());
        rechargeType.setUpdateTime(DateUtils.getNowDate());
        return baseMapper.updateRechargeType(rechargeType);
    }


}
