use of com.akaxin.site.storage.bean.SimpleGroupBean in project openzaly by akaxincom.
the class HttpGroupService method list.
/**
* 分页获取站点群列表
*
* @param command
* @return
*/
public CommandResponse list(Command command) {
CommandResponse commandResponse = new CommandResponse();
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
HaiGroupListProto.HaiGroupListRequest request = HaiGroupListProto.HaiGroupListRequest.parseFrom(command.getParams());
int pageNum = request.getPageNumber();
int pageSize = request.getPageSize();
LogUtils.requestDebugLog(logger, command, request.toString());
List<SimpleGroupBean> groupList = UserGroupDao.getInstance().getGroupList(pageNum, pageSize);
if (groupList != null) {
HaiGroupListProto.HaiGroupListResponse.Builder responseBuilder = HaiGroupListProto.HaiGroupListResponse.newBuilder();
for (SimpleGroupBean bean : groupList) {
responseBuilder.addGroupProfile(getSimpleGroupProfile(bean));
}
commandResponse.setParams(responseBuilder.build().toByteArray());
errCode = ErrorCode2.SUCCESS;
}
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
use of com.akaxin.site.storage.bean.SimpleGroupBean in project openzaly by akaxincom.
the class SQLiteUserGroupDao method queryUserGroups.
public List<SimpleGroupBean> queryUserGroups(String userId) throws SQLException {
long startTime = System.currentTimeMillis();
List<SimpleGroupBean> groupList = new ArrayList<SimpleGroupBean>();
String sql = "SELECT a.site_group_id,b.group_name,b.group_photo FROM " + USER_GROUP_TABLE + " AS a LEFT JOIN " + SQLConst.SITE_GROUP_PROFILE + " AS b WHERE a.site_group_id=b.site_group_id AND b.group_status>0 AND a.site_user_id=?;";
PreparedStatement preStatement = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preStatement.setString(1, userId);
ResultSet rs = preStatement.executeQuery();
while (rs.next()) {
SimpleGroupBean bean = new SimpleGroupBean();
bean.setGroupId(rs.getString(1));
bean.setGroupName(rs.getString(2));
bean.setGroupPhoto(rs.getString(3));
groupList.add(bean);
}
long endTime = System.currentTimeMillis();
LogUtils.dbDebugLog(logger, startTime, groupList.toString(), sql + userId + "," + userId);
return groupList;
}
use of com.akaxin.site.storage.bean.SimpleGroupBean in project openzaly by akaxincom.
the class ApiGroupService method list.
/**
* 获取用户群列表 <br>
* 无权限限制
*
* @param command
* @return
*/
public CommandResponse list(Command command) {
CommandResponse commandResponse = new CommandResponse().setAction(CommandConst.ACTION_RES);
ErrorCode2 errCode = ErrorCode2.ERROR;
try {
ApiGroupListProto.ApiGroupListRequest request = ApiGroupListProto.ApiGroupListRequest.parseFrom(command.getParams());
String siteUserId = command.getSiteUserId();
LogUtils.requestDebugLog(logger, command, request.toString());
if (StringUtils.isNotBlank(siteUserId) && siteUserId.equals(siteUserId)) {
List<SimpleGroupBean> groupBeanList = UserGroupDao.getInstance().getUserGroups(siteUserId);
ApiGroupListProto.ApiGroupListResponse.Builder responseBuilder = ApiGroupListProto.ApiGroupListResponse.newBuilder();
for (SimpleGroupBean groupBean : groupBeanList) {
GroupProto.SimpleGroupProfile groupProfile = GroupProto.SimpleGroupProfile.newBuilder().setGroupId(String.valueOf(groupBean.getGroupId())).setGroupName(String.valueOf(groupBean.getGroupName())).setGroupIcon(String.valueOf(groupBean.getGroupPhoto())).build();
responseBuilder.addList(groupProfile);
}
ApiGroupListProto.ApiGroupListResponse response = responseBuilder.build();
commandResponse.setParams(response.toByteArray());
errCode = ErrorCode2.SUCCESS;
} else {
errCode = ErrorCode2.ERROR_PARAMETER;
}
} catch (Exception e) {
errCode = ErrorCode2.ERROR_SYSTEMERROR;
LogUtils.requestErrorLog(logger, command, e);
}
return commandResponse.setErrCode2(errCode);
}
use of com.akaxin.site.storage.bean.SimpleGroupBean in project openzaly by akaxincom.
the class SQLiteGroupProfileDao method queryGroupList.
public List<SimpleGroupBean> queryGroupList(int pageNum, int pageSize) throws SQLException {
long startTime = System.currentTimeMillis();
String sql = "SELECT site_group_id,group_name,group_photo FROM " + GROUP_PROFILE_TABLE + " WHERE group_status>0 LIMIT ?,?;";
PreparedStatement preStatement = SQLiteJDBCManager.getConnection().prepareStatement(sql);
int startNum = (pageNum - 1) * pageSize;
preStatement.setInt(1, startNum);
preStatement.setInt(2, pageSize);
ResultSet rs = preStatement.executeQuery();
List<SimpleGroupBean> beanList = new ArrayList<SimpleGroupBean>();
while (rs.next()) {
SimpleGroupBean bean = new SimpleGroupBean();
bean.setGroupId(rs.getString(1));
bean.setGroupName(rs.getString(2));
bean.setGroupPhoto(rs.getString(3));
beanList.add(bean);
}
LogUtils.dbDebugLog(logger, startTime, beanList.size(), sql, pageNum, pageSize);
return beanList;
}
Aggregations