java json merge_java merge json出错删除相同的json

/** 需要从数据库里获取 from tag_img tg LEFT JOIN img_center imc ON

* tg.img_md5=imc.img_md5 left join img_case c on imc.case_id=c.id

*

* where c.source_id='3f8b081edd0c4060805bf6a077f30679' and img_info LIKE

* '%脊柱侧弯%'*/

public voidimport8(){

List> list =jdbcTemplate

.queryForList("SELECT img_md5,tag_json FROM tag_img WHERE type_id='ff4dfd4ba7d949958b3d630a90fcca75' and tag_flag=1 limit 22,5");

System.out.println(list.size());int i=0;for(Maptagimg:list){

i++;

System.out.println(i);

String imgMd5= tagimg.get("img_md5").toString();

JSONArray array=JSONArray.parseArray(tagimg.get("tag_json").toString());//得到原来的json

System.out.println(array);

TagImgFilter filter= new TagImgFilter();//更改的集合

filter.setEq_orgId("c1fa7ba875fa4c9a899e2787eb79e802");

filter.setEq_setId("d5e8f01a2e6649cf877eacda8ceb6ff1");

filter.setEq_typeId("52336e7e43204fa68c006692b355137a");

filter.setEq_imgMd5(imgMd5);

TagImg imgnew= tagImgService.selectAll(filter).get(0);

JSONArray arraynew=JSONArray.parseArray(imgnew.getTagJson());

System.out.println("11111111111");

System.out.println(arraynew);for(int countjson=0;countjson

JSONObject jsonObj=array.getJSONObject(countjson);for(int countjsonnew=0;countjsonnew

JSONObject jsonDBle=arraynew.getJSONObject(countjsonnew);if (jsonObj.get("x").equals(jsonDBle.get("x")) && jsonObj.get("y").equals(jsonDBle.get("y")) && jsonObj.get("width").equals(jsonDBle.get("width")) && jsonObj.get("height").equals(jsonDBle.get("height"))){

System.out.println(jsonDBle);

arraynew.remove(jsonDBle);

}

System.out.println(arraynew);

System.out.println(arraynew.size());

}

}

imgnew.setTagJson(arraynew.toString());

tagImgService.save(imgnew);

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值