package com.yc.education.service.impl;/**
 * huangpan
 * 2019/11/5
 * tongnai
 */

import com.github.pagehelper.PageHelper;
import com.yc.education.mapper.NewsMapper;
import com.yc.education.model.News;
import com.yc.education.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *@ClassName NewsServiceImpl
 *@Description TODO
 *@Author QuZhangJing
 *@Date 2019/11/5 11:59
 *@Version 1.0
 */
@Service
public class NewsServiceImpl extends BaseService<News> implements NewsService {
    @Autowired
    NewsMapper newsMapper;

    @Override
    public List<News> getNews(Integer pageSize, Integer pageNum, String titleName,String startTime,String endTime) {
        PageHelper.startPage(pageNum, pageSize);
        return newsMapper.getNews(titleName,startTime,endTime );
    }

    @Override
    public News getNewsById(Integer id) {
        return newsMapper.getNewsById(id);
    }

    @Override
    public void delNewsById(Integer id) {
    newsMapper.deleteByPrimaryKey(id);
    }

    @Override
    public News selNewsId() {
        return newsMapper.selNewsId();
    }

    @Override
    public List<News> selNews() {
        return newsMapper.selNews();
    }

    @Override
    public News selNewsSize(Integer id) {
        return newsMapper.selNewsSize(id);
    }

    @Override
    public News selNewsNum(Integer id) {
        return newsMapper.selNewsNum(id);
    }
}
