| | |
| | | private String subpks; |
| | | private String cacheDir; |
| | | |
| | | private String projectChineseName; |
| | | private String sqlTablePrefix; |
| | | private String sqlDatabaseName; |
| | | private String mongoDatabaseName; |
| | | |
| | | |
| | | public ServiceBuilder setName(String name) { |
| | | this.name = name; |
| | |
| | | |
| | | public ServiceBuilder setCacheDir(String cacheDir) { |
| | | this.cacheDir = cacheDir; |
| | | return this; |
| | | } |
| | | |
| | | public ServiceBuilder setProjectChineseName(String projectChineseName) { |
| | | this.projectChineseName = projectChineseName; |
| | | return this; |
| | | } |
| | | |
| | | public ServiceBuilder setSqlTablePrefix(String sqlTablePrefix) { |
| | | this.sqlTablePrefix = sqlTablePrefix; |
| | | return this; |
| | | } |
| | | |
| | | public ServiceBuilder setSqlDatabaseName(String sqlDatabaseName) { |
| | | this.sqlDatabaseName = sqlDatabaseName; |
| | | return this; |
| | | } |
| | | |
| | | public ServiceBuilder setMongoDatabaseName(String mongoDatabaseName) { |
| | | this.mongoDatabaseName = mongoDatabaseName; |
| | | return this; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/application-dev.yml", "com.ks.app", subpks); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/application-dev.yml", "${mongoDataBaseName}", mongoDatabaseName); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/application-dev.yml", "${sqlDataBaseName}", sqlDatabaseName); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/application-dev.yml", "${projectName}", name); |
| | | |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/application-pro.yml", "com.ks.app", subpks); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/application-pro.yml", "${mongoDataBaseName}", mongoDatabaseName); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/application-pro.yml", "${sqlDataBaseName}", sqlDatabaseName); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/application-pro.yml", "${projectName}", name); |
| | | |
| | | //替换Mapper下的表前缀 |
| | | String mapperDir = path + "/app/src/main/resources/mapper"; |
| | | File mapperFiles = new File(mapperDir); |
| | | for (File f : mapperFiles.listFiles()) { |
| | | FileUtils.replaceFileContent(f.getAbsolutePath(), "com.ks.app", subpks); |
| | | FileUtils.replaceFileContent(f.getAbsolutePath(), "lt_", sqlTablePrefix); |
| | | } |
| | | |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/mysql.sql", "${sqlDataBaseName}", sqlDatabaseName); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/mysql.sql", "${sqlTablePrefix}", sqlTablePrefix); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/resources/static/index.html", "${projectChineseName}", projectChineseName); |
| | | |
| | | FileUtils.replaceFileContent(path + "/app/src/main/java/"+subpks.replace(".","/")+"/aop/AdminApiFilter.java", "com.ks.app", subpks); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/java/"+subpks.replace(".","/")+"/aop/SignValidate.java", "com.ks.app", subpks); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/java/"+subpks.replace(".","/")+"/aop/UserLoginValid.java", "com.ks.app", subpks); |
| | | FileUtils.replaceFileContent(path + "/app/src/main/java/"+subpks.replace(".","/")+"/Application.java", "com.ks.app", subpks); |
| | | } |
| | | |
| | | //重新命名文件夹与文件 |