SpringBoot+Vue3 项目实战,打造企业级在线办公系统完整代码下载

760 阅读1分钟

Download:百度网盘

提取码:KYv8

public static void main(String[] args) { //构建一个代码生成器 AutoGenerator mpg = new AutoGenerator(); //配置策略

    //1、全局配置
    GlobalConfig gc = new GlobalConfig();
    String projectPath = System.getProperty("user.dir");
    gc.setOutputDir(projectPath + "/src/main/java");
    gc.setAuthor("Wangguo");
    gc.setOpen(false);
    gc.setFileOverride(false);
    gc.setServiceImplName("%sService");
    gc.setIdType(IdType.ID_WORKER);
    gc.setDateType(DateType.ONLY_DATE);
    gc.setSwagger2(true);
    mpg.setGlobalConfig(gc);

    //配置数据源
    DataSourceConfig dsc = new DataSourceConfig();
    dsc.setUrl("jdbc:mysql://localhost:3306/art_evaluation?useSSL=false&characterEncoding=utf-8&useUnicode=true&serverTimezone=GMT%2B8");
    dsc.setDriverName("com.mysql.cj.jdbc.Driver");
    dsc.setUsername("root");
    dsc.setPassword("000000");
    dsc.setDbType(DbType.MYSQL);
    mpg.setDataSource(dsc);

    //包配置
    PackageConfig pc = new PackageConfig();
    //pc.setModuleName("evaluation");
    pc.setParent("com.ghhd");
    pc.setEntity("entity");
    pc.setMapper("mapper");
    pc.setService("service");
    pc.setController("controller");
    mpg.setPackageInfo(pc);

    //策略配置
    StrategyConfig strategy = new StrategyConfig();
    //配置要映射的表名
    strategy.setInclude("data_domain","field","view","dash_board","view_dash_board");
    strategy.setNaming(NamingStrategy.underline_to_camel);
    strategy.setColumnNaming(NamingStrategy.underline_to_camel);
    strategy.setEntityLombokModel(true);
    strategy.setLogicDeleteFieldName("status");
    //自动填充配置
    TableFill createTime = new TableFill("create_time", FieldFill.INSERT);
    TableFill updateTime = new TableFill("update_time",FieldFill.UPDATE);
    ArrayList<TableFill> tableFills = new ArrayList<>();
    tableFills.add(createTime);
    tableFills.add(updateTime);

    strategy.setTableFillList(tableFills);
    strategy.setRestControllerStyle(true);
    strategy.setControllerMappingHyphenStyle(true);
    mpg.setStrategy(strategy);
    mpg.execute();
}