net.guerlab.smart.article.web.controller.commons.SimpleArticleController Maven / Gradle / Ivy
package net.guerlab.smart.article.web.controller.commons;
import io.swagger.annotations.Api;
import net.guerlab.smart.article.core.enums.AuditStatus;
import net.guerlab.smart.article.core.exception.ArticleInvalidException;
import net.guerlab.smart.article.core.searchparams.ArticleSearchParams;
import net.guerlab.smart.article.service.entity.SimpleArticle;
import net.guerlab.smart.article.service.service.SimpleArticleService;
import net.guerlab.smart.article.web.controller.AbstractArticleController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 简单文章
*
* @author guer
*/
@Api(tags = "简单文章")
@RestController("/commons/simpleArticle")
@RequestMapping("/commons/simpleArticle")
public class SimpleArticleController extends AbstractArticleController {
@Override
protected void beforeFindList(ArticleSearchParams searchParams) {
searchParams.setPublished(true);
searchParams.setAuditStatus(AuditStatus.PASS);
}
@Override
protected SimpleArticle findOne0(String id) {
SimpleArticle dto = super.findOne0(id);
if (!dto.getPublished()) {
throw new ArticleInvalidException();
}
return dto;
}
}