Skip to content

Commit 0e227b0

Browse files
committed
Server:解决PostgreSQL的json类型字段返回的值总是多包一层的对象
1 parent 445bb34 commit 0e227b0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

APIJSON-Java-Server/APIJSONBoot/src/main/java/apijson/demo/server/DemoSQLExecutor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@
3030

3131
import javax.validation.constraints.NotNull;
3232

33+
import org.postgresql.util.PGobject;
34+
3335
import com.alibaba.fastjson.JSONObject;
3436

37+
import zuo.biao.apijson.JSON;
3538
import zuo.biao.apijson.Log;
3639
import zuo.biao.apijson.server.AbstractSQLExecutor;
3740
import zuo.biao.apijson.server.SQLConfig;
@@ -136,7 +139,10 @@ else if (value instanceof Clob) {
136139
}
137140
value = sb.toString();
138141
}
139-
142+
else if (value instanceof PGobject) {
143+
value = JSON.parse(((PGobject) value).getValue());
144+
}
145+
140146
return value;
141147
}
142148

0 commit comments

Comments
 (0)