/** * @todo:插入一个群成员 * @date:2014-12-22 上午10:55:07 * @author:[email protected] * @params:@param dbHelper * @params:@param FriendBean */ public static void insertFriendBean( DBHelper dbHelper, String hxGroupId, String groupId, FriendBean f) { ContentValues values = new ContentValues(); values.put(DBHelper.CLOUMN_CURRENT_USER_ID, BGApp.mUserId); values.put(DBHelper.GroupMember.GM_HX_GROUPID, hxGroupId); values.put(DBHelper.GroupMember.GM_GROUPID, groupId); values.put(DBHelper.GroupMember.GM_USERID, f.userid); values.put(DBHelper.GroupMember.GM_TYPE, f.type); values.put(DBHelper.GroupMember.GM_SIGNATURE, f.signature); values.put(DBHelper.GroupMember.GM_SEX, f.sex); values.put(DBHelper.GroupMember.GM_PHOTO, f.photo); values.put(DBHelper.GroupMember.GM_NAME, f.name); values.put(DBHelper.GroupMember.GM_LEVEL, f.level); long count = dbHelper.insert(DBHelper.TB_GROUP_MEMBER, values); LogUtils.i("--------插入群成员-------" + count); }
/** * @todo:批量插入群成员 * @date:2014-12-22 上午10:36:29 * @author:[email protected] * @params: */ public static void storeGroupMemberBean( DBHelper dbHelper, String hxGroupId, String groupId, List<FriendBean> lists) { ArrayList<ContentValues> list = new ArrayList<ContentValues>(); for (FriendBean f : lists) { ContentValues values = new ContentValues(); values.put(DBHelper.CLOUMN_CURRENT_USER_ID, BGApp.mUserId); values.put(DBHelper.GroupMember.GM_HX_GROUPID, hxGroupId); values.put(DBHelper.GroupMember.GM_GROUPID, groupId); values.put(DBHelper.GroupMember.GM_USERID, f.userid); values.put(DBHelper.GroupMember.GM_TYPE, f.type); values.put(DBHelper.GroupMember.GM_SIGNATURE, f.signature); values.put(DBHelper.GroupMember.GM_SEX, f.sex); values.put(DBHelper.GroupMember.GM_PHOTO, f.photo); values.put(DBHelper.GroupMember.GM_NAME, f.name); values.put(DBHelper.GroupMember.GM_LEVEL, f.level); list.add(values); } int count = dbHelper.insert(DBHelper.TB_GROUP_MEMBER, list); LogUtils.i("-----------批量插入群成员----" + count); }