xiangpei
2025-05-26 e1350e5565e0119d63e95069d6b0ee135795426d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package cn.lili.modules.page.entity.vos;
 
import cn.lili.common.utils.BeanUtil;
import cn.lili.modules.page.entity.dos.ArticleCategory;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
 
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
 
/**
 * 文章分类VO
 *
 * @author Chopper
 * @since 2021-03-26 11:32
 */
@Data
public class ArticleCategoryVO extends ArticleCategory {
 
    @ApiModelProperty(value = "子菜单")
    private List<ArticleCategoryVO> children = new ArrayList<>();
 
    public ArticleCategoryVO() {
 
    }
 
    public ArticleCategoryVO(ArticleCategory articleCategory) {
        BeanUtil.copyProperties(articleCategory, this);
    }
 
    public List<ArticleCategoryVO> getChildren() {
        if (children != null) {
            children.sort(new Comparator<ArticleCategoryVO>() {
                @Override
                public int compare(ArticleCategoryVO o1, ArticleCategoryVO o2) {
                    return o1.getSort().compareTo(o2.getSort());
                }
            });
            return children;
        }
        return null;
    }
}