对比数据工具

1.查询对比

List<Map<String,Object>> listObj103=service.compareMenu(VersionDBService.VER_103,"t_menu_inter");
//System.out.println(new Gson().toJson(listObj103));

List<Map<String,Object>> listObj20=service.compareMenu(VersionDBService.VER_20,"t_menu_inter");
//System.out.println(new Gson().toJson(listObj20));

Gson gson=new Gson();
Set<String> data103=new HashSet<>();
for(int i=0;i<listObj103.size();i++){
    data103.add(gson.toJson(listObj103.get(i)));
}

Set<String> data20=new HashSet<>();
for(int i=0;i<listObj20.size();i++){
    data20.add(gson.toJson(listObj20.get(i)));
}
for(String data:data103){
    if(!data20.contains(data)){
        System.out.println("20多的:"+data);
    }
}
for(String data:data20){
    if(!data103.contains(data)){
        System.out.println("103多的:"+data);
    }
}

2. Service查询

public List<Map<String,Object>> compareMenu(String version,String table){
    MapperDealService md=new MapperDealService(){
        @Override
        public Object deal() {
            //List<Menu> menuList = versionDBMapper.selectMenuAll();
            return compareTabMapper.queryTabData(table);
        }
    };
    return (List<Map<String,Object>>)md.around(version);
}

3.代码

select * from ${table} order by id

文/程忠 浏览次数:0次   2024-02-06 11:29:31

相关阅读


评论:
点击刷新

↓ 广告开始-头部带绿为生活 ↓
↑ 广告结束-尾部支持多点击 ↑