Map
map.put(“articleList“?articleList);
map.put(“page“?page);
json?=?this.setJson(true?“成功“?map);
}?catch?(Exception?e)?{
json?=?this.setJson(false?“異常“?n
package?com.inxedu.os.app.controller.article;
import?com.inxedu.os.common.controller.baseController;
import?com.inxedu.os.common.entity.PageEntity;
import?com.inxedu.os.edu.entity.article.Article;
import?com.inxedu.os.edu.entity.article.QueryArticle;
import?com.inxedu.os.edu.service.article.ArticleService;
import?org.apache.log4j.Logger;
import?org.springframework.beans.factory.annotation.Autowired;
import?org.springframework.stereotype.Controller;
import?org.springframework.web.bind.annotation.ModelAttribute;
import?org.springframework.web.bind.annotation.RequestMapping;
import?org.springframework.web.bind.annotation.ResponseBody;
import?javax.servlet.http.HttpServletRequest;
import?java.text.SimpleDateFormat;
import?java.util.Date;
import?java.util.HashMap;
import?java.util.List;
import?java.util.Map;
/**
?*?@author?www.inxedu.com
?*/
@Controller
@RequestMapping(“/webapp“)
public?class?AppArticleController?extends?baseController?{
private?static?Logger?logger?=?Logger.getLogger(AppArticleController.class);
@Autowired
private?ArticleService?articleService;
/**
?*?咨詢列表
?*/
@RequestMapping(“/showlist“)
@ResponseBody
public?Mapject>?showArticleList(HttpServletRequest?request?@ModelAttribute(“page“)?PageEntity?page)?{
Mapject>?json?=?new?HashMapject>();
SimpleDateFormat?sdf?=?new?SimpleDateFormat(“yyyy-MM-dd?HH:mm:ss“);
try?{
String?currentPage?=?request.getParameter(“currentPage“);//?當前頁
if?(currentPage?==?null?||?currentPage.trim().equals(““))?{
json?=?this.setJson(false?“頁碼不能為空“?null);
return?json;
}
page.setCurrentPage(Integer.parseInt(currentPage));//?當前頁
page.setPageSize(10);//?每頁多少條數據
String?pageSize?=?request.getParameter(“pageSize“);
if?(pageSize?!=?null)?{
page.setPageSize(Integer.parseInt(pageSize));
}
String?beginTime?=?request.getParameter(“beginCreateTime“);
String?endTime?=?request.getParameter(“endCreateTime“);
Date?beginCreateTime?=?null;
Date?endCreateTime?=?null;
if?(beginTime?!=?null?&&?!beginTime.equals(““))?{
beginCreateTime?=?sdf.parse(beginTime);//?開始添加時間
}
if?(endTime?!=?null?&&?!endTime.equals(““))?{
endCreateTime?=?sdf.parse(endTime);//?結束添加時間
}
String?queryKey?=?request.getParameter(“queryKey“);//?標題或文章來源
/*?===================查詢條件==================?*/
QueryArticle?queryArticle?=?new?QueryArticle();
queryArticle.setType(2);//?文章類型?2文章
queryArticle.setBeginCreateTime(beginCreateTime);//?開始添加時間
queryArticle.setEndCreateTime(endCreateTime);//?結束添加時間
queryArticle.setQueryKey(queryKey);//?標題或文章來源
List?articleList?=?articleService.queryArticlePage(queryArticle?page);
Mapject>?map?=?new?HashMapject>();
map.put(“articleList“?articleList);
map.put(“page“?page);
json?=?this.setJson(true?“成功“?map);
}?catch?(Exception?e)?{
json?=?this.setJson(false?“異常“?n
共有 條評論