Skip to content

Commit 0ab8601

Browse files
committed
Server:新增Request和Response的查询
1 parent 3da8684 commit 0ab8601

File tree

6 files changed

+76
-7
lines changed

6 files changed

+76
-7
lines changed

APIJSON-Java-Server/APIJSON-Eclipse/src/main/java/apijson/demo/server/Verifier.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
import zuo.biao.apijson.RequestMethod;
4747
import zuo.biao.apijson.RequestRole;
4848
import zuo.biao.apijson.model.Column;
49+
import zuo.biao.apijson.model.Request;
50+
import zuo.biao.apijson.model.Response;
4951
import zuo.biao.apijson.model.Table;
5052
import zuo.biao.apijson.model.Test;
5153
import zuo.biao.apijson.server.JSONRequest;
@@ -76,6 +78,8 @@ public class Verifier {
7678
ACCESS_MAP.put(Table.class.getSimpleName(), getAccessMap(Table.class.getAnnotation(MethodAccess.class)));
7779
ACCESS_MAP.put(Column.class.getSimpleName(), getAccessMap(Column.class.getAnnotation(MethodAccess.class)));
7880
ACCESS_MAP.put(Test.class.getSimpleName(), getAccessMap(Test.class.getAnnotation(MethodAccess.class)));
81+
ACCESS_MAP.put(Request.class.getSimpleName(), getAccessMap(Request.class.getAnnotation(MethodAccess.class)));
82+
ACCESS_MAP.put(Response.class.getSimpleName(), getAccessMap(Response.class.getAnnotation(MethodAccess.class)));
7983

8084
ACCESS_MAP.put(User.class.getSimpleName(), getAccessMap(User.class.getAnnotation(MethodAccess.class)));
8185
ACCESS_MAP.put(Privacy.class.getSimpleName(), getAccessMap(Privacy.class.getAnnotation(MethodAccess.class)));
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.*/
14+
15+
package zuo.biao.apijson.model;
16+
17+
import zuo.biao.apijson.MethodAccess;
18+
19+
/**请求类
20+
* @author Lemon
21+
*/
22+
@MethodAccess(
23+
POST = {},
24+
PUT = {},
25+
DELETE = {}
26+
)
27+
public class Request {
28+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.*/
14+
15+
package zuo.biao.apijson.model;
16+
17+
import zuo.biao.apijson.MethodAccess;
18+
19+
/**结果类
20+
* @author Lemon
21+
*/
22+
@MethodAccess(
23+
POST = {},
24+
PUT = {},
25+
DELETE = {}
26+
)
27+
public class Response {
28+
}

APIJSON-Java-Server/APIJSON-Eclipse/src/main/java/zuo/biao/apijson/server/Operation.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
/*Copyright ©2016 TommyLemon(https://github.com/TommyLemon/APIJSON)
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.*/
14+
115
package zuo.biao.apijson.server;
216

317
import zuo.biao.apijson.StringUtil;

APIJSON-Java-Server/APIJSON-Eclipse/src/main/java/zuo/biao/apijson/server/sql/SQLConfig.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
import static zuo.biao.apijson.JSONObject.KEY_CONDITION;
2020
import static zuo.biao.apijson.JSONObject.KEY_GROUP;
2121
import static zuo.biao.apijson.JSONObject.KEY_HAVING;
22+
import static zuo.biao.apijson.JSONObject.KEY_ID;
23+
import static zuo.biao.apijson.JSONObject.KEY_ID_IN;
2224
import static zuo.biao.apijson.JSONObject.KEY_ORDER;
2325
import static zuo.biao.apijson.JSONObject.KEY_ROLE;
2426
import static zuo.biao.apijson.JSONObject.KEY_SCHEMA;
2527
import static zuo.biao.apijson.JSONRequest.KEY_COUNT;
2628
import static zuo.biao.apijson.JSONRequest.KEY_PAGE;
2729
import static zuo.biao.apijson.JSONRequest.KEY_QUERY;
28-
import static zuo.biao.apijson.JSONRequest.KEY_ID;
29-
import static zuo.biao.apijson.JSONRequest.KEY_ID_IN;
3030
import static zuo.biao.apijson.RequestMethod.DELETE;
3131
import static zuo.biao.apijson.RequestMethod.GET;
3232
import static zuo.biao.apijson.RequestMethod.POST;
@@ -54,7 +54,6 @@
5454
import apijson.demo.server.model.BaseModel;
5555
import apijson.demo.server.model.Privacy;
5656
import apijson.demo.server.model.User;
57-
import zuo.biao.apijson.JSONRequest;
5857
import zuo.biao.apijson.Log;
5958
import zuo.biao.apijson.RequestMethod;
6059
import zuo.biao.apijson.RequestRole;

APIJSON-Java-Server/APIJSON-Eclipse/src/main/java/zuo/biao/apijson/server/sql/SQLExecutor.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package zuo.biao.apijson.server.sql;
1616

1717
import java.sql.Connection;
18-
import java.sql.DatabaseMetaData;
1918
import java.sql.DriverManager;
2019
import java.sql.ResultSet;
2120
import java.sql.ResultSetMetaData;
@@ -118,7 +117,6 @@ public JSONObject getFromCache(String sql, int position, boolean isStatic) {
118117

119118
private Connection connection;
120119
private Statement statement;
121-
private DatabaseMetaData metaData;
122120
/**关闭连接,释放资源
123121
*/
124122
public void close() {
@@ -133,7 +131,6 @@ public void close() {
133131
} catch (SQLException e) {
134132
e.printStackTrace();
135133
}
136-
metaData = null;
137134
statement = null;
138135
cacheMap = null;
139136
}
@@ -162,7 +159,6 @@ public JSONObject execute(SQLConfig config) throws Exception {
162159
Log.i(TAG, "select connection " + (connection == null ? " = null" : ("isClosed = " + connection.isClosed()))) ;
163160
connection = getConnection();
164161
statement = connection.createStatement(); //创建Statement对象
165-
metaData = connection.getMetaData();
166162
}
167163
Log.i(TAG, "成功连接到数据库!");
168164
ResultSet rs = null;

0 commit comments

Comments
 (0)