serviceBuilder service 策略配置 模板引擎配置(TemplateEngine) 默认Velocity ;可选模板引擎 Beetl 或 Freemarker。(二选一即可) 模板引擎 代码 Velocity 默认 .templateEngine(new VelocityTemplateEngine()) Freemarker 可选 .templateEngine(new Fr
也就是说,输出文件所在文件夹的路径是从com.baomidou.mybatisplus.generator.config.builder.ConfigBuilder的成员映射pathInfo中获取的。 PackageConfig.packageInfo≠ConfigBuilder.packageInfo 我们在写com.baomidou.mybatisplus.generator.FastAutoGenerator代码时,可以用.packageConfig(builder -> builder.pathInfo(customPathI...
package com.itheima.domain; import lombok.*; /* 1 生成getter和setter方法:@Getter、@Setter 生成toString方法:@ToString 生成equals和hashcode方法:@EqualsAndHashCode 2 统一成以上所有:@Data 3 生成空参构造: @NoArgsConstructor 生成全参构造: @AllArgsConstructor 4 lombok还给我们提供了builder的方式创建对象,好...
builder.entityBuilder().naming(NamingStrategy.underline_to_camel); builder.addTablePrefix("t_","c_")// 对应上一段源码的 strategyConfig.getTablePrefix(),作用是文件名将去掉指定的前缀.addTableSuffix("_relation");// 对应上一段源码的 strategyConfig.getTableSuffix(),作用是文件名将去掉指定的后缀}) ....
通过在入口类 MybatisSqlSessionFactoryBuilder#build方法中, 在应用启动时, 将mybatis plus(简称MP)自定义的动态配置xml文件注入到Mybatis中。 public class MybatisSqlSessionFactoryBuilder extends SqlSessionFactoryBuilder { public SqlSessionFactory build(Configuration configuration) { if (globalConfig.isEnableSqlRunne...
(builder->{builder.parent("com.lsqingfeng")// 设置父包名.moduleName("springboot")// 设置父包模块名// .service() // 设置自定义service路径,不设置就是默认路径.pathInfo(Collections.singletonMap(OutputFile.mapperXml,System.getProperty("user.dir")+"/src/main/resources/mapper/"));// 设置mapper...
SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder(); SqlSessionFactory factory = builder.build(in); //3.使用工厂生产SqlSession对象 SqlSession session = factory.openSession(); //4.使用SqlSession创建Dao接口的代理对象 IUserDao userDao = session.getMapper(IUserDao.class); ...
builder.parent("com.zhifou") // 设置父包名 .pathInfo(Collections.singletonMap(OutputFile.mapperXml, "D:\\WorkSpace\\idea\\mybatisplus_demo\\src\\main\\resources\\mapper")); // 设置mapperXml生成路径 }) .strategyConfig(builder -> {
第二步:使用MyBatisPlus的MybatisSqlSessionFactoryBuilder进程构建: package com.krian;import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder;import com.krian.mapper.UserMapper;import com.krian.pojo.User;import org.apache.ibatis.io.Resources;import org.apache.ibatis.session.SqlSession;import org...
使用XMLConfigBuilder进行配置文件解析 解析sql配置文件 XMLMapperBuilder解析sql文件 org.apache.ibatis.builder.MapperBuilderAssistant.addMappedStatement 构建以 namespace+”.”+sqlId 为key、MappedStatement为value的map。存储在Configuration对象的mappedStatements中。