admin
6 天以前 7f0825f8195a522ed7e8bcdb6347f3a719e06c74
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
package com.weikou.beibeivideo.util;
 
import java.util.ArrayList;
import java.util.List;
 
import com.weikou.beibeivideo.entity.VideoType;
 
public class VideoTypeUtil {
    public static String getVideoTypeName(VideoType type) {
        String result = "";
        List<String> nameList = new ArrayList<String>();
        nameList.add(type.getName());
        while (type.getParent() != null) {
            type = type.getParent();
            nameList.add(type.getName());
        }
        for (int i = nameList.size() - 1; i >= 0; i--) {
            result += nameList.get(i) + "-";
        }
        if (result.endsWith("-"))
            result = result.substring(0, result.length() - 1);
        return result;
    }
    
    public static String getVideoRootName(VideoType type) {
        while (type.getParent() != null) {
            type = type.getParent();
        }
        return type.getName();
    }
 
}