Browse Source

规范方法

msgroup 4 năm trước cách đây
mục cha
commit
1436686176

+ 1 - 1
src/main/java/net/mingsoft/cms/action/CategoryAction.java

@@ -104,7 +104,7 @@ public class CategoryAction extends BaseAction {
     	@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
     	@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
     })
-	@RequestMapping("/list")
+	@RequestMapping(value="/list",method = {RequestMethod.GET, RequestMethod.POST})
 	@ResponseBody
 	public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
 		BasicUtil.startPage();

+ 10 - 10
src/main/java/net/mingsoft/cms/action/ContentAction.java

@@ -57,11 +57,11 @@ import java.util.List;
 @Controller("cmsContentAction")
 @RequestMapping("/${ms.manager.path}/cms/content")
 public class ContentAction extends BaseAction {
-	
-	
+
+
 	/**
 	 * 注入文章业务层
-	 */	
+	 */
 	@Autowired
 	private IContentBiz contentBiz;
 
@@ -107,14 +107,14 @@ public class ContentAction extends BaseAction {
     	@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
     	@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
     })
-	@RequestMapping("/list")
+	@PostMapping("/list")
 	@ResponseBody
 	public ResultData list(@ModelAttribute @ApiIgnore ContentBean content, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
 		BasicUtil.startPage();
 		List contentList = contentBiz.query(content);
 		return ResultData.build().success(new EUListBean(contentList,(int) BasicUtil.endPage(contentList).getTotal()));
 	}
-	
+
 	/**
 	 * 返回编辑界面content_form
 	 */
@@ -157,7 +157,7 @@ public class ContentAction extends BaseAction {
 		}
 		return ResultData.build().success(list.size() > 0 ? list.get(0) : null);
 	}
-	
+
 	@ApiOperation(value = "保存文章列表接口")
 	 @ApiImplicitParams({
     	@ApiImplicitParam(name = "contentTitle", value = "文章标题", required =true,paramType="query"),
@@ -214,7 +214,7 @@ public class ContentAction extends BaseAction {
 		contentBiz.save(content);
 		return ResultData.build().success(content);
 	}
-	
+
 	/**
 	 * @param contents 文章实体
 	 */
@@ -265,7 +265,7 @@ public class ContentAction extends BaseAction {
 	@RequiresPermissions("cms:content:update")
 	public ResultData update(@ModelAttribute @ApiIgnore ContentEntity content, HttpServletResponse response,
                              HttpServletRequest request) {
-		//验证文章标题的值是否合法			
+		//验证文章标题的值是否合法
 		if(StringUtil.isBlank(content.getContentTitle())){
 			return ResultData.build().error(getResString("err.empty", this.getResString("content.title")));
 		}
@@ -278,7 +278,7 @@ public class ContentAction extends BaseAction {
 		if(!StringUtil.checkLength(content.getContentSource()+"", 0, 200)){
 			return ResultData.build().error(getResString("err.length", this.getResString("content.source"), "0", "200"));
 		}
-		//验证发布时间的值是否合法			
+		//验证发布时间的值是否合法
 		if(StringUtil.isBlank(content.getContentDatetime())){
 			return ResultData.build().error(getResString("err.empty", this.getResString("content.datetime")));
 		}
@@ -290,5 +290,5 @@ public class ContentAction extends BaseAction {
 	}
 
 
-		
+
 }

+ 6 - 8
src/main/java/net/mingsoft/cms/action/GeneraterAction.java

@@ -51,9 +51,7 @@ import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -111,7 +109,7 @@ public class GeneraterAction extends BaseAction {
      *
      * @return
      */
-    @RequestMapping("/index")
+    @GetMapping("/index")
     public String index(HttpServletRequest request, ModelMap model) {
         return "/cms/generate/index";
     }
@@ -122,7 +120,7 @@ public class GeneraterAction extends BaseAction {
      * @param request
      * @param response
      */
-    @RequestMapping("/generateIndex")
+    @RequestMapping(value="/generateIndex",method = {RequestMethod.GET, RequestMethod.POST})
     @RequiresPermissions("cms:generate:index")
     @LogAnn(title = "生成主页", businessType = BusinessTypeEnum.UPDATE)
     @ResponseBody
@@ -150,7 +148,7 @@ public class GeneraterAction extends BaseAction {
      * @param response
      * @param categoryId
      */
-    @RequestMapping("/{categoryId}/genernateColumn")
+    @RequestMapping(value="/{categoryId}/genernateColumn",method = {RequestMethod.GET, RequestMethod.POST})
     @LogAnn(title = "生成栏目", businessType = BusinessTypeEnum.UPDATE)
     @RequiresPermissions("cms:generate:column")
     @ResponseBody
@@ -216,7 +214,7 @@ public class GeneraterAction extends BaseAction {
      * @param response
      * @param columnId
      */
-    @RequestMapping("/{columnId}/generateArticle")
+    @RequestMapping(value="/{columnId}/generateArticle",method = {RequestMethod.GET, RequestMethod.POST})
     @RequiresPermissions("cms:generate:article")
     @LogAnn(title = "生成文章", businessType = BusinessTypeEnum.UPDATE)
     @ResponseBody
@@ -273,7 +271,7 @@ public class GeneraterAction extends BaseAction {
      * @param request
      * @return
      */
-    @RequestMapping("/{position}/viewIndex")
+    @RequestMapping(value="/{position}/viewIndex",method = {RequestMethod.GET, RequestMethod.POST})
     public String viewIndex(HttpServletRequest request, @PathVariable String position, HttpServletResponse response) {
         AppEntity app = BasicUtil.getApp();
         // 组织主页预览地址

+ 6 - 11
src/main/java/net/mingsoft/cms/action/web/CategoryAction.java

@@ -37,13 +37,8 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.ui.ModelMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 
 import net.mingsoft.cms.biz.ICategoryBiz;
 import net.mingsoft.cms.entity.CategoryEntity;
@@ -71,11 +66,11 @@ import springfox.documentation.annotations.ApiIgnore;
 @Controller("WebcmsCategoryAction")
 @RequestMapping("/cms/category")
 public class CategoryAction extends net.mingsoft.cms.action.BaseAction{
-	
-	
+
+
 	/**
 	 * 注入分类业务层
-	 */	
+	 */
 	@Autowired
 	private ICategoryBiz categoryBiz;
 
@@ -108,14 +103,14 @@ public class CategoryAction extends net.mingsoft.cms.action.BaseAction{
     	@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
     	@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
     })
-	@RequestMapping("/list")
+	@RequestMapping(value="/list",method = {RequestMethod.GET, RequestMethod.POST})
 	@ResponseBody
 	public ResultData list(@ModelAttribute @ApiIgnore CategoryEntity category,HttpServletResponse response, HttpServletRequest request,@ApiIgnore ModelMap model,BindingResult result) {
 		BasicUtil.startPage();
 		List categoryList = categoryBiz.query(category);
 		return ResultData.build().success(new EUListBean(categoryList,(int)BasicUtil.endPage(categoryList).getTotal()));
 	}
-	
+
 
 	/**
 	 * 获取分类

+ 2 - 6
src/main/java/net/mingsoft/cms/action/web/ContentAction.java

@@ -38,11 +38,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.validation.BindingResult;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.ModelAttribute;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.*;
 import springfox.documentation.annotations.ApiIgnore;
 
 import javax.servlet.http.HttpServletRequest;
@@ -97,7 +93,7 @@ public class ContentAction extends net.mingsoft.cms.action.BaseAction{
     	@ApiImplicitParam(name = "del", value = "删除标记", required =false,paramType="query"),
     	@ApiImplicitParam(name = "id", value = "编号", required =false,paramType="query"),
     })
-	@RequestMapping("/list")
+	@PostMapping("/list")
 	@ResponseBody
 	public ResultData list(@ModelAttribute @ApiIgnore ContentBean content, HttpServletResponse response, HttpServletRequest request, @ApiIgnore ModelMap model, BindingResult result) {
 		BasicUtil.startPage();

+ 1 - 1
src/main/java/net/mingsoft/cms/action/web/MCmsAction.java

@@ -317,7 +317,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
      * @param request  搜索id
      * @param response
      */
-    @RequestMapping(value = "search")
+    @RequestMapping(value = "search",method = {RequestMethod.GET, RequestMethod.POST})
     @ResponseBody
     public String search(HttpServletRequest request, HttpServletResponse response) {
         //设置分页类

+ 1 - 1
src/main/webapp/WEB-INF/manager/cms/content/main.ftl

@@ -284,7 +284,7 @@
                 };
                 var form = JSON.parse(JSON.stringify(that.form));
 
-                if (form.contentType.length > 0) {
+                if (form.contentType!=null && form.contentType.length > 0) {
                     form.contentType = form.contentType.join(',');
                 }