|
|
@ -19,6 +19,7 @@ import org.jeecg.modules.demo.cms.entity.CmsColumn; |
|
|
|
import org.jeecg.modules.demo.cms.service.ICmsArticleService; |
|
|
|
import org.jeecg.modules.demo.cms.service.ICmsArticleService; |
|
|
|
import org.jeecg.modules.demo.cms.service.ICmsColumnService; |
|
|
|
import org.jeecg.modules.demo.cms.service.ICmsColumnService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
|
|
|
@ -80,9 +81,10 @@ public class CmsArticleController extends JeecgController<CmsArticle, ICmsArticl |
|
|
|
cmsArticle.setCreateBy(principal.getUsername()); |
|
|
|
cmsArticle.setCreateBy(principal.getUsername()); |
|
|
|
CmsColumn cmsColumn = cmsColumnService.getById(cmsArticle.getColumnId()); |
|
|
|
CmsColumn cmsColumn = cmsColumnService.getById(cmsArticle.getColumnId()); |
|
|
|
cmsArticle.setColumnName(cmsColumn.getName()); |
|
|
|
cmsArticle.setColumnName(cmsColumn.getName()); |
|
|
|
if (StringUtils.equals("1", cmsArticle.getStatus())) { |
|
|
|
// if (StringUtils.equals("1", cmsArticle.getStatus())) {
|
|
|
|
cmsArticle.setPublishTime(new Date()); |
|
|
|
cmsArticle.setPublishTime(new Date()); |
|
|
|
} |
|
|
|
cmsArticle.setStatus("1"); |
|
|
|
|
|
|
|
// }
|
|
|
|
cmsArticleService.save(cmsArticle); |
|
|
|
cmsArticleService.save(cmsArticle); |
|
|
|
return Result.OK("添加成功!"); |
|
|
|
return Result.OK("添加成功!"); |
|
|
|
} |
|
|
|
} |
|
|
@ -109,6 +111,10 @@ public class CmsArticleController extends JeecgController<CmsArticle, ICmsArticl |
|
|
|
// @RequiresPermissions("cms:cms_article:edit")
|
|
|
|
// @RequiresPermissions("cms:cms_article:edit")
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) |
|
|
|
public Result<String> edit(@RequestBody CmsArticle cmsArticle) { |
|
|
|
public Result<String> edit(@RequestBody CmsArticle cmsArticle) { |
|
|
|
|
|
|
|
CmsColumn cmsColumn = cmsColumnService.getById(cmsArticle.getColumnId()); |
|
|
|
|
|
|
|
if (!ObjectUtils.isEmpty(cmsColumn)) { |
|
|
|
|
|
|
|
cmsArticle.setColumnName(cmsColumn.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
cmsArticleService.updateById(cmsArticle); |
|
|
|
cmsArticleService.updateById(cmsArticle); |
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
} |
|
|
|
} |
|
|
|