feat(taikai2312): 增加额外条件处理功能并优化项目设置
- 在 QuerySync 类中添加处理额外条件的功能,允许在查询时传入额外的筛选条件 - 在项目设置中添加 filteredResources 配置,用于过滤掉不必要的文件和目录
This commit is contained in:
parent
ea3280c553
commit
e1b8802660
|
@ -39,7 +39,20 @@ public class QuerySync extends AbstractNCCRestResource {
|
||||||
Map<String, Object> data = apiUfinterface.getData().getParamdata();
|
Map<String, Object> data = apiUfinterface.getData().getParamdata();
|
||||||
JSONObject pageInfo = (JSONObject) JSONObject.toJSON(apiUfinterface.getPageInfo());
|
JSONObject pageInfo = (JSONObject) JSONObject.toJSON(apiUfinterface.getPageInfo());
|
||||||
data.remove("type"); // 移除类型参数,因为它仅用于路由,向下传递会影响查询
|
data.remove("type"); // 移除类型参数,因为它仅用于路由,向下传递会影响查询
|
||||||
|
|
||||||
|
// 获取额外条件
|
||||||
|
String extraCondition = null;
|
||||||
|
if (data.containsKey("extraCondition")) {
|
||||||
|
extraCondition = (String) data.get("extraCondition");
|
||||||
|
data.remove("extraCondition"); // 移除额外条件参数,防止影响查询
|
||||||
|
}
|
||||||
|
|
||||||
String condition = QuerySyncSqlUtils.buildUniversalCondition(data);
|
String condition = QuerySyncSqlUtils.buildUniversalCondition(data);
|
||||||
|
|
||||||
|
// 如果存在额外条件,拼接到条件后面
|
||||||
|
if (extraCondition != null && !extraCondition.isEmpty()) {
|
||||||
|
condition = condition + " AND " + extraCondition;
|
||||||
|
}
|
||||||
|
|
||||||
String countSql = "SELECT " + pkColumnName + " FROM " + viewName + " WHERE " + condition;
|
String countSql = "SELECT " + pkColumnName + " FROM " + viewName + " WHERE " + condition;
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -63,6 +76,7 @@ public class QuerySync extends AbstractNCCRestResource {
|
||||||
return ResultMessageUtil.toJSONByPage(rows, openApiPageInfo, false);
|
return ResultMessageUtil.toJSONByPage(rows, openApiPageInfo, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("query")
|
@Path("query")
|
||||||
@Consumes({"application/json"})
|
@Consumes({"application/json"})
|
||||||
|
|
Loading…
Reference in New Issue