jdbcTemplate

@Override
public void initRelation(String moblie) { // 初始化人脉关系并建立好友关系,如果人脉表中有 则人脉表插入用户id Date now=new Date(); List<Map<String,Object>> relationList=null; UserMb user = queryForObject(QUERY_BY_MOBILE,UserMb.class,moblie); if(user!=null){ if(user.getBindPhone()!=null&&!"".equals(user.getBindPhone())){ relationList =jdbcTemplate.queryForList(QUERY_RELATION_BY_MOBILE,user.getBindPhone()); } if(relationList!=null&&!relationList.isEmpty()){ for(Map<String,Object> relation:relationList){ String mobile=relation.get("mobile").toString(); String uid=relation.get("uid").toString(); String u_real_name=relation.get("u_real_name").toString(); jdbcTemplate.update(UPDATE_RELATION_USERID,new Object[]{user.getId(),now,mobile}); jdbcTemplate.update(INSERT_IMUSER_RELATION,new Object[]{user.getUid(),uid,"1",u_real_name,now}); } } } }

 

posted on 2015-07-07 18:46  52_it  阅读(121)  评论(0编辑  收藏  举报