From 86f54bbd53c060bb57da9c0f28ea52b4db685e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=B7?= <10402852@qq.com> Date: Wed, 18 Dec 2024 08:08:15 +0800 Subject: [PATCH] 'commit' --- .../base/DataEase/Util/Step2_CopyFilter.java | 24 ++++--------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/dsideal/base/DataEase/Util/Step2_CopyFilter.java b/src/main/java/com/dsideal/base/DataEase/Util/Step2_CopyFilter.java index 92ba8f61..b86ee0e9 100644 --- a/src/main/java/com/dsideal/base/DataEase/Util/Step2_CopyFilter.java +++ b/src/main/java/com/dsideal/base/DataEase/Util/Step2_CopyFilter.java @@ -151,29 +151,15 @@ public class Step2_CopyFilter { sql = "select * from core_chart_view where scene_id=? and table_id>0 and type not like '%map%'"; List list = Db.use(DB_NAME).find(sql, childId); String custom_filter_json = cn.hutool.core.io.FileUtil.readUtf8String(PathKit.getRootClassPath() + "/Data/filter.json"); - int idx = 0; for (Record record : list) { - System.out.println("正在设置第" + (++idx) + "个数据~"); - long dataset_id = record.getLong("table_id"); - System.out.println("dataset_id=" + dataset_id); - sql = "select id from core_dataset_table_field where dataset_table_id =(" + - " select id from core_dataset_table where dataset_group_id=(select id from core_dataset_group where id=?)" + - ") and origin_name='行政区划'"; - Record r = Db.use(DB_NAME).findFirst(sql, dataset_id); - if (r == null) continue; - long field_id = r.getLong("id"); long id = record.getLong("id"); - String custom_filter = record.getStr("custom_filter");//原来的过滤器 - JSONObject jo = JSONObject.parseObject(custom_filter);//还原原来的过滤器为JSONObject - jo.put("logic", "and");//过滤器默认连接器修改为and + String custom_filter = record.getStr("custom_filter"); + JSONObject jo = JSONObject.parseObject(custom_filter); + jo.put("logic","and"); if (jo.getJSONArray("items") == null) { - JSONObject newJo = JSONObject.parseObject(custom_filter_json); - newJo.getJSONArray("items").getJSONObject(0).put("fieldId", field_id); - jo = newJo;//修改掉fieldId + jo=JSONObject.parseObject(custom_filter_json); } else { - JSONObject newJo = JSONObject.parseObject(custom_filter_json); - newJo.getJSONArray("items").getJSONObject(0).put("fieldId", field_id); - jo.getJSONArray("items").add(newJo);//添加上newJo + jo.getJSONArray("items").add(JSONObject.parseObject(custom_filter_json).getJSONArray("items").getJSONObject(0)); } sql = "update core_chart_view set custom_filter=? where id=?"; Db.use(DB_NAME).update(sql, jo.toString(), id);