| | |
| | | import com.baomidou.mybatisplus.generator.config.po.TableInfo; |
| | | import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy; |
| | | import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine; |
| | | import com.ycl.base.BaseController; |
| | | import com.ycl.controller.BaseController; |
| | | |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | // 全局配置 |
| | | GlobalConfig gc = new GlobalConfig(); |
| | | String projectPath = System.getProperty("user.dir"); |
| | | gc.setOutputDir(projectPath + "/ycl-generator/src/main/java"); |
| | | gc.setAuthor("wl");//作者 |
| | | final String projectPath = System.getProperty("user.dir"); |
| | | gc.setOutputDir(projectPath + "/ycl-smoke/src/main/java"); |
| | | gc.setAuthor("lyq");//作者 |
| | | gc.setBaseResultMap(true); //mapper.xml 生成 ResultMap |
| | | gc.setBaseColumnList(true); //mapper.xml 生成 ColumnList |
| | | // gc.setSwagger2(true); |
| | |
| | | // pc.setModuleName(scanner("模块名")); |
| | | pc.setModuleName(null); |
| | | pc.setParent("com.ycl"); |
| | | String packageName = scanner("请输入包名"); |
| | | final String packageName = scanner("请输入包名"); |
| | | //自定义所在包的名称 基本没必要 |
| | | pc.setEntity(PN_ENTITY + PN_DELIMITER + packageName); |
| | | pc.setController(PN_CONTROLLER + PN_DELIMITER + packageName); |
| | |
| | | // String templatePath = "/templates/mapper.xml.vm"; |
| | | |
| | | // 自定义输出配置 |
| | | List<FileOutConfig> focList = new ArrayList<>(); |
| | | List<FileOutConfig> focList = new ArrayList<FileOutConfig>(); |
| | | // 自定义配置会被优先输出 |
| | | focList.add(new FileOutConfig(templatePath) { |
| | | @Override |
| | |
| | | // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! |
| | | // return projectPath + "/coinyee-contract-generator/src/main/resources/mapper/" + pc.getModuleName() |
| | | // + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; |
| | | return projectPath + "/ycl-generator/src/main/resources/mapper/" |
| | | return projectPath + "/ycl-smoke/src/main/resources/mapper/" |
| | | + packageName + "/" + tableInfo.getEntityName() + "Mapper" + StringPool.DOT_XML; |
| | | } |
| | | }); |
| | |
| | | //去除字段前缀 |
| | | strategy.setFieldPrefix(""); |
| | | |
| | | List<TableFill> tableFills = new ArrayList<>(); |
| | | List<TableFill> tableFills = new ArrayList<TableFill>(); |
| | | |
| | | TableFill createTimeFill = new TableFill("createTime", FieldFill.INSERT); |
| | | TableFill modifiedTimeFill = new TableFill("modifiedTime", FieldFill.UPDATE); |