package com.ssm.maven.core.admin; import com.ssm.maven.core.entity.Article; import com.ssm.maven.core.entity.PageBean; import com.ssm.maven.core.service.ArticleService; import com.ssm.maven.core.util.DateUtil; import com.ssm.maven.core.util.ResponseUtil; import com.ssm.maven.core.util.StringUtil; import net.sf.json.JSONArray; import net.sf.json.JSONobject; import org.apache.log4j.Logger; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping(“/article“) public class ArticleController { @Resource private ArticleService articleService; private static final long serialVersionUID = 1L; private static final Logger log = Logger.getLogger(ArticleController.class);// 日志文件 /** * 查找相应的数据集合 * * @param page * @param rows * @param article * @param response * @return * @throws Exception */ @RequestMapping(“/list“) public String list( @RequestParam(value = “page“ required = false) String page @RequestParam(value = “rows“ required = false) String rows Article article HttpServletResponse response) throws Exception { Mapject> map = new HashMapject>(); if (page != null && rows != null) { PageBean pageBean = new PageBean(Integer.parseInt(page) Integer.parseInt(rows)); map.put(“start“ pageBean.getStart()); map.put(“size“ pageBean.getPageSize()); } if (article != null) { map.put(“articletitle“ StringUtil.formatLike(article.getArticletitle())); } List articleList = articleService.findArticle(map); Long total = articleService.getTotalArticle(map); JSONobject result = new JSONobject(); JSONArray jsonArray = JSONArray.fromobject(articleList); result.put(“rows“ jsonArray); result.put(“total“ total); ResponseUtil.write(response result); log.info(“request: article/list map: “ + map.toString()); return null; } /** * 保存或修改 * * @param article * @param response * @return * @throws Exception */ @RequestMapping(“/save“) public String save(Article article HttpServletResponse response) throws Exception { int resultTotal = 0; if (article.getId() == null) { article.setArticleCreateDate(DateUtil.getCurrentDateStr()); resultTotal = articleService.addArticle(article); } else { resultTotal = articleService.updateArticle(article); } JSONobject result = new JSONobject(); if (resultTotal > 0) { result.put(“success“ true); } else { result.put(“success“ false); } ResponseUtil.write(response result); log.info(“request: article/save “ + article.toString()); return null; } /** * 删除 * * @param ids
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-04-14 10:02 ssm-maven\
文件 6148 2017-04-11 22:09 ssm-maven\.DS_Store
目录 0 2017-04-14 10:03 __MACOSX\
目录 0 2017-04-14 10:03 __MACOSX\ssm-maven\
文件 120 2017-04-11 22:09 __MACOSX\ssm-maven\._.DS_Store
目录 0 2017-04-14 10:02 ssm-maven\.idea\
文件 9 2017-02-28 18:13 ssm-maven\.idea\.name
目录 0 2017-04-12 14:47 ssm-maven\.idea\artifacts\
文件 286 2017-02-28 18:15 ssm-maven\.idea\artifacts\ssm_maven_war.xm
l 文件 4400 2017-04-12 14:47 ssm-maven\.idea\artifacts\ssm_maven_war_exploded.xml 文件 1183 2017-02-28 18:15 ssm-maven\.idea\compiler.xml 目录 0 2017-02-28 18:13 ssm-maven\.idea\copyright\ 文件 74 2017-02-28 18:13 ssm-maven\.idea\copyright\profiles_settings.xml 文件 3711 2017-04-13 17:20 ssm-maven\.idea\encodings.xml 目录 0 2017-04-12 14:47 ssm-maven\.idea\libraries\ 文件 502 2017-02-28 18:39 ssm-maven\.idea\libraries\Maven__aopalliance_aopalliance_1_0.xml 文件 637 2017-04-12 14:47 ssm-maven\.idea\libraries\Maven__cn_songxinqiang_com_baidu_ueditor_1_1_2_edit_1_0.xml 文件 495 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__com_alibaba_fastjson_1_2_4.xml 文件 632 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_annotations_2_5_0.xml 文件 583 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_core_2_5_3.xml 文件 611 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_databind_2_5_3.xml 文件 582 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__commons_beanutils_commons_beanutils_1_7_0.xml 文件 548 2017-04-12 14:47 ssm-maven\.idea\libraries\Maven__commons_codec_commons_codec_1_9.xml 文件 604 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__commons_collections_commons_collections_3_2_1.xml 文件 617 2017-04-12 14:47 ssm-maven\.idea\libraries\Maven__commons_fileupload_commons_fileupload_1_3_1.xml 文件 491 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__commons_io_commons_io_2_4.xml 文件 513 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__commons_lang_commons_lang_2_6.xml 文件 560 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__commons_logging_commons_logging_1_1_3.xml 文件 566 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__javax_servlet_javax_servlet_api_3_1_0.xml 文件 498 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__javax_servlet_jsp_jsp_api_2_2.xml 文件 461 2017-02-28 18:15 ssm-maven\.idea\libraries\Maven__javax_servlet_jstl_1_2.xml ............此处省略1217个文件信息
评论
共有 条评论