private List<String> getTableNames(CodegenParameters cgParams) throws Exception {
   List<String> tableList = new ArrayList<String>();
   if (StringUtil.isEmpty(cgParams.getTableNames())) {
     tableList = CodeGenUtil.getTableList();
   } else {
     tableList.add(cgParams.getTableNames());
   }
   return tableList;
 }
  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);
  }