package dao.impl; import java.util.ArrayList; import java.util.List; import java.util.Map; import org.mybatis.spring.SqlSessionTemplate; import util.PageUtil; import dao.News_Dao; import dto.News_Dto; public class News_DaoImpl implements News_Dao{ private SqlSessionTemplate sql; public SqlSessionTemplate getSql() { return sql; } public void setSql(SqlSessionTemplate sql) { this.sql = sql; } /* * @ 袁放 * 根据标题 和 发布人昵称 查询所有 新闻 */ public List<News_Dto> all_News(PageUtil page, Map<String, String> map) { List<News_Dto> res= new ArrayList<News_Dto>(); try { if(map.containsKey("userid")){ page.setTotal_info_Num(Integer.parseInt(sql.selectOne("mycount",map).toString())); page.setTotal_page_num(); page.setPage_startNum(); page.setPage_endNum(); map.put("startNum",page.getPage_startNum()+""); map.put("endNum",page.getPage_endNum()+""); res=sql.selectList("mynews",map); return res; } page.setTotal_info_Num(Integer.parseInt(sql.selectOne("totalNewsNum",map).toString())); page.setTotal_page_num(); page.setPage_startNum(); page.setPage_endNum(); map.put("startNum",page.getPage_startNum()+""); map.put("endNum",page.getPage_endNum()+""); res=sql.selectList("newsSql",map); return res; } catch (Exception e) { e.printStackTrace(); return null; } } /** * @author 袁放 * 时间 2017-3-7 * 描述 根据id查询新闻信息 */ public News_Dto findByIdNews(int id) { sql.update("updateViewNum", id); return sql.selectOne("findByIdNews",id); } public boolean deleteNews(int id) { // TODO Auto-generated method stub int i = sql.delete("deleteNews", id); if (i != 0) { return true; } else { return false; } } /** * @author 袁放 * 时间 2017-3-7 * 描述 新增新闻 */ public int add_dao_News(News_Dto dto) { // TODO Auto-generated method stub return sql.insert("addNews",dto); } public int updateNews(News_Dto dto) { int res = sql.update("updateNews", dto); return res; } }

1029162867 LV13
2022年7月7日
52321641 LV1
2022年7月4日
阿布屋脊 LV7
2022年6月7日
猫巷^ LV1
2021年12月7日
543666826 LV34
2021年11月20日
chongmingsang LV1
2021年6月30日
clz123456 LV6
2021年6月24日
panbiao LV11
2021年3月31日
1435633469 LV1
2021年1月5日
江辞123456 LV1
2020年12月15日

万重山
2024年12月18日
暂无贡献等级
lmj12345 LV2
2024年5月19日
zilatan
2023年11月25日
暂无贡献等级
飞呀飞呀飞不放 LV7
2023年8月9日
gecongkai LV8
2023年6月22日
shuidajiao
2023年6月18日
暂无贡献等级
微信网友_6509705287716864 LV2
2023年6月8日
yangbulx LV3
2023年6月7日
微信网友_6509053506113536 LV1
2023年6月7日
975525508 LV1
2023年6月5日