/** * 保存好友列表. 请在后台操作。 * * @param customerVos * @return 作者:fighter <br> * 创建时间:2013-5-31<br> * 修改时间:<br> */ public boolean saveFriendList(List<CustomerVo> customerVos) { Log.d(TAG, "saveFriendList()"); try { friendListVo = new FriendListVo(); friendListVo.setUid(userInfoVo.getUid()); friendListVo.setUpdateTime(System.currentTimeMillis() + ""); StringBuffer buffer = new StringBuffer(); int index = customerVos.size(); for (int i = 0; i < index; i++) { CustomerVo customerVo = customerVos.get(i); customerVo.setFriend("1"); buffer.append("'").append(customerVo.getUid()).append("'"); if (i == (index - 1)) { continue; } buffer.append(","); } String friends = buffer.toString(); friendListVo.setFriends(friends); finalDb.delete(friendListVo); finalDb.save(friendListVo); finalDb.deleteByWhere(CustomerVo.class, "uid in (" + friends + ")"); finalDb.saveList(customerVos); return true; } catch (Exception e) { e.printStackTrace(); return false; } }
private boolean saveFriendListDb(String cvos) { Log.d(TAG, "saveFriendListDb()"); try { friendListVo = new FriendListVo(); friendListVo.setUid(userInfoVo.getUid()); friendListVo.setUpdateTime(System.currentTimeMillis() + ""); friendListVo.setFriends(cvos); finalDb.update(friendListVo); return true; } catch (Exception e) { return false; } }