package com.pb.news.service.impl;
import java.util.List;
import com.pb.news.dao.NewsDao;
import com.pb.news.entity.News;
import com.pb.news.service.NewsService;
public class NewsServiceImpl implements NewsService {
private NewsDao newsDao;
public NewsDao getNewsDao() {
return newsDao;
}
public void setNewsDao(NewsDao newsDao) {
this.newsDao = newsDao;
}
//1.更新选择新闻
@Override
public boolean updateNews(News news) {
return newsDao.update(news);
}
//2.添加新闻
@Override
public boolean addNews(News news) {
return newsDao.add(news);
}
//3.册除新闻
@Override
public boolean deleteNews(int id) {
return newsDao.delete(id);
}
//4.查询新闻信息
@Override
public List<News> getNewsList() {
return newsDao.getNewsList();
}
//5.通过新闻ID获取新闻
@Override
public News getNewsById(int id) {
return newsDao.getNewsById(id);
}
//获取新闻总数量
@Override
public int getTotalCount() {
return newsDao.getTotalCount();
}
//分页获取新闻信息
@Override
public List<News> getPageNewsList(int pageNo, int pageSize) {
return newsDao.getPageNewsList(pageNo, pageSize);
}
}