package com.ruoyi.hezhi.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.hezhi.domain.TbDownload;
import com.ruoyi.hezhi.mapper.TbDownloadMapper;
import com.ruoyi.hezhi.service.ITbDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 在线下载Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-30
 */
@Service
public class TbDownloadServiceImpl implements ITbDownloadService
{
    @Autowired
    private TbDownloadMapper tbDownloadMapper;

    /**
     * 查询在线下载
     *
     * @param downloadId 在线下载主键
     * @return 在线下载
     */
    @Override
    public TbDownload selectTbDownloadByDownloadId(Long downloadId)
    {
        return tbDownloadMapper.selectTbDownloadByDownloadId(downloadId);
    }

    /**
     * 查询在线下载列表
     *
     * @param tbDownload 在线下载
     * @return 在线下载
     */
    @Override
    public List<TbDownload> selectTbDownloadList(TbDownload tbDownload)
    {
        return tbDownloadMapper.selectTbDownloadList(tbDownload);
    }

    /**
     * 新增在线下载
     *
     * @param tbDownload 在线下载
     * @return 结果
     */
    @Override
    public int insertTbDownload(TbDownload tbDownload)
    {
        tbDownload.setCreateTime(DateUtils.getNowDate());
        return tbDownloadMapper.insertTbDownload(tbDownload);
    }

    /**
     * 修改在线下载
     *
     * @param tbDownload 在线下载
     * @return 结果
     */
    @Override
    public int updateTbDownload(TbDownload tbDownload)
    {
        tbDownload.setUpdateTime(DateUtils.getNowDate());
        return tbDownloadMapper.updateTbDownload(tbDownload);
    }

    /**
     * 批量删除在线下载
     *
     * @param downloadIds 需要删除的在线下载主键
     * @return 结果
     */
    @Override
    public int deleteTbDownloadByDownloadIds(Long[] downloadIds)
    {
        return tbDownloadMapper.deleteTbDownloadByDownloadIds(downloadIds);
    }

    /**
     * 删除在线下载信息
     *
     * @param downloadId 在线下载主键
     * @return 结果
     */
    @Override
    public int deleteTbDownloadByDownloadId(Long downloadId)
    {
        return tbDownloadMapper.deleteTbDownloadByDownloadId(downloadId);
    }

    /**
     * 在线下载列表
     *
     * @param params 参数
     * @return 在线下载列表列表
     */
    @Override
    public List<Map<String, Object>> getDownloadList(Map<String, Object> params) {
        return tbDownloadMapper.getDownloadList(params);
    }
}
