🐛 无标签情况下无法删除文章问题修复

This commit is contained in:
ronger 2020-09-21 08:31:31 +08:00
parent 33395df3e6
commit 2d61615e71

View File

@ -232,9 +232,11 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
public Map delete(Integer id) { public Map delete(Integer id) {
Map<String, String> map = new HashMap(1); Map<String, String> map = new HashMap(1);
Integer result; Integer result;
Article article = articleMapper.selectByPrimaryKey(id);
// 删除引用标签记录 // 删除引用标签记录
result = articleMapper.deleteTagArticle(id); result = articleMapper.deleteTagArticle(id);
if (result > 0) { // 无标签情况下无法删除文章问题修复
if (result > 0 || StringUtils.isBlank(article.getArticleTags())) {
result = articleMapper.deleteByPrimaryKey(id); result = articleMapper.deleteByPrimaryKey(id);
if (result < 1) { if (result < 1) {
map.put("message", "删除失败!"); map.put("message", "删除失败!");