|
@@ -123,45 +123,6 @@ public class QueryBySqlDto {
|
|
|
+ EQ + queryBySql.getDeputyTableName() + POINT + queryBySql.getDeputyTableNameRelKey();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 功能描述: 传到mapper层,判断是否需要转义
|
|
|
- *
|
|
|
- * @param columns columns
|
|
|
- * @param condition condition
|
|
|
- * @return com.alibaba.fastjson.JSONObject
|
|
|
- */
|
|
|
- public static JSONObject packLeftJoinCondition(List<GenTableColumn> columns, JSONObject condition) {
|
|
|
- if (isEmpty(condition)) {
|
|
|
- return condition;
|
|
|
- }
|
|
|
-
|
|
|
- JSONObject result = new JSONObject(columns.size());
|
|
|
- for (Map.Entry<String, Object> entry : condition.entrySet()) {
|
|
|
- String key = entry.getKey();
|
|
|
- key = getColumnNameFromCondition(key);
|
|
|
- Object value = entry.getValue();
|
|
|
- for (GenTableColumn column : columns) {
|
|
|
- if (!column.getColumnName().equalsIgnoreCase(key)) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- // long string collection 暂时只作此三种类型判断
|
|
|
- if (!isEmpty(value)) {
|
|
|
- // columnType 作为判断需不需要转义的一个标准,防止索引失效
|
|
|
- List<Object> objects = new ArrayList<>(3);
|
|
|
- objects.add(value);
|
|
|
- objects.add(column.getQueryType());
|
|
|
- objects.add(column.getColumnType());
|
|
|
- result.put(key, objects);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 功能描述: 表名.属性名 取出属性名
|
|
|
*
|
|
@@ -173,7 +134,7 @@ public class QueryBySqlDto {
|
|
|
throw new IllegalArgumentException("key为空");
|
|
|
}
|
|
|
|
|
|
- String[] split = key.split("\\.");
|
|
|
+ String[] split = key.split("\\$");
|
|
|
assert split.length == 2;
|
|
|
// split[0] 表名, split[1] 属性名
|
|
|
return split[1].trim();
|
|
@@ -189,6 +150,10 @@ public class QueryBySqlDto {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public static String packColumn(String tableName, String columnName) {
|
|
|
+ return tableName + POINT + columnName;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/******************************************************** get set ********************************************************/
|
|
|
|