目录
2.1 设置MybatisPlus分页拦截器作为Spring管理的bean
2.2 分页查询IPage selectPage(IPage page)
1、条件查询方式IPage selectPage(Wrapper queryWrapper)
2.3 查询投影的【字段未定义的使用方式】(lambda方式不行)求count
4.1 使用TableField(value="数据库字段名")注解 解决数据库字段与实体不一致问题
4.2 使用TableField(exist=false)注解解决数据库未定义属性
4.3 使用TableField(select=false)注解设置属性是否参与查询
4.4 使用TableName("数据库表名")注解设置数据库表名不一致问题
4.6 使用TableId(type=) 注解 指定主键id生成策略
4.2 实体类新增属性version以及@Version注解
4.3 新增拦截器,优化之前的MybatisPlusConfig
前言:MyBatisPlus简介、CRUD、分页、条件查询

mysql 、mariadb 、oracle 、db2 、h2 、hsql 、sqlite 、postgresql 、sqlserver 、presto 、Gauss 、Firebird
Phoenix 、clickhouse 、Sybase ASE 、 OceanBase 、达梦数据库 、虚谷数据库 、人大金仓数据库 、南大通用数据库


- @SpringBootTest
- class MybatisQuickstartApplicationTests {
-
- @Autowired
- private EmpMapper empMapper;
- @Test
- void testSave(){
- Emp emp = new Emp();
- emp.setId(0);
- emp.setName("mimi");
- emp.setPassword("111111");
- emp.setUsername("咪咪");
- emp.setGender((short) 2);
- emp.setImage("11.jpg");
- emp.setEntrydate(LocalDate.now());
- emp.setJob((short) 2);
- emp.setDeptId(1);
- emp.setUpdateTime(LocalDateTime.now());
- emp.setCreateTime(LocalDateTime.now());
- empMapper.insert(emp);
- }
-
- }


注意:这里因为id数据库是int类型的自增字段,我之前没有设置值,导致报错:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: Could not set property 'id' of 'class com.bocai.entity.Emp' with value '1715193012897251329' Cause: java.lang.IllegalArgumentException: argument type mismatch。 所以设定了一个值就OK 了
- /**
- * 通过id删除数据,这里ID25是从库里查出来了………O(∩_∩)O哈哈~
- */
- @Test
- void testDelete(){
- empMapper.deleteById(25);
- }

- /**
- * 根据ID修改 ,这里的id是库里查的哦
- */
- @Test
- void testUpate(){
- Emp emp = new Emp();
- emp.setId(20);
- emp.setUpdateTime(LocalDateTime.now());
- emp.setName("手感好");
- empMapper.updateById(emp);
- }

注意:这里看上去是setId,实际上他转换成sql是id是where条件
- /**
- * 根据id查询
- */
- @Test
- void testGetById(){
- Emp emp = empMapper.selectById(20);
- System.out.println(emp);
- }

- /**
- * 查询全部
- */
- @Test
- void testGetAll() {
- List<Emp> empList = empMapper.selectList(null);
- System.out.println(empList);
- }


- package com.bocai.config;
-
- import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
- import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
-
- /**
- * 配置MP的分页插件
- */
- @Configuration
- public class MybatisPlusConfig {
-
- @Bean
- public MybatisPlusInterceptor mybatisPlusInterceptor(){
- // 1、定义MybatisPlus拦截器
- MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
- // 2、添加具体的拦截器
- mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
- return mybatisPlusInterceptor;
-
- }
- }
上一步的拦截器必须添加
- /**
- * 分页查询
- *
- */
- @Test
- void testGetByPage(){
- IPage page = new Page(1,5); // 当前第一页,每页5条
- empMapper.selectPage(page, null);
- System.out.println("当前页码值:" + page.getCurrent());
- System.out.println("每页显示数:" + page.getSize());
- System.out.println("一共多少页:" + page.getPages());
- System.out.println("一共多少条数据:" + page.getTotal());
- System.out.println("数据:" + page.getRecords());
- }


准备用户


User
- package com.bocai.entity;
-
- import lombok.AllArgsConstructor;
- import lombok.Data;
- import lombok.NoArgsConstructor;
-
- @Data
- @NoArgsConstructor
- @AllArgsConstructor
- public class User {
- private Integer id; //ID
- private String name; //姓名
-
- private Integer age; //年龄
-
- private Short gender; // 性别 1 男 2 女
-
- private String phone; //电话
- }
UserMapper
- package com.bocai.mapper;
-
- import com.baomidou.mybatisplus.core.mapper.BaseMapper;
- import com.bocai.entity.User;
- import org.apache.ibatis.annotations.Mapper;
-
- @Mapper
- public interface UserMapper extends BaseMapper<User> {
- }

- /**
- * 条件查询 // 小于的查询条件lt(列名,值)
- */
- @Test
- void testConditionGetAll() {
- //按条件查询
- QueryWrapper qw = new QueryWrapper<>();
- qw.lt("age",38);
- List<User> userList = userMapper.selectList(qw);
- System.out.println(userList);
- }

- /**
- * 条件查询 // 小于的查询条件lt(列名,值)
- */
- @Test
- void testConditionGetAll() {
-
- //按条件查询 方式二lambda格式
- QueryWrapper<User> qw = new QueryWrapper<>();
- qw.lambda().lt(User::getAge,38);
- List<User> userList = userMapper.selectList(qw);
- System.out.println(userList);
- }
- /**
- * 条件查询 // 小于的查询条件lt(列名,值)
- */
- @Test
- void testConditionGetAll() {
-
- //按条件查询 方式三lambda格式
- LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
- lqw.lt(User::getAge,38);
- List<User> userList = userMapper.selectList(lqw);
- System.out.println(userList);
- }
- /**
- * 条件查询 // 小于的查询条件lt(列名,值)
- */
- @Test
- void testConditionGetAll() {
-
-
- //按条件查询 多条件
- LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
- lqw.lt(User::getAge,49).gt(User::getAge,38);
-
- List<User> userList = userMapper.selectList(lqw);
- System.out.println(userList);
- }

-
- /**
- * 条件查询 // 小于的查询条件lt(列名,值)
- */
- @Test
- void testConditionGetAll() {
-
-
- //按条件查询 多条件38到49之外
- LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
- // 38到49之外
- lqw.lt(User::getAge,38).or().gt(User::getAge,49);
-
- List<User> userList = userMapper.selectList(lqw);
- System.out.println(userList);
- }

前置条件,我们需要模拟前端传参

- package com.bocai.entity.query;
-
- import com.bocai.entity.User;
- import lombok.AllArgsConstructor;
- import lombok.Data;
- import lombok.NoArgsConstructor;
-
- @Data
- @NoArgsConstructor
- @AllArgsConstructor
- public class UserQuery extends User {
- private Integer age2; //年龄
-
- }
- /**
- * 条件查询
- */
- @Test
- void testConditionGetAll() {
-
-
- //按条件查询 处理null 问题
- // 模拟页面传统过来的查询数据
- UserQuery userQuery = new UserQuery();
- // userQuery.setAge(20);
- userQuery.setAge2(40);
-
- // null的判断
-
- LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
- // null方式判断是否为空,为空不执行这个
- lqw.lt(null != userQuery.getAge2(),User::getAge,userQuery.getAge2())
- .gt(null != userQuery.getAge(),User::getAge,userQuery.getAge());
- List<User> userList = userMapper.selectList(lqw);
- System.out.println(userList);
- }
-
查询投影就是查询显示哪些字段
- /**
- * 条件查询 //
- */
- @Test
- void testConditionGetAll() {
-
- //========按条件查询 查询投影(适用于lambda方式)
-
- LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
- lqw.select(User::getId,User::getAge,User::getName);
- List<User> userList = userMapper.selectList(lqw);
- System.out.println(userList);
- }

- /**
- * 条件查询 //
- */
- @Test
- void testConditionGetAll() {
-
- //========按条件查询 查询投影(适用于非lambda方式)不推荐
-
- QueryWrapper<User> qw = new QueryWrapper<>();
- qw.select("id","age","name");
- List<User> userList = userMapper.selectList(qw);
- System.out.println(userList);
- }
- /**
- * 条件查询 //
- */
- @Test
- void testConditionGetAll() {
-
- //========按条件查询 【字段未定义的使用方式】查询投影求count
- QueryWrapper<User> qw = new QueryWrapper<>();
- qw.select("count(*) as count");
- List<Map<String, Object>> maps = userMapper.selectMaps(qw);
- System.out.println(maps);
- }
- /**
- * 条件查询 //
- */
- @Test
- void testConditionGetAll() {
-
- //========按条件查询 查询投影求count,并分组
- QueryWrapper<User> qw = new QueryWrapper<>();
- qw.select("count(*) as count, gender").groupBy("gender");
- List<Map<String, Object>> maps = userMapper.selectMaps(qw);
- System.out.println(maps);
- }


一条数据就使用selectOne
- /**
- * 条件查询 //
- */
- @Test
- void testConditionGetAll() {
-
- //========按条件查询 查询条件设定 =匹配
- LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
- //等同于=号
- lqw.eq(User::getName,"金毛狮王").eq(User::getAge,45);
- User user = userMapper.selectOne(lqw);
- System.out.println(user);
- }

- /**
- * 条件查询 //
- */
- @Test
- void testConditionGetAll() {
-
- //========按条件查询 范围查询between
- LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
- //范围查询between
- lqw.between(User::getAge,38,57);
- List<User> userList = userMapper.selectList(lqw);
- System.out.println(userList);
- }

likeLeft likeRight 模糊匹配%位置
- /**
- * 条件查询 //
- */
- @Test
- void testConditionGetAll() {
-
- //========按条件查询 模糊查询(非全文检索版)
- LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
- //========按条件查询 like 模糊查询 不在演示likeLeft likeRight 模糊匹配%位置
- lqw.like(User::getName,"王");
- List<User> userList = userMapper.selectList(lqw);
- System.out.println(userList);
- }




实体有online字段,数据库没有


- package com.bocai.entity;
-
- import com.baomidou.mybatisplus.annotation.TableField;
- import lombok.AllArgsConstructor;
- import lombok.Data;
- import lombok.NoArgsConstructor;
-
- @Data
- @NoArgsConstructor
- @AllArgsConstructor
- public class User {
- private Integer id; //ID
- private String name; //姓名
- private Integer age; //年龄
- private Short gender; // 性别 1 男 2 女
- private String phone; //电话
- @TableField(exist = false)
- private Integer online; //是否在线 1 在线 2 不在线
- }





下图是雪花算法生成主键id





- package com.bocai.entity;
-
- import com.baomidou.mybatisplus.annotation.IdType;
- import com.baomidou.mybatisplus.annotation.TableId;
- import lombok.AllArgsConstructor;
- import lombok.Data;
- import lombok.NoArgsConstructor;
-
- import java.time.LocalDate;
- import java.time.LocalDateTime;
-
- /**
- * 员工实体类
- */
- @Data
- @NoArgsConstructor
- @AllArgsConstructor
- public class Emp {
- @TableId(type= IdType.AUTO) //数据库自增ID方式
- private Integer id; //ID
- private String username; //用户名
- private String password; //密码
- private String name; //姓名
- private Short gender; //性别 , 1 男, 2 女
- private String image; //图像url
- private Short job; //职位 , 1 班主任 , 2 讲师 , 3 学工主管 , 4 教研主管 , 5 咨询师
- private LocalDate entrydate; //入职日期
- private Integer deptId; //部门ID
- private LocalDateTime createTime; //创建时间
- private LocalDateTime updateTime; //修改时间
- }
或者使用全部配置
- spring:
- datasource:
- type: com.alibaba.druid.pool.DruidDataSource
- driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC
- username: root
- password: XXX
- main:
- banner-mode: off # 关闭控制台springboot的logo
- mybatis-plus:
- configuration:
- #在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射
- map-underscore-to-camel-case: true
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 控制台显示sql
- global-config:
- db-config:
- id-type: auto # 数据库id生产规则全局 配置 # ASSIGN_ID雪花算法,数据库id建议使用Long类型
- # table-prefix: tbl_ # 数据库表前缀全局配置
- banner: false # 关闭控制台mybatis-plus的logo
-
-
-
- /**
- * 新增
- */
- @Test
- void testSave(){
- Emp emp = new Emp();
- // emp.setId(0); //实体类设置这个属性就不需要这个@TableId(type= IdType.AUTO) //数据库自增ID 方式
- emp.setName("dadamimi");
- emp.setPassword("111111");
- emp.setUsername("大大咪咪");
- emp.setGender((short) 2);
- emp.setImage("11.jpg");
- emp.setEntrydate(LocalDate.now());
- emp.setJob((short) 2);
- emp.setDeptId(1);
- emp.setUpdateTime(LocalDateTime.now());
- emp.setCreateTime(LocalDateTime.now());
- empMapper.insert(emp);
- }
数据库ID建议使用Long类型,不然本文后面的雪花算法等长度不够

IdType.AUTO:数据库自增
IdType.NONE:没有策略
IdType.INPUT:用户自己输入 。那么数据库的自增策略要移除,新增要指定id值
IdType.ASSIGN_ID:雪花算法。那么数据库的自增策略要移除,新增不需要指定id值
IdType.ASSIGN_UUID:UUID
/** @deprecated */
-======== 下面三个过时了===
IdType.ID_WORKER:生成整型 被他取代IdType.ASSIGN_ID:
IdType.ID_WORKER_STR:生成字符串 被他取代IdType.ASSIGN_ID:
IdType.UUID:被他取代IdType.ASSIGN_UUID:
- /**
- * 删除多条记录
- */
- @Test
- void testDeleteList(){
- List<Integer> list = new ArrayList<>();
- list.add(26);
- list.add(28);
- empMapper.deleteBatchIds(list);
- }







全局配置,就不需要再实体去配置逻辑删除字段了
- spring:
- datasource:
- type: com.alibaba.druid.pool.DruidDataSource
- driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC
- username: root
- password: runa#2050
- main:
- banner-mode: off # 关闭控制台springboot的logo
- mybatis-plus:
- configuration:
- #在映射实体或者属性时,将数据库中表名和字段名中的下划线去掉,按照驼峰命名法映射
- map-underscore-to-camel-case: true
- log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 控制台显示sql
- global-config:
- db-config:
- id-type: auto # 数据库id生产规则全局 配置 # ASSIGN_ID雪花算法,数据库id建议使用Long类型
- # logic-delete-field: deleted # 全局配置逻辑删除字段名
- # logic-delete-value: 0 # 全局配置逻没有被删除的写0
- #logic-not-delete-value: 1 # 全局配置逻没有被逻辑删除的写1
- # table-prefix: tbl_ # 数据库表前缀全局配置
- banner: false # 关闭控制台mybatis-plus的logo
-
-
-



- package com.bocai.config;
-
- import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
- import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
- import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
-
- /**
- * 配置MP的分页插件
- */
- @Configuration
- public class MybatisPlusConfig {
-
- @Bean
- public MybatisPlusInterceptor mybatisPlusInterceptor(){
- // 1、定义MybatisPlus拦截器
- MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
- // 2、添加分页的拦截器
- mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
- // 3、添加乐观锁的拦截器
- mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
- return mybatisPlusInterceptor;
-
- }
- }
- package com.bocai.config;
-
- import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
- import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
- import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
- import org.springframework.context.annotation.Bean;
- import org.springframework.context.annotation.Configuration;
-
- /**
- * 配置MP的分页插件
- */
- @Configuration
- public class MybatisPlusConfig {
-
- @Bean
- public MybatisPlusInterceptor mybatisPlusInterceptor(){
- // 1、定义MybatisPlus拦截器
- MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
- // 2、添加分页的拦截器
- mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
- // 3、添加乐观锁的拦截器
- mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
- return mybatisPlusInterceptor;
-
- }
- }
需要传Version数值进行修改

这个方式不需要version传值,因为查询出来的数据有version



所有bbb 没有成功 ,下面是分析





- <?xml version="1.0" encoding="UTF-8"?>
- <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <!-- 1、修改为2.7.5 -->
- <version>2.7.5</version>
- <relativePath/> <!-- lookup parent from repository -->
- </parent>
- <groupId>com.bocai</groupId>
- <artifactId>mybatis_quickstart</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <!-- 2、 删除这里
- <name>mybatis_quickstart</name>
- <description>mybatis_quickstart</description>
- -->
- <properties>
- <java.version>1.8</java.version>
- </properties>
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.mysql</groupId>
- <artifactId>mysql-connector-j</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- 3、 引入mybatisplus -->
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-boot-starter</artifactId>
- <version>3.4.2</version>
- </dependency>
- <!-- 4、 引入druid -->
- <!--
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>druid</artifactId>
- <version>1.1.21</version>
- </dependency>
- -->
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>druid-spring-boot-starter</artifactId>
- <version>1.1.23</version>
- </dependency>
-
- <!-- 5、lombok -->
- <dependency>
- <groupId>org.projectlombok</groupId>
- <artifactId>lombok</artifactId>
- <optional>true</optional>
- <scope>provided</scope> <!-- 不打包 -->
- <version>1.18.24</version>
- </dependency>
-
- <!-- 代码生成器 -->
- <dependency>
- <groupId>com.baomidou</groupId>
- <artifactId>mybatis-plus-generator</artifactId>
- <version>3.4.1</version>
- </dependency>
-
- <!-- velocity模版引擎 -->
- <dependency>
- <groupId>org.apache.velocity</groupId>
- <artifactId>velocity-engine-core</artifactId>
- <version>2.3</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- </project>

- package com.bocai;
-
- import com.baomidou.mybatisplus.annotation.IdType;
- import com.baomidou.mybatisplus.generator.AutoGenerator;
- import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
- import com.baomidou.mybatisplus.generator.config.GlobalConfig;
- import com.baomidou.mybatisplus.generator.config.PackageConfig;
- import com.baomidou.mybatisplus.generator.config.StrategyConfig;
-
- public class CodeGenerator {
- public static void main(String[] args) {
- AutoGenerator autoGenerator = new AutoGenerator();
- // 配置数据库
- DataSourceConfig dataSourceConfig = new DataSourceConfig();
- dataSourceConfig.setDriverName("com.mysql.cj.jdbc.Driver");
- dataSourceConfig.setUrl("jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC");
- dataSourceConfig.setUsername("root");
- dataSourceConfig.setPassword("runa#2050");
- autoGenerator.setDataSource(dataSourceConfig);
-
- // 设置全局配置
- GlobalConfig globalConfig = new GlobalConfig();
- globalConfig.setOutputDir(System.getProperty("user.dir")+"/mybatis_quickstart/src/main/java"); //设置代码生成文件输出位置 /mybatis_quickstart(这里目录依据你实际项目配置)
- globalConfig.setOpen(false); // 设置生成完毕后是否打开生成代码所在的目录
- globalConfig.setAuthor("春天的菠菜"); //设置作者
- globalConfig.setFileOverride(false); // 设置是否覆盖原始生成的文件默认是false
- globalConfig.setMapperName("%sMapper"); //设置数据层接口名,%s为占位符, 指代模块名称 也有这样写的%Dao,其实不指定的话 他默认就是Mapper
- globalConfig.setIdType(IdType.AUTO); //设置id生成策略,目前是数据库自增, 可以ASSIGN_ID雪花算法,但数据库就不能是自增属性了
- autoGenerator.setGlobalConfig(globalConfig);
-
- // 设置包名相关配置
- PackageConfig packageConfig = new PackageConfig();
- packageConfig.setParent("com.niuniu"); //设置生成的包名,与代码所在的位置不冲突,二者叠加组成完整路径
- packageConfig.setEntity("entity"); //设置实体类包名 有的叫domain
- packageConfig.setMapper("mapper"); //设置数据层包名 ,有的叫dao
- autoGenerator.setPackageInfo(packageConfig);
-
- // 策略设置 这个是关键
- StrategyConfig strategyConfig = new StrategyConfig();
- strategyConfig.setInclude("dept");// 设置当前参与生成的 表名,参数为可变参数
- // strategyConfig.setInclude("tbl_user");// 设置当前参与生成的 表名,参数为可变参数,("tbl_user","sss","ssss")
- // strategyConfig.setTablePrefix("tbl_"); //设置数据库表的前缀名称。 模块名= 数据库名 - 前缀名 例如 User = tbl_user - tbl
- strategyConfig.setRestControllerStyle(true); //设置是否启用Rest风格
- strategyConfig.setVersionFieldName("version"); // 设置乐观锁字段名
- strategyConfig.setLogicDeleteFieldName("deleted"); //设置逻辑删除字段名
- strategyConfig.setEntityLombokModel(true); //设置是否启用lambok
- autoGenerator.setStrategy(strategyConfig);
-
- // 执行 生成操作
- autoGenerator.execute();
-
- }
- }
完美
下面那个xml可根据需要迁移到resources对应的文件目录下(包名目录相同)
