package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.domain.SysRealtimeNews;
import com.ruoyi.system.mapper.SysRealtimeNewsMapper;
import com.ruoyi.system.service.ISysRealtimeNewsService;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.DateUtils;

@Service
public class SysRealtimeNewsServiceImpl implements ISysRealtimeNewsService
{
    @Autowired
    private SysRealtimeNewsMapper sysRealtimeNewsMapper;

    @Override
    public SysRealtimeNews selectSysRealtimeNewsById(Long id)
    {
        return sysRealtimeNewsMapper.selectSysRealtimeNewsById(id);
    }

    @Override
    public List<SysRealtimeNews> selectSysRealtimeNewsList(SysRealtimeNews sysRealtimeNews)
    {
        return sysRealtimeNewsMapper.selectSysRealtimeNewsList(sysRealtimeNews);
    }

    @Override
    public int insertSysRealtimeNews(SysRealtimeNews sysRealtimeNews)
    {
        sysRealtimeNews.setCreateBy(SecurityUtils.getUsername());
        sysRealtimeNews.setCreateTime(DateUtils.getNowDate());
        return sysRealtimeNewsMapper.insertSysRealtimeNews(sysRealtimeNews);
    }

    @Override
    public int updateSysRealtimeNews(SysRealtimeNews sysRealtimeNews)
    {
        sysRealtimeNews.setUpdateBy(SecurityUtils.getUsername());
        sysRealtimeNews.setUpdateTime(DateUtils.getNowDate());
        return sysRealtimeNewsMapper.updateSysRealtimeNews(sysRealtimeNews);
    }

    @Override
    public int deleteSysRealtimeNewsByIds(Long[] ids)
    {
        return sysRealtimeNewsMapper.deleteSysRealtimeNewsByIds(ids);
    }

    @Override
    public int deleteSysRealtimeNewsById(Long id)
    {
        return sysRealtimeNewsMapper.deleteSysRealtimeNewsById(id);
    }

    @Override
    public int updateTopStatus(Long id, String isTop)
    {
        return sysRealtimeNewsMapper.updateTopStatus(id, isTop);
    }
}
