Helius
2022-07-05 121b0c399ab5fadd9cb3a46509d68fe1ba476c95
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package com.xcong.farmer.cms.core.node;
 
import cn.hutool.core.collection.CollUtil;
import com.xcong.farmer.cms.core.node.PartNode;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * @author wzy
 * @date 2022-06-22
 **/
public class Template {
 
    private String name;
 
    private Document document;
 
    private Map<String, Map<String, Object>> params = new HashMap<>();
    private Map<String, Object> system;
    private List<PartNode> partNodes = new ArrayList<>();
 
    private static boolean hasPaging = false;
 
    public void parser() {
        Elements children = document.body().children();
        if (CollUtil.isNotEmpty(children)) {
            for (Element child : children) {
                PartNode partNode = new PartNode(child, this.system);
                partNode.parser();
 
                this.add(partNode);
            }
        }
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public Document getDocument() {
        return document;
    }
 
    public void setDocument(Document document) {
        this.document = document;
    }
 
    public void add(PartNode partNode) {
        this.partNodes.add(partNode);
    }
 
    public List<PartNode> getPartNodes() {
        return partNodes;
    }
 
    public Map<String, Map<String, Object>> getParams() {
        return params;
    }
 
    public void putParams(String key, Map<String, Object> value) {
        this.params.put(key, value);
    }
 
    public void systemData(Map<String, Object> data) {
        this.system = data;
    }
}