处理分类新增

This commit is contained in:
TinyAnts 2022-09-16 10:02:15 +08:00
parent c99bf5d950
commit 0f55e3f808
2 changed files with 10 additions and 1 deletions

View File

@ -34,7 +34,7 @@ public class ArticleController {
* @return Object
*/
@GetMapping("/list")
public Object articleList(@Validated PageParam pageParam,
public Object list(@Validated PageParam pageParam,
@RequestParam Map<String, String> params) {
PageResult<ArticleListVo> vos = iArticleArchivesService.list(pageParam, params);
return AjaxResult.success(vos);

View File

@ -10,6 +10,7 @@ import com.mdd.admin.vo.article.ArticleCateVo;
import com.mdd.common.core.PageResult;
import com.mdd.common.entity.article.Article;
import com.mdd.common.entity.article.ArticleCategory;
import com.mdd.common.exception.OperateException;
import com.mdd.common.mapper.article.ArticleCategoryMapper;
import com.mdd.common.mapper.article.ArticleMapper;
import com.mdd.common.utils.TimeUtil;
@ -140,6 +141,10 @@ public class ArticleCategoryServiceImpl implements IArticleCategoryService {
*/
@Override
public void add(CategoryParam categoryParam) {
if (categoryParam.getName().trim().equals("")) {
throw new OperateException("名称不允许为空值!");
}
ArticleCategory model = new ArticleCategory();
model.setId(categoryParam.getId());
model.setName(categoryParam.getName());
@ -157,6 +162,10 @@ public class ArticleCategoryServiceImpl implements IArticleCategoryService {
*/
@Override
public void edit(CategoryParam categoryParam) {
if (categoryParam.getName().trim().equals("")) {
throw new OperateException("名称不允许为空值!");
}
ArticleCategory model = articleCategoryMapper.selectOne(
new QueryWrapper<ArticleCategory>()
.select(ArticleCategory.class, info->