Helius
2022-07-07 2e6277a8cf7a1d78b5151ac42f1aa785205cc907
src/main/java/com/xcong/farmer/cms/core/node/AttrNode.java
@@ -52,22 +52,6 @@
        this.parserData = parserData;
    }
    public static void main(String[] args) {
//        String data = "{id=[1,2,3], page=1, limit=5, field=art}";
//        Articles articles = new AttrNode().parserTag(data, Articles.class);
//        String value = "{id=${col.id}, page=1, limit=5, field=art}";
//        String pattern = "(?<=\\$\\{)[\\s\\S]*?(?=\\})";
//        Matcher matcher = Pattern.compile(pattern).matcher(value);
//        while (matcher.find()) {
//            String group = matcher.group();
//            System.out.println(1);
//        }
        System.out.println(1);
    }
    private boolean isNeedEmpty() {
        Elements children = this.element.children();
        if (CollUtil.isNotEmpty(children)) {
@@ -112,6 +96,7 @@
            i++;
            try {
                Template.TAGS.add(tagsEnum.getName());
                // {id=${col.id}, page=1, limit=5, field=art} ${col.id} 形式需先设置值
                String tagValue = attributes.get(tagsEnum.getName());
                tagValue = attrValueFormat(tagValue);
@@ -139,6 +124,10 @@
    public void runDataInject() {
        Attributes attributes = this.element.attributes();
        for (Attribute attribute : attributes) {
            if (attribute.getKey().startsWith("\\$")) {
                Template.TAGS.add(attribute.getKey());
            }
            String key = attribute.getKey().replaceAll("\\$", "");
            String value = attribute.getValue();
@@ -158,9 +147,7 @@
                this.element.removeAttr("class");
                this.element.attr("class", evaluate);
            } else if (value.contains( "${")) {
                String result = attrValueFormat(value);
                System.out.println(result);
                if ("text".equals(key)) {
                    this.element.text(result);
                } else {
@@ -258,4 +245,8 @@
    public void systemData(Map<String, Object> systemData) {
        this.systemData = systemData;
    }
    public Object getSystemDataValue(String key) {
        return this.systemData.get(key);
    }
}