Service层修改 单元测试
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
package cn.celess.blog.entity.model;
|
||||
|
||||
import cn.celess.blog.entity.Category;
|
||||
import cn.celess.blog.entity.Article;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -22,22 +20,5 @@ public class CategoryModel {
|
||||
|
||||
private String name;
|
||||
|
||||
private List<Integer> articles;
|
||||
|
||||
|
||||
public CategoryModel(Category category) {
|
||||
this.id = category.getId();
|
||||
this.name = category.getName();
|
||||
if (category.getArticles() == null || category.getArticles().length() == 0) {
|
||||
articles = null;
|
||||
} else {
|
||||
articles = new ArrayList<>();
|
||||
for (String s : category.getArticles().split(",")) {
|
||||
if ("".equals(s)) {
|
||||
return;
|
||||
}
|
||||
articles.add(Integer.parseInt(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
private List<Article> articles;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user