use of com.baomidou.mybatisplus.generator.AutoGenerator in project weather-push by yangh124.
the class H2CodeGeneratorTest method testCustomTemplateName.
/**
* 自定义模板生成的文件名称 result: TSimple -> TSimpleEntity
*/
@Test
public void testCustomTemplateName() {
AutoGenerator generator = new AutoGenerator(DATA_SOURCE_CONFIG);
generator.strategy(strategyConfig().entityBuilder().formatFileName("%sEntity").mapperBuilder().formatMapperFileName("%sDao").formatXmlFileName("%sXml").controllerBuilder().formatFileName("%sAction").serviceBuilder().formatServiceFileName("%sService").formatServiceImplFileName("%sServiceImp").build());
generator.global(globalConfig().build());
generator.execute();
}
use of com.baomidou.mybatisplus.generator.AutoGenerator in project weather-push by yangh124.
the class H2CodeGeneratorTest method testCustomMap.
/**
* 自定义注入属性
*/
@Test
public void testCustomMap() {
// 设置自定义属性
Map<String, Object> map = new HashMap<>();
map.put("abc", 123);
AutoGenerator generator = new AutoGenerator(DATA_SOURCE_CONFIG);
generator.strategy(strategyConfig().build());
generator.template(templateConfig().entity("/templates/entity1.java").build());
generator.injection(injectionConfig().customMap(map).build());
generator.global(globalConfig().build());
generator.execute();
}
use of com.baomidou.mybatisplus.generator.AutoGenerator in project weather-push by yangh124.
the class H2CodeGeneratorTest method testSimple.
/**
* 简单生成
*/
@Test
public void testSimple() {
AutoGenerator generator = new AutoGenerator(DATA_SOURCE_CONFIG);
generator.strategy(strategyConfig().entityBuilder().enableLombok().idType(IdType.ASSIGN_ID).logicDeleteColumnName("is_delete").build());
generator.global(globalConfig().build());
generator.packageInfo(packageConfig().build());
generator.template(templateConfig().build());
generator.execute();
}
use of com.baomidou.mybatisplus.generator.AutoGenerator in project weather-push by yangh124.
the class H2CodeGeneratorTest method testFieldSuffix.
/**
* 过滤字段后缀(前缀同理,支持多个) result: deleted_flag -> deleted
*/
@Test
public void testFieldSuffix() {
AutoGenerator generator = new AutoGenerator(DATA_SOURCE_CONFIG);
generator.strategy(strategyConfig().addFieldSuffix("_flag").build());
generator.global(globalConfig().build());
generator.execute();
}
use of com.baomidou.mybatisplus.generator.AutoGenerator in project weather-push by yangh124.
the class H2CodeGeneratorTest method testCustomTemplatePath.
/**
* 自定义模板生成的文件路径
*
* @see OutputFile
*/
@Test
public void testCustomTemplatePath() {
// 设置自定义路径
Map<OutputFile, String> pathInfo = new HashMap<>();
pathInfo.put(OutputFile.mapperXml, "D://");
pathInfo.put(OutputFile.entity, "D://entity//");
AutoGenerator generator = new AutoGenerator(DATA_SOURCE_CONFIG);
generator.strategy(strategyConfig().build());
generator.packageInfo(packageConfig().pathInfo(pathInfo).build());
generator.global(globalConfig().build());
generator.execute();
}
Aggregations