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;
|
}
|
|
|
|
}
|