feat: 完成代码生成模板(1.0)

This commit is contained in:
xlsea 2024-09-08 21:49:27 +08:00
parent ff3ed20bba
commit 7ec50da49b

View File

@ -26,7 +26,7 @@
velocityContext.put("pkColumn", genTable.getPkColumn());
velocityContext.put("importList", getImportList(genTable));
velocityContext.put("permissionPrefix", getPermissionPrefix(moduleName, businessName));
velocityContext.put("columns", genTable.getColumns());
velocityContext.put("columns", getColumns(genTable));
velocityContext.put("table", genTable);
velocityContext.put("dicts", getDicts(genTable));
velocityContext.put("dictList", getDictList(genTable));
@ -170,3 +170,19 @@
}
}
}
/**
* 根据列类型获取字典组
*
* @param genTable 业务表对象
* @return 返回字典组
*/
public static List<GenTableColumn> getColumns(GenTable genTable) {
List<GenTableColumn> columns = genTable.getColumns();
for (GenTableColumn column : columns) {
if (StringUtils.isNotBlank(column.getDictType())) {
column.setDictType(StringUtils.toCamelCase(column.getDictType()));
}
}
return columns;
}