diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java index a925ed23a..a6747836c 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/util/GenUtils.java @@ -20,7 +20,7 @@ import com.ruoyi.generator.domain.TableInfo; public class GenUtils { /** 项目空间路径 */ - private static final String PROJECT_PATH = "main/java/com/ruoyi"; + private static final String PROJECT_PATH = getProjectPath(); /** mybatis空间路径 */ private static final String MYBATIS_PATH = "main/resources/mapper"; @@ -124,7 +124,7 @@ public class GenUtils String classname = table.getClassname(); // 大写类名 String className = table.getClassName(); - String javaPath = PROJECT_PATH + "/" + moduleName + "/"; + String javaPath = PROJECT_PATH; String mybatisPath = MYBATIS_PATH + "/" + moduleName + "/" + className; String htmlPath = TEMPLATES_PATH + "/" + moduleName + "/" + classname; @@ -145,7 +145,7 @@ public class GenUtils if (template.contains("ServiceImpl.java.vm")) { - return javaPath + "service" + "/" + "/impl/" + className + "ServiceImpl.java"; + return javaPath + "service" + "/impl/" + className + "ServiceImpl.java"; } if (template.contains("Controller.java.vm")) @@ -198,6 +198,16 @@ public class GenUtils return basePackage; } + public static String getProjectPath() + { + String packageName = Global.getPackageName(); + StringBuffer projectPath = new StringBuffer(); + projectPath.append("main/java/"); + projectPath.append(packageName.replace(".", "/")); + projectPath.append("/"); + return projectPath.toString(); + } + public static String replaceKeyword(String keyword) { String keyName = keyword.replaceAll("(?:表|信息)", ""); @@ -227,11 +237,4 @@ public class GenUtils javaTypeMap.put("datetime", "Date"); javaTypeMap.put("timestamp", "Date"); } - - public static void main(String[] args) - { - System.out.println(StringUtils.convertToCamelCase("user_name")); - System.out.println(replaceKeyword("岗位信息表")); - System.out.println(getBasePackage("com.ruoyi.system")); - } } diff --git a/ruoyi-generator/src/main/resources/vm/html/list.html.vm b/ruoyi-generator/src/main/resources/vm/html/list.html.vm index 12b9f535c..04b2a39ec 100644 --- a/ruoyi-generator/src/main/resources/vm/html/list.html.vm +++ b/ruoyi-generator/src/main/resources/vm/html/list.html.vm @@ -70,6 +70,11 @@ var editFlag = [[${@permission.hasPermi('${moduleName}:${classname}:edit')}]]; var removeFlag = [[${@permission.hasPermi('${moduleName}:${classname}:remove')}]]; var prefix = ctx + "${moduleName}/${classname}"; +#foreach($column in $columns) +#if(${column.configInfo} && ${column.configInfo.type} == 'dict') + var datas = [[${@dict.getType('${column.configInfo.value}')}]]; +#end +#end $(function() { var options = { @@ -98,7 +103,6 @@ title : '${column.columnComment}', sortable: true, formatter: function(value, row, index) { - var datas = [[${@dict.getType('${column.configInfo.value}')}]]; return $.table.selectDictLabel(datas, value); } },