洪城义警-正式版后台
zengh
2021-07-16 eceb0c8f9480995c8a17f1d093f4e658268b234c
src/main/java/org/springblade/modules/article/controller/ArticleController.java
@@ -11,10 +11,14 @@
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.article.entity.Article;
import org.springblade.modules.article.service.ArticleService;
import org.springblade.modules.article.vo.ArticleVo;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.Date;
/**
 * @author zhongrj
@@ -37,7 +41,7 @@
    * @return
    */
   @GetMapping("/page")
   public R<IPage<Article>> page(HttpServletResponse response, Article article, Query query){
   public R<IPage<Article>> page(HttpServletResponse response, ArticleVo article, Query query){
      response.setHeader("Access-Control-Allow-Origin", "*");
      response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
      response.setHeader("Access-Control-Allow-Credentials","true");
@@ -90,6 +94,10 @@
   @ApiOperationSupport(order = 6)
   @ApiOperation(value = "新增或修改", notes = "传入article")
   public R submit(@Valid @RequestBody Article article) {
      if (null==article.getId()){
         article.setCreateTime(new Date());
      }
      article.setUpdateTime(new Date());
      return R.status(articleService.saveOrUpdate(article));
   }