package com.newfiber.api.mobile.service; import com.baomidou.mybatisplus.plugins.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.newfiber.api.core.base.BaseService; import com.newfiber.api.core.bean.ReqBodyObj; import com.newfiber.api.core.bean.RespBodyObj; import com.newfiber.api.pc.dao.News.NewsDao; import com.newfiber.api.pc.model.EventsManage.News; import com.newfiber.api.pc.model.River.RiverInfoBasis; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * 新闻表 Service * @author xcc * @date 2018-12-04 16:22:00 */ @Service("newsService") public class NewsService extends BaseService<NewsDao, News> { @Autowired private NewsDao newsDao; /** 根据条件获取新闻表列表(分页) */ public List<News> queryList(Map<String, Object> map,Page<News> page){ return newsDao.queryList(map,page); } /** 根据条件获取新闻表列表(无分页) */ public List<News> queryList(Map<String, Object> map){ return newsDao.queryList(map); } /** * 查询滚动栏重要新闻的接口 * @param param * @return */ public RespBodyObj<List<News>> queryImportantNews(ReqBodyObj<News> param){ List<News> newsList = new ArrayList<>(); try { newsList = newsDao.selectImportantNews(); }catch (Exception e){ e.printStackTrace(); }finally { return RespBodyObj.ok(newsList); } } /** *查询某个区划下面所有的新闻快报 */ public PageInfo<News> queryListByDiviseNo(String divisionNo,Integer pageSize,Integer pageNo){ PageHelper.startPage(pageNo, pageSize); List<News> news = newsDao.selectListByDivision(divisionNo); PageInfo<News> result = new PageInfo<>(); if(!news.isEmpty()){ result.setList(news); } return result; } /** * 根据用户编号查询同级河道基本信息以及河长信息 * @param userNo * @return */ public List<RiverInfoBasis> selectRiversOfSameLevel(String userNo){ return newsDao.selectRiversOfSameLevel(userNo); } /** * 根据河流编号查询河道相关快报信息 * @param riverNo * @return */ public List<News> selectListByRiver(String riverNo){ return newsDao.selectListByRiver(riverNo); } public List<News> selectAll() { return newsDao.selectAll(); } }