Open tanfen100 opened 1 year ago
DemoParser 重写 getMaxQueryCount,具体看常见问题
apijson 支持增量加载.自己可以扩展, 参见示例如下代码:
int eveNum = 1;
while (true) {
JSONObject table = new JSONObject();
table.put("id{}", ">=" + (30 * eveNum));
table.setOrder("id+");
APIJSONVerifier.initAccess(IS_INIT_SHUTDOWNWHENSERVERERROR,
APIJSONApplication.DEFAULT_APIJSON_CREATOR, table);
int tmp_accessMapCount = AbstractVerifier.getAccessSize();
if (accessMapCount == tmp_accessMapCount) {
break;
} else {
accessMapCount = tmp_accessMapCount;
}
eveNum++;
}
apijson 支持增量加载.自己可以扩展, 参见示例如下代码:
int eveNum = 1; while (true) { JSONObject table = new JSONObject(); table.put("id{}", ">=" + (30 * eveNum)); table.setOrder("id+"); APIJSONVerifier.initAccess(IS_INIT_SHUTDOWNWHENSERVERERROR, APIJSONApplication.DEFAULT_APIJSON_CREATOR, table); int tmp_accessMapCount = AbstractVerifier.getAccessSize(); if (accessMapCount == tmp_accessMapCount) { break; } else { accessMapCount = tmp_accessMapCount; } eveNum++; }
这样更好,不会把业务表查询限制放得很开
其实之前已经针对 APIJSON 配置表,用 SQLConfig.limitCount 做了不设置查询上限数量的处理 https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java#L847-L850
但因为 APIJSONVerifier.initAccess 中 accessItem.toArray(0, 0, ACCESS_) 传参 0 导致只能按 Parser.getMaxQueryCount 返回的最大数量查询
https://github.com/APIJSON/apijson-framework/blob/master/src/main/java/apijson/framework/APIJSONVerifier.java#L168-L171
所以需要改为 accessItem.toArray(null, 0, ACCESS_),但因为这个方法参数类型为 int 不能传 null,所以也需要把 int 改为 Integer,最好 int count, int page 都改为 Integer https://github.com/Tencent/APIJSON/blob/master/APIJSONORM/src/main/java/apijson/JSONRequest.java#L164-L180
改了后麻烦提交 PR 贡献代码,开源要大家一起参与贡献才会更美好~ https://github.com/Tencent/APIJSON/blob/master/CONTRIBUTING.md
Description
权限查询ACCESS的时候,只查询前100条,现在表里面超过100条无法查到,导致权限无法生效