use of com.akaxin.site.storage.bean.GroupMemberBean in project openzaly by akaxincom.
the class SQLiteUserGroupDao method queryGroupMemberList.
public List<GroupMemberBean> queryGroupMemberList(String groupId, int pageNum, int pageSize) throws SQLException {
long startTime = System.currentTimeMillis();
List<GroupMemberBean> membersList = new ArrayList<GroupMemberBean>();
int startNum = (pageNum - 1) * pageSize;
String sql = "SELECT DISTINCT a.site_user_id,b.user_name,b.user_photo,a.user_role FROM " + USER_GROUP_TABLE + " AS a LEFT JOIN " + SQLConst.SITE_USER_PROFILE + " AS b WHERE a.site_user_id=b.site_user_id AND a.site_group_id=? limit ?,?;";
PreparedStatement preStatement = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preStatement.setString(1, groupId);
preStatement.setInt(2, startNum);
preStatement.setInt(3, pageSize);
ResultSet rs = preStatement.executeQuery();
while (rs.next()) {
GroupMemberBean member = new GroupMemberBean();
member.setUserId(rs.getString(1));
member.setUserName(rs.getString(2));
member.setUserPhoto(rs.getString(3));
member.setUserRole(rs.getInt(4));
membersList.add(member);
}
long endTime = System.currentTimeMillis();
LogUtils.dbDebugLog(logger, startTime, membersList.toString(), sql + "," + groupId);
return membersList;
}
use of com.akaxin.site.storage.bean.GroupMemberBean in project openzaly by akaxincom.
the class SQLiteUserGroupDao method queryNonGroupMemberList.
public List<GroupMemberBean> queryNonGroupMemberList(String groupId, int pageNum, int pageSize) throws SQLException {
long startTime = System.currentTimeMillis();
List<GroupMemberBean> membersList = new ArrayList<GroupMemberBean>();
int startNum = (pageNum - 1) * pageSize;
String sql = "SELECT site_user_id,user_name,user_photo FROM " + SQLConst.SITE_USER_PROFILE + " WHERE site_user_id NOT IN (SELECT DISTINCT site_user_id FROM " + SQLConst.SITE_USER_GROUP + " WHERE site_group_id=?) LIMIT ?,?;";
PreparedStatement preStatement = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preStatement.setString(1, groupId);
preStatement.setInt(2, startNum);
preStatement.setInt(3, pageSize);
ResultSet rs = preStatement.executeQuery();
while (rs.next()) {
GroupMemberBean member = new GroupMemberBean();
member.setUserId(rs.getString(1));
member.setUserName(rs.getString(2));
member.setUserPhoto(rs.getString(3));
member.setUserRole(GroupProto.GroupMemberRole.NONMEMBER_VALUE);
membersList.add(member);
}
long endTime = System.currentTimeMillis();
LogUtils.dbDebugLog(logger, startTime, membersList.toString(), sql + "," + groupId);
return membersList;
}
Aggregations