| | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringPool; |
| | | import com.baomidou.mybatisplus.generator.AutoGenerator; |
| | | import com.baomidou.mybatisplus.generator.InjectionConfig; |
| | | import com.baomidou.mybatisplus.generator.config.*; |
| | | import com.baomidou.mybatisplus.generator.config.DataSourceConfig; |
| | | import com.baomidou.mybatisplus.generator.config.FileOutConfig; |
| | | import com.baomidou.mybatisplus.generator.config.GlobalConfig; |
| | | import com.baomidou.mybatisplus.generator.config.PackageConfig; |
| | | import com.baomidou.mybatisplus.generator.config.StrategyConfig; |
| | | import com.baomidou.mybatisplus.generator.config.TemplateConfig; |
| | | import com.baomidou.mybatisplus.generator.config.po.LikeTable; |
| | | import com.baomidou.mybatisplus.generator.config.po.TableFill; |
| | | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| | | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
| | | import org.junit.Test; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import org.junit.Test; |
| | | |
| | | /** |
| | | * 通过指定 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) 可达到加速的效果。 |
| | |
| | | |
| | | |
| | | // 防止误生成 |
| | | private static final String BASE_PACKAGE = "com.financial"; |
| | | private static final String BASE_PACKAGE = "com.ruoyi"; |
| | | |
| | | @Test |
| | | public void contextLoads() { |
| | |
| | | .setServiceName("%sService") |
| | | .setServiceImplName("%sServiceImpl") |
| | | .setControllerName("%sController") |
| | | .setOpen(false)//当代码生成完成之后是否打开代码所在的文件夹 |
| | | .setOpen(true)//当代码生成完成之后是否打开代码所在的文件夹 |
| | | .setSwagger2(true) //实体属性 Swagger2 注解 |
| | | .setFileOverride(true)//是否覆盖 |
| | | //.setActiveRecord(true) |
| | |
| | | pc.setEntity("model"); |
| | | pc.setMapper("mapper"); |
| | | pc.setService("service"); |
| | | |
| | | |
| | | // 自定义mapping文件生成路径配置 |
| | | InjectionConfig cfg = new InjectionConfig() { |
| | |
| | | //templateConfig.setController(null); |
| | | //mpg.setTemplate(templateConfig); |
| | | |
| | | |
| | | // 策略配置 |
| | | StrategyConfig strategy = new StrategyConfig(); |
| | | //设置字段和表名的是否把下划线完成驼峰命名规则 |
| | | strategy.setNaming(NamingStrategy.underline_to_camel); |
| | | strategy.setEntitySerialVersionUID(true); |
| | | strategy.setEntityColumnConstant(false); |
| | | |
| | | |
| | | //设置生成的实体类继承的父类 |
| | | // strategy.setSuperEntityClass(BaseModel.class); |
| | |
| | | // strategy.setTablePrefix(pc.getModuleName() + ""); |
| | | // strategy.setLikeTable(new LikeTable("room")); |
| | | //strategy.setLikeTable(new LikeTable("member")); |
| | | strategy.setLikeTable(new LikeTable("tb_"));// 生成表名 |
| | | strategy.setLikeTable(new LikeTable("tb_data_screen_score"));// 生成表名 |
| | | // strategy.setLikeTable(new LikeTable("t_hotel"));// 生成表名 |
| | | // strategy.setLikeTable(new LikeTable("t_scan_message"));// 生成表名 |
| | | // strategy.setNotLikeTable(new LikeTable("tb_dept"));// 不生成表名 |