Browse Source

自动继承父类

yq 3 years ago
parent
commit
f60ec57883
1 changed files with 18 additions and 2 deletions
  1. 18 2
      技术分享/manven多模块+mybatisplus自动生成代码

+ 18 - 2
技术分享/manven多模块+mybatisplus自动生成代码

@@ -1,3 +1,15 @@
+1添加依赖
+<dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-generator</artifactId>
+            <version>3.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.velocity</groupId>
+            <artifactId>velocity-engine-core</artifactId>
+            <version>2.1</version>
+        </dependency>
+
 package com.bizmatics.fiveep.controller;
 
 
@@ -27,6 +39,7 @@ public class TestUtils {
         File file = new File(model);
         String path = file.getAbsolutePath();
         gc.setOutputDir(path + "/src/main/java");  //生成路径(一般都是生成在此项目的src/main/java下面)
+        //修改
         gc.setAuthor("ya"); //设置作者
         gc.setOpen(false);
         gc.setFileOverride(true); //第二次生成会把第一次生成的覆盖掉
@@ -35,6 +48,7 @@ public class TestUtils {
         mpg.setGlobalConfig(gc);
 
         //2、数据源配置
+        //修改
         DataSourceConfig dsc = new DataSourceConfig();
         dsc.setUrl("jdbc:mysql://localhost:3306/test?useUnicode=true&serverTimezone=GMT&useSSL=false&characterEncoding=utf8");
         dsc.setDriverName("com.mysql.jdbc.Driver");
@@ -43,6 +57,7 @@ public class TestUtils {
         mpg.setDataSource(dsc);
 
         // 3、包配置
+        //修改
         PackageConfig pc = new PackageConfig();
         pc.setParent("com.bizmatics");
         pc.setController("fiveep.controller.web");
@@ -57,8 +72,9 @@ public class TestUtils {
         StrategyConfig strategy = new StrategyConfig();
         strategy.setNaming(NamingStrategy.underline_to_camel);
         strategy.setColumnNaming(NamingStrategy.underline_to_camel);
-//        strategy.setSuperControllerClass("com.lcy.demo.sys.controller.BaseController");
-//        strategy.setSuperEntityClass("com.lcy.demo.sys.entity.BaseEntity");
+        strategy.setSuperMapperClass("com.bizmatics.common.mvc.base.CrudMapper");
+        strategy.setSuperServiceClass("com.bizmatics.common.mvc.base.CrudService");
+        strategy.setSuperServiceImplClass("com.bizmatics.common.mvc.base.AbstractCrudService");
         // strategy.setTablePrefix("t_"); // 表名前缀
         strategy.setEntityLombokModel(true); //使用lombok
         strategy.setInclude("test");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]