You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
580 B

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ArticleRepository {
private static final Logger log = LoggerFactory.getLogger(ArticleRepository.class);
public void save(Article article) {
// 防御检查:空值拦截
if (article == null) {
log.warn("保存文章失败:article为空");
return;
}
if (article.getTitle() == null || article.getTitle().isBlank()) {
log.warn("保存文章失败:标题为空");
return;
}
// 原有保存逻辑
}
}