| | |
| | | public boolean entity = true; |
| | | public boolean xml = true; |
| | | public boolean html = true; |
| | | public boolean htmlDetail = false; |
| | | public boolean js = true; |
| | | public boolean sql = true; |
| | | public SqlOsType sqlOsType; |
| | | public String backendPrefixPath; |
| | | public String frontendPrefixPath; |
| | | |
| | | private List<Column> columns = new ArrayList<>(); |
| | | private String fullEntityName; |
| | |
| | | switch (template){ |
| | | case "Controller": |
| | | pass = controller; |
| | | directory = JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | directory = backendPrefixPath + JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | fileName = fullEntityName+template+".java"; |
| | | break; |
| | | case "Service": |
| | | pass = service; |
| | | directory = JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | directory = backendPrefixPath + JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | fileName = fullEntityName+template+".java"; |
| | | break; |
| | | case "ServiceImpl": |
| | | pass = service; |
| | | directory = JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | directory = backendPrefixPath + JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | fileName = fullEntityName+template+".java"; |
| | | break; |
| | | case "Mapper": |
| | | pass = mapper; |
| | | directory = JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | directory = backendPrefixPath + JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | fileName = fullEntityName+template+".java"; |
| | | break; |
| | | case "Entity": |
| | | pass = entity; |
| | | directory = JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | directory = backendPrefixPath + JAVA_DIR + packagePath.replace(".", "/")+"/"+templatePath+"/"; |
| | | fileName = fullEntityName+".java"; |
| | | break; |
| | | case "Xml": |
| | | pass = xml; |
| | | directory = XML_DIR; |
| | | directory = backendPrefixPath + XML_DIR; |
| | | fileName = fullEntityName+"Mapper.xml"; |
| | | break; |
| | | case "Sql": |
| | | pass = sql; |
| | | directory = backendPrefixPath + JAVA_DIR; |
| | | fileName = simpleEntityName+".sql"; |
| | | break; |
| | | case "Html": |
| | | pass = html; |
| | | directory = HTML_DIR + "/views/" + simpleEntityName + "/"; |
| | | directory = frontendPrefixPath + HTML_DIR + "/views/" + simpleEntityName + "/"; |
| | | fileName = simpleEntityName+".html"; |
| | | break; |
| | | case "Js": |
| | | pass = js; |
| | | directory = HTML_DIR + "/static/js/" + simpleEntityName + "/"; |
| | | directory = frontendPrefixPath + HTML_DIR + "/static/js/" + simpleEntityName + "/"; |
| | | fileName = simpleEntityName+".js"; |
| | | break; |
| | | case "Sql": |
| | | pass = sql; |
| | | directory = JAVA_DIR; |
| | | fileName = simpleEntityName+".sql"; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | entityIm.append("import com.core.common.SpringUtils;\n") |
| | | .append("import ").append(SYSTEM_MODEL.contains(column.getForeignKey())?systemPackagePath:packagePath).append(".service.").append(column.getForeignKey()).append("Service;\n") |
| | | .append("import ").append(SYSTEM_MODEL.contains(column.getForeignKey())?systemPackagePath:packagePath).append(".entity.").append(column.getForeignKey()).append(";\n"); |
| | | } |
| | | |
| | | // 命名转换注解 |
| | | if (!column.getName().equals(column.getHumpName())){ |
| | | if (setTableField){ |
| | | entityIm.append("import com.baomidou.mybatisplus.annotations.TableField;").append("\n"); |
| | | setTableField = false; |
| | | } |
| | | sb.append(" ") |
| | | .append("@TableField(\"") |
| | | .append(column.getName()) |
| | | .append("\")") |
| | | .append("\n"); |
| | | } |
| | | |
| | | if ("Date".equals(column.getType())){ |