Example #1
0
  public void execute() throws Exception {
    CodegenParameters cgParams =
        new CodegenParameters(CGToolInfo.getInstance().getCgToolProperties());

    System.setProperty(DBInfo.USE_DATASOURCE, DBInfo.USE_DATASOURCE_FALSE);

    List<String> tableList = getTableNames(cgParams);

    if (tableList.isEmpty()) return;

    for (String tableName : tableList) {
      Map<String, DBColumn> dbColumnMap = CodeGenUtil.loadColumnMap(tableName);

      if (dbColumnMap == null || dbColumnMap.isEmpty()) continue;

      CgObject cgObject = new CgObject(tableName, cgParams);

      cgObject.prepareCgObject(dbColumnMap);

      cgObject.generateCode();
    }
    CodeGenUtil.createConfigFiles(cgParams);
  }