public Map<String, TableDescriptor> loadTables(Ioc ioc, String basePackageName, String outputDir, String basePath, String baseUri, String servPackageName, String modPackageName) throws Exception {
String packageName = modPackageName;
String filePath = modPackageName.replaceAll("\\.", "\\/");
URL url = Loader.class.getClassLoader().getResource(filePath);
String path;
if (url != null) {
path = url.getPath();
} else {
path = "target/classes/" + filePath;
}
File f = Files.createDirIfNoExists(path);
log.debug("output dir = " + f.getAbsolutePath());
String abstractPath = URLDecoder.decode(path, "utf8");
File[] files = Files.lsFile(abstractPath, (String)null);
Map<String, TableDescriptor> tables = new HashMap();
File[] var16 = files;
int var17 = files.length;
for(int var18 = 0; var18 < var17; ++var18) {
File file = var16[var18];
String fileName = file.getName().split("\\.")[0];
String className = packageName + "." + fileName;
if (!className.contains(".Model") && !className.contains(".em")) {
Class<?> modelClass = Class.forName(className);
Mirror<?> mirror = Mirror.me(modelClass);
Table tableAnno = (Table)mirror.getAnnotation(Table.class);
if (tableAnno != null) {
String tableName = tableAnno.value();
String entityName = modelClass.getSimpleName();
TableDescriptor table = new TableDescriptor(tableName, entityName, basePackageName, baseUri, servPackageName, modPackageName);
Comment comment = (Comment)mirror.getAnnotation(Comment.class);
if (comment != null) {
table.setLabel(comment.value());
} else {
table.setLabel(entityName);
}
tables.put(tableName, table);
tables.put(entityName, table);
Field[] fields = mirror.getFields();
Field[] var30 = fields;
int var31 = fields.length;
for(int var32 = 0; var32 < var31; ++var32) {
Field field = var30[var32];
ColumnDescriptor column = new ColumnDescriptor();
String fieldName = field.getName();
if (!fieldName.equals("opBy") && !fieldName.equals("opAt") && !fieldName.equals("delFlag")) {
column.setFieldName(fieldName);
Annotation[] annotations = field.getAnnotations();
Annotation[] var37 = annotations;
int var38 = annotations.length;
for(int var39 = 0; var39 < var38; ++var39) {
Annotation annotation = var37[var39];
if (annotation instanceof Comment) {
column.setLabel(((Comment)annotation).value());
column.setComment(((Comment)annotation).value());
}
if (annotation instanceof Id || annotation instanceof Name) {
column.primary = true;
table.setPkType(column.getSimpleJavaTypeName());
column.columnName = fieldName;
}
if (annotation instanceof ColDefine) {
ColType colType = ((ColDefine)annotation).type();
column.setColumnType(colType.name());
column.dataType = colType.name();
}
if (annotation instanceof Column) {
String columnName = ((Column)annotation).value();
if (Strings.isBlank(columnName)) {
column.columnName = fieldName;
} else {
column.columnName = columnName;
}
}
}
if (Strings.isEmpty(column.getLabel())) {
column.setLabel(fieldName);
}
table.addColumn(column);
}
}
}
}
}
return tables;
}
}
File f = Files.createDirIfNoExists(path);
log.debug("output dir = " + f.getAbsolutePath());
String abstractPath = URLDecoder.decode(path, "utf8");
File[] files = Files.lsFile(abstractPath, (String)null);
Map<String, TableDescriptor> tables = new HashMap();
File[] var16 = files;
int var17 = files.length;
for(int var18 = 0; var18 < var17; ++var18) {
File file = var16[var18];
String fileName = file.getName().split("\\.")[0];
String className = packageName + "." + fileName;
if (!className.contains(".Model") && !className.contains(".em")) {
Class<?> modelClass = Class.forName(className);
Mirror<?> mirror = Mirror.me(modelClass);
Table tableAnno = (Table)mirror.getAnnotation(Table.class);
if (tableAnno != null) {