Commit cfd56ba8 by fudahua

Merge branch 'developer' into 'master'

feat: 回收站

See merge request !113
parents 752ef358 511cca5a
......@@ -43,6 +43,7 @@ public class StoreCodeQueryFilter implements BaseQueryFilter {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(context.getEnterpriseId());
storeSearchDTO.setSearchName(context.getSearch());
storeSearchDTO.setStatusIn("-3");
Page retPage = storeService.storeListPage(page, storeSearchDTO);
Page<StoreDTO> storeDTOPage = PageHelperUtils.changePageToCurrentPage(retPage, StoreDTO.class);
......
......@@ -41,6 +41,7 @@ public class StoreNameQueryFilter implements BaseQueryFilter {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(context.getEnterpriseId());
storeSearchDTO.setSearchName(context.getSearch());
storeSearchDTO.setStatusIn("-3");
Page retPage = storeService.storeListPage(page, storeSearchDTO);
Page<StoreDTO> storeDTOPage = PageHelperUtils.changePageToCurrentPage(retPage, StoreDTO.class);
......
package com.gic;
import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ctrip.framework.apollo.ConfigService;
import com.ctrip.framework.apollo.build.ApolloInjector;
import com.ctrip.framework.apollo.core.enums.Env;
import com.ctrip.framework.apollo.util.ConfigUtil;
import org.apache.commons.lang3.StringUtils;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class TestQuery {
public static void main(String[] args) {
System.setProperty("env","dev");
Env env= ApolloInjector.getInstance(ConfigUtil.class).getApolloEnv();
System.out.println("当前activity profile is :"+env.name());
ConfigService.getAppConfig();
DruidDataSource druidDataSource = new DruidDataSource();
druidDataSource.setUrl("jdbc:mysql://10.0.30.101:3306/datahook?useUnicode=true&characterEncoding=utf-8&statementInterceptors=com.gic.commons.mysql.APMStatementInterceptor");
druidDataSource.setUsername("datahook");
druidDataSource.setPassword("wyWEbOItmrpeZ4Lq");
try {
Db db = Db.use(druidDataSource);
List<Entity> list = db.findAll("dh_my_flat_query");
List<Entity> fields = db.findAll("dh_flat_query_field");
Map<String,String> fieldFilterMap=new HashMap<>();
for (Entity field : fields) {
Object filter_code = field.get("filter_code");
String tableId = field.getStr("table_id");
String fieldName = field.getStr("field_name");
String key=tableId+fieldName;
if (filter_code != null){
fieldFilterMap.put(key,(String) filter_code);
}
}
for (Entity entity : list) {
Object conditions_text = entity.get("conditions_text");
Object tableId = entity.get("table_id");
Object id = entity.get("id");
// if (!id.equals("1648002839121")){
// continue;
// }
JSONArray objects = JSONArray.parseArray((String) conditions_text);
boolean change=false;
for (int i = 0; i < objects.size(); i++) {
JSONObject jsonObject = objects.getJSONObject(i);
String fieldName = jsonObject.getString("fieldName");
String key=tableId+fieldName;
String filterCode = fieldFilterMap.get(key);
if (StringUtils.isBlank(filterCode)){
continue;
}
change=true;
jsonObject.put("filterCode",filterCode);
}
if (change){
String s = objects.toJSONString();
System.out.println("======================================");
System.out.println("id:"+id);
System.out.println("原始:"+conditions_text);
System.out.println("后来:"+s);
db.execute("update dh_my_flat_query set conditions_text = ?,update_time=now() where id = ?",s,id);
}
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment