@RequestMapping("cms-article-save")
public String save(@ModelAttribute CmsArticle cmsArticle,
@RequestParam("cmsCatalogId") Long cmsCatalogId,
RedirectAttributes redirectAttributes) {
Long id = cmsArticle.getId();
CmsArticle dest = null;
if (id != null) {
dest = cmsArticleManager.get(id);
beanMapper.copy(cmsArticle, dest);
} else {
dest = cmsArticle;
}
if (id == null) {
dest.setUserId(SpringSecurityUtils.getCurrentUserId());
dest.setCreateTime(new Date());
}
dest.setCmsCatalog(cmsCatalogManager.get(cmsCatalogId));
cmsArticleManager.save(dest);
messageHelper.addFlashMessage(redirectAttributes, "core.success.save",
"保存成功");