leutu
2024-06-03 3ef35e6cd16bbfa206b26bb3271eac40ad020bcb
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
78
79
80
81
82
83
84
85
86
87
88
89
package com.fastbee.iot.util;
 
import com.alibaba.fastjson2.JSONObject;
import com.fastbee.common.constant.GenConstants;
import com.fastbee.common.utils.DateUtils;
import com.fastbee.common.utils.StringUtils;
import org.apache.velocity.VelocityContext;
 
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
 
/**
 * 模板处理工具类
 * 
 * @author ruoyi
 */
public class VelocityUtils
{
    /** 项目空间路径 */
    private static final String PROJECT_PATH = "main/java";
 
    /** mybatis空间路径 */
    private static final String MYBATIS_PATH = "main/resources/mapper";
 
    /** 默认上级菜单,系统工具 */
    private static final String DEFAULT_PARENT_MENU_ID = "3";
 
    /**
     * 设置模板变量信息
     *
     * @return 模板列表
     */
    public static VelocityContext prepareContext(int deviceChip)
    {
 
        VelocityContext velocityContext = new VelocityContext();
        return velocityContext;
    }
 
 
    /**
     * 获取模板信息
     *
     * @return 模板列表
     */
    public static List<String> getTemplateList(String tplCategory)
    {
        List<String> templates = new ArrayList<String>();
        templates.add("vm/java/domain.java.vm");
        templates.add("vm/java/controller.java.vm");
        if (GenConstants.TPL_CRUD.equals(tplCategory))
        {
            templates.add("vm/vue/index.vue.vm");
        }
        else if (GenConstants.TPL_TREE.equals(tplCategory))
        {
            templates.add("vm/vue/index-tree.vue.vm");
        }
        else if (GenConstants.TPL_SUB.equals(tplCategory))
        {
            templates.add("vm/vue/index.vue.vm");
            templates.add("vm/java/sub-domain.java.vm");
        }
        return templates;
    }
 
    /**
     * 获取文件名
     */
    public static String getFileName(String template)
    {
        // 文件名称
        String fileName = "";
        String vuePath = "vue";
 
        if (template.contains("domain.java.vm"))
        {
            fileName = StringUtils.format("{}/domain/{}.java", "test", "test");
        } else if (template.contains("controller.java.vm"))
        {
            fileName = StringUtils.format("{}/controller/{}Controller.java", "test", "test");
        }
        return fileName;
    }
 
 
 
}