fixed: 修复 Table.camelToUnderline 在 apt 上配置不生效的问题

This commit is contained in:
开源海哥 2023-05-25 10:00:28 +08:00
parent 06c756d861
commit f64ff59aab

View File

@ -188,7 +188,7 @@ public class QueryEntityProcessor extends AbstractProcessor {
TypeElement classElement = (TypeElement) entityClassElement; TypeElement classElement = (TypeElement) entityClassElement;
do { do {
fillPropertyAndColumns(propertyAndColumns, defaultColumns, classElement); fillPropertyAndColumns(propertyAndColumns, defaultColumns, classElement, (table == null || table.camelToUnderline()));
classElement = (TypeElement) typeUtils.asElement(classElement.getSuperclass()); classElement = (TypeElement) typeUtils.asElement(classElement.getSuperclass());
} while (classElement != null); } while (classElement != null);
@ -233,7 +233,7 @@ public class QueryEntityProcessor extends AbstractProcessor {
} }
private void fillPropertyAndColumns(Map<String, String> propertyAndColumns, List<String> defaultColumns, TypeElement classElement) { private void fillPropertyAndColumns(Map<String, String> propertyAndColumns, List<String> defaultColumns, TypeElement classElement, boolean camelToUnderline) {
for (Element fieldElement : classElement.getEnclosedElements()) { for (Element fieldElement : classElement.getEnclosedElements()) {
//all fields //all fields
@ -286,7 +286,8 @@ public class QueryEntityProcessor extends AbstractProcessor {
} }
String columnName = column != null && column.value().trim().length() > 0 ? column.value() : camelToUnderline(fieldElement.toString()); String columnName = column != null && column.value().trim().length() > 0 ? column.value() :
(camelToUnderline ? camelToUnderline(fieldElement.toString()) : fieldElement.toString());
propertyAndColumns.put(fieldElement.toString(), columnName); propertyAndColumns.put(fieldElement.toString(), columnName);
if (column == null || (!column.isLarge() && !column.isLogicDelete())) { if (column == null || (!column.isLarge() && !column.isLogicDelete())) {