Java Code Examples for com.ruoyi.generator.util.GenUtils#getTemplatesWeb()

The following examples show how to use com.ruoyi.generator.util.GenUtils#getTemplatesWeb() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GenServiceImpl.java    From ruoyiplus with MIT License 5 votes vote down vote up
private Map generatorAdvCodeOnlyWeb(
        String tmplName, TableInfo table, List<ColumnInfo> columns, Map<String, String[]> params) {
    Map retMap = new HashMap();
    // 设置主键
    table.setPrimaryKey(table.getColumnsLast());
    // 设置表格的访问地址
    table.setUri(Convert.toStr(GenUtils.getParam(params, "uri"), "system/unknown"));
    VelocityInitializer.initVelocity();

    String packageName = GenUtils.getParam(params, "package");
    String moduleName = GenUtils.getParam(params, "module");
    table.setModule(moduleName);

    String genJava = Convert.toStr(GenUtils.getParam(params, "gen-java"), "0");
    String genHtml = Convert.toStr(GenUtils.getParam(params, "gen-html"), "0");
    TableInfo.GenStyle genStyle = TableInfo.GenStyle.All;
    if (genJava.equals("1") && genHtml.equals("0")) {
        genStyle = TableInfo.GenStyle.Java;
    } else if (genHtml.equals("1") && genJava.equals("0")) {
        genStyle = TableInfo.GenStyle.Web;
    }
    VelocityContext context = GenUtils.getVelocityContext(table, packageName);

    // 获取模板列表
    List<String> templates = GenUtils.getTemplatesWeb(genStyle, tmplName);
    return putIntoMap(retMap, context, templates);
}
 
Example 2
Source File: GenServiceImpl.java    From ruoyiplus with MIT License 5 votes vote down vote up
@Override
public Map generatorProjectCode(String projectName, String version, String basePackage) {
    Map retMap = new HashMap();
    VelocityInitializer.initVelocity();
    VelocityContext context = GenUtils.getVelocityContext(projectName, basePackage, version);
    // 获取模板列表
    List<String> templates = GenUtils.getTemplatesWeb(TableInfo.GenStyle.Project, null);
    return putIntoMap(retMap, context, templates);
}