Search in sources :

Example 11 with ZhydException

use of com.zyd.blog.framework.exception.ZhydException in project OneBlog by zhangyd-c.

the class RenderController method edit.

@RequiresPermissions("article:publish")
@BussinessLog(value = "进入修改文章页[id={1}]")
@GetMapping("/article/update/{id}")
public ModelAndView edit(@PathVariable("id") Long id, Model model) {
    model.addAttribute("id", id);
    Article article = articleService.getByPrimaryKey(id);
    if (!Arrays.asList("we", "md", "tiny").contains(article.getEditorType())) {
        throw new ZhydException("文章异常,未知的编辑器类型");
    }
    return ResultUtil.view("article/publish-" + article.getEditorType());
}
Also used : ZhydException(com.zyd.blog.framework.exception.ZhydException) Article(com.zyd.blog.business.entity.Article) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) GetMapping(org.springframework.web.bind.annotation.GetMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Aggregations

ZhydException (com.zyd.blog.framework.exception.ZhydException)11 Transactional (org.springframework.transaction.annotation.Transactional)4 RedisCache (com.zyd.blog.business.annotation.RedisCache)3 User (com.zyd.blog.business.entity.User)2 GlobalFileException (com.zyd.blog.file.exception.GlobalFileException)2 BizArticleTags (com.zyd.blog.persistence.beans.BizArticleTags)2 Date (java.util.Date)2 JapUser (com.fujieid.jap.core.JapUser)1 JapConfig (com.fujieid.jap.core.config.JapConfig)1 JapResponse (com.fujieid.jap.core.result.JapResponse)1 SocialStrategy (com.fujieid.jap.social.SocialStrategy)1 BussinessLog (com.zyd.blog.business.annotation.BussinessLog)1 Article (com.zyd.blog.business.entity.Article)1 Resources (com.zyd.blog.business.entity.Resources)1 SocialConfig (com.zyd.blog.business.entity.SocialConfig)1 Tags (com.zyd.blog.business.entity.Tags)1 ResponseStatus (com.zyd.blog.business.enums.ResponseStatus)1 SysConfigService (com.zyd.blog.business.service.SysConfigService)1 AliyunOssApiClient (com.zyd.blog.file.AliyunOssApiClient)1 ApiClient (com.zyd.blog.file.ApiClient)1