|
|
@@ -11,9 +11,9 @@ import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.persistence.criteria.Predicate;
|
|
|
-import java.util.ArrayList;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
@@ -30,7 +30,7 @@ public class NewsServiceImpl implements NewsService {
|
|
|
public News findone(Long id) {
|
|
|
News news = newsRepository.findOne(id);
|
|
|
//判断summary字段是否为空
|
|
|
- if ("".equals(news.getSummary()) || news.getSummary() == null){
|
|
|
+ if (news != null && StringUtils.isEmpty(news.getSummary())) {
|
|
|
news.setSummary(NewsCloumnCutUtil.getHtmlText(100,news.getContent()));
|
|
|
}
|
|
|
return news;
|