| | |
| | | // 演示例子,执行 main 方法控制台输入模块表名回车自动生成对应项目目录中 |
| | | public class CodeGenerator { |
| | | |
| | | public static String database_url = "jdbc:mysql://localhost:3306/mom_ocean?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai"; |
| | | public static String database_username = "root"; |
| | | public static String database_url = "jdbc:mysql://192.168.110.209:3306/lims_laboratory?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai"; |
| | | public static String database_username = "user"; |
| | | public static String database_password= "123456"; |
| | | public static String author = "江苏鵷雏网络科技有限公司"; |
| | | public static String model_name = "/inspect-server"; // 如果为分布式填子模块名称,如果不是分布式为空即可 |
| | | public static String setParent = "com.yuanchu.mom"; // 包路径 |
| | | public static String model_name = "/cnas-server"; // 如果为分布式填子模块名称,如果不是分布式为空即可 |
| | | public static String setParent = "com.yuanchu.limslaboratory"; // 包路径 |
| | | public static void main(String[] args) { |
| | | String projectPath = System.getProperty("user.dir"); |
| | | System.out.println(projectPath+"==================="); |
| | | String s = projectPath + "/lims-after" + model_name + "/src/main/java"; |
| | | String s1 = projectPath + "/lims-after" + model_name + "/src/main/resources/mapper"; |
| | | System.out.println(); |
| | | FastAutoGenerator.create(database_url, database_username, database_password) |
| | | // 全局配置 |
| | | .globalConfig(builder -> { |
| | | builder.author(author) // 设置作者 |
| | | .commentDate("yyyy-MM-dd hh:mm:ss") //注释日期 |
| | | .outputDir(projectPath + model_name + "/src/main/java") // 指定输出目录 |
| | | .outputDir(s) // 指定输出目录 |
| | | .disableOpenDir() //禁止打开输出目录,默认打开 |
| | | ; |
| | | }) |
| | |
| | | .packageConfig(builder -> { |
| | | builder.entity("pojo"); |
| | | builder.parent(setParent) // 设置父包名 |
| | | .pathInfo(Collections.singletonMap(OutputFile.xml, projectPath + model_name + "/src/main/resources/mapper")); // 设置mapperXml生成路径 |
| | | .pathInfo(Collections.singletonMap(OutputFile.xml, s1)); // 设置mapperXml生成路径 |
| | | }) |
| | | // 策略配置 |
| | | .strategyConfig(builder -> { |