|
@@ -613,10 +613,11 @@ public class AutoSqlInjector implements ISqlInjector {
|
|
|
|
|
|
// 主键处理
|
|
|
if (StringUtils.isNotEmpty(table.getKeyProperty())) {
|
|
|
+ String wordConvert = sqlWordConvert(table.getKeyProperty());
|
|
|
if (table.isKeyRelated()) {
|
|
|
- columns.append(table.getKeyColumn()).append(" AS ").append(sqlWordConvert(table.getKeyProperty()));
|
|
|
+ columns.append(table.getKeyColumn()).append(" AS ").append(sqlSelectAsColumnConvert(table.getKeyProperty()));
|
|
|
} else {
|
|
|
- columns.append(sqlWordConvert(table.getKeyProperty()));
|
|
|
+ columns.append(wordConvert);
|
|
|
}
|
|
|
if (_size >= 1) {
|
|
|
// 判断其余字段是否存在
|
|
@@ -637,7 +638,7 @@ public class AutoSqlInjector implements ISqlInjector {
|
|
|
} else {
|
|
|
// 字段属性不一致
|
|
|
columns.append(fieldInfo.getColumn());
|
|
|
- columns.append(" AS ").append(wordConvert);
|
|
|
+ columns.append(" AS ").append(sqlSelectAsColumnConvert(wordConvert));
|
|
|
}
|
|
|
if (i + 1 < _size) {
|
|
|
columns.append(",");
|
|
@@ -672,10 +673,11 @@ public class AutoSqlInjector implements ISqlInjector {
|
|
|
columns.append("<choose><when test=\"ew != null and ew.sqlSelect != null\">${ew.sqlSelect}</when><otherwise>");
|
|
|
// 主键处理
|
|
|
if (StringUtils.isNotEmpty(table.getKeyProperty())) {
|
|
|
+ String wordConvert = sqlWordConvert(table.getKeyProperty());
|
|
|
if (table.isKeyRelated()) {
|
|
|
- columns.append(table.getKeyColumn()).append(" AS ").append(sqlWordConvert(table.getKeyProperty()));
|
|
|
+ columns.append(table.getKeyColumn()).append(" AS ").append(sqlSelectAsColumnConvert(wordConvert));
|
|
|
} else {
|
|
|
- columns.append(sqlWordConvert(table.getKeyProperty()));
|
|
|
+ columns.append(wordConvert);
|
|
|
}
|
|
|
} else {
|
|
|
// 表字段处理
|
|
@@ -689,7 +691,7 @@ public class AutoSqlInjector implements ISqlInjector {
|
|
|
} else {
|
|
|
// 字段属性不一致
|
|
|
columns.append(fieldInfo.getColumn());
|
|
|
- columns.append(" AS ").append(wordConvert);
|
|
|
+ columns.append(" AS ").append(sqlSelectAsColumnConvert(wordConvert));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -697,6 +699,19 @@ public class AutoSqlInjector implements ISqlInjector {
|
|
|
return columns.toString();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * <p>
|
|
|
+ * select sql as 字段转换,默认原样返回,预留子类处理<br>
|
|
|
+ * 例如:com.baomidou.mybatisplus.mapper.PostgreSqlInjector<br>
|
|
|
+ * </p>
|
|
|
+ *
|
|
|
+ * @param columnStr 字段内容
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected String sqlSelectAsColumnConvert(String columnStr) {
|
|
|
+ return columnStr;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* SQL 查询条件
|