Skip to content

Commit 9d87a42

Browse files
committed
[fix]:下掉bson
1 parent 00c70f1 commit 9d87a42

5 files changed

Lines changed: 158 additions & 144 deletions

File tree

chat2db-server/chat2db-spi/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@
8080
<version>1.19.0</version> <!-- Make sure to use the latest version -->
8181
</dependency>
8282

83-
<!-- https://mvnrepository.com/artifact/org.mongodb/bson -->
84-
<dependency>
85-
<groupId>org.mongodb</groupId>
86-
<artifactId>bson</artifactId>
87-
</dependency>
8883
<dependency>
8984
<groupId>org.antlr</groupId>
9085
<artifactId>antlr4</artifactId>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package ai.chat2db.spi.sql;
2+
3+
import java.util.LinkedHashMap;
4+
import java.util.Map;
5+
6+
import com.alibaba.fastjson2.JSON;
7+
import com.alibaba.fastjson2.JSONObject;
8+
9+
/**
10+
* @author luojun
11+
* @version 1.0
12+
* @description: 接口定义
13+
* @date 2024/5/31 19:05
14+
**/
15+
public class DocumentUtils {
16+
17+
public static LinkedHashMap<String, Object> convertToMap(Object obj) {
18+
LinkedHashMap<String, Object> map = new LinkedHashMap<>();
19+
if (obj != null) {
20+
String json = JSON.toJSONString(obj);
21+
JSONObject jsonObject = JSON.parseObject(json);
22+
JSONObject m = jsonObject.getJSONObject("documentAsMap");
23+
if (m != null) {
24+
for (Map.Entry<String, Object> entry : m.entrySet()) {
25+
map.put(entry.getKey(), entry.getValue());
26+
}
27+
}
28+
}
29+
return map;
30+
}
31+
}
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
package ai.chat2db.spi.sql;
2-
3-
import org.bson.json.Converter;
4-
import org.bson.json.StrictJsonWriter;
5-
import org.bson.types.ObjectId;
6-
7-
public class MongExtendedJsonObjectIdConverter implements Converter<ObjectId> {
8-
@Override
9-
public void convert(final ObjectId value, final StrictJsonWriter writer) {
10-
writer.writeStartObject();
11-
writer.writeString("", value.toHexString());
12-
writer.writeEndObject();
13-
}
14-
}
1+
//package ai.chat2db.spi.sql;
2+
//
3+
//import org.bson.json.Converter;
4+
//import org.bson.json.StrictJsonWriter;
5+
//import org.bson.types.ObjectId;
6+
//
7+
//public class MongExtendedJsonObjectIdConverter implements Converter<ObjectId> {
8+
// @Override
9+
// public void convert(final ObjectId value, final StrictJsonWriter writer) {
10+
// writer.writeStartObject();
11+
// writer.writeString("", value.toHexString());
12+
// writer.writeEndObject();
13+
// }
14+
//}

0 commit comments

Comments
 (0)