/**
* 分页
*/
@RequestMapping("/newsPage")
@ResponseBody
public JSONObject newsPage(Integer articleId,Integer moduleId){
PageData pd = new PageData();
JSONObject json = new JSONObject();
try {
pd.put("moduleId", moduleId);
List<Integer> newspage = newsService.Newslist(pd);
if(newspage!=null){
pd.put("id", articleId);
json.put("article", newsService.findById(pd));
for(int i=0;i<newspage.size();i++){
if(newspage.get(i).intValue()==articleId.intValue()){
if(i==0){
json.put("lastArticle", "");
pd.put("id",newspage.get(i+1) );
json.put("nextArticle", newsService.findById(pd));
}else if(i==newspage.size()-1){
json.put("nextArticle", "");
pd.put("id",newspage.get(i-1) );
json.put("lastArticle", newsService.findById(pd));
}else{
pd.put("id",newspage.get(i+1) );
json.put("nextArticle", newsService.findById(pd));
pd.put("id",newspage.get(i-1) );
json.put("lastArticle", newsService.findById(pd));
}
}
}
}
json.put("code", 200);
json.put("msg", "success");
} catch (Exception e) {
json.put("code", 400);
json.put("msg", "系统异常");
}
return json;
}