package com.ruoyi.business.service.impl;

import java.util.List;

import cn.hutool.core.date.DateTime;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.ReRewardMapper;
import com.ruoyi.business.domain.ReReward;
import com.ruoyi.business.service.IReRewardService;
import com.ruoyi.common.core.text.Convert;

/**
 * 我的悬赏Service业务层处理
 * 
 * @author xiatao
 * @date 2022-01-18
 */
@Service
public class ReRewardServiceImpl implements IReRewardService 
{
    @Autowired
    private ReRewardMapper reRewardMapper;

    /**
     * 查询我的悬赏
     * 
     * @param rewardId 我的悬赏主键
     * @return 我的悬赏
     */
    @Override
    public ReReward selectReRewardByRewardId(Long rewardId)
    {
        return reRewardMapper.selectReRewardByRewardId(rewardId);
    }

    /**
     * 查询我的悬赏列表
     * 
     * @param reReward 我的悬赏
     * @return 我的悬赏
     */
    @Override
    public List<ReReward> selectReRewardList(ReReward reReward)
    {
        return reRewardMapper.selectReRewardList(reReward);
    }

    /**
     * 新增我的悬赏
     * 
     * @param reReward 我的悬赏
     * @return 结果
     */
    @Override
    public int insertReReward(ReReward reReward)
    {
        reReward.setCreateTime(DateUtils.getNowDate());
        return reRewardMapper.insertReReward(reReward);
    }

    /**
     * 修改我的悬赏
     * 
     * @param reReward 我的悬赏
     * @return 结果
     */
    @Override
    public int updateReReward(ReReward reReward)
    {
        return reRewardMapper.updateReReward(reReward);
    }

    /**
     * 批量删除我的悬赏
     * 
     * @param rewardIds 需要删除的我的悬赏主键
     * @return 结果
     */
    @Override
    public int deleteReRewardByRewardIds(String rewardIds)
    {
        return reRewardMapper.deleteReRewardByRewardIds(Convert.toStrArray(rewardIds));
    }

    /**
     * 删除我的悬赏信息
     * 
     * @param rewardId 我的悬赏主键
     * @return 结果
     */
    @Override
    public int deleteReRewardByRewardId(Long rewardId)
    {
        return reRewardMapper.deleteReRewardByRewardId(rewardId);
    }

    @Override
    public int selectCount(DateTime startTime, DateTime endTime) {
        return reRewardMapper.selectCount(startTime, endTime);
    }
}
