Commit 735f5ace by Lee Munkyeong

グループ検索画面実装及びネームカード修正

parent ec9b0c65
......@@ -35,7 +35,7 @@ public interface ABookCommConstants {
String ROOM_NAME = "roomName";
String ATTEND_USERS = "attendUsers";
String MEMBER_NAME = "memberName";
String DEL_FLG = "del_flg";
String DEL_FLG = "delFlg";
String ROOM_TYPE = "roomType";
String GROUP_ID_LIST = "groupIdList";
String MESSAGE_INFO_LIST = "messageInfoList";
......@@ -47,6 +47,8 @@ public interface ABookCommConstants {
String GROUP_MEMBER_LIST = "groupMemberList";
String CHAT_ROOM_INFO_LIST = "chatRoomInfoList";
String LAST_MESSAGE_INFO = "lastMessageInfo";
String ROOT_GROUP_ID = "rootGroupId";
}
interface FLAG {
......
......@@ -90,6 +90,23 @@ public class GroupDao extends AbstractDao {
return rawQueryGetStringList(sql.toString(), null);
}
public List<String> getUserGroupPathList(Integer shopMemberId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" CASE WHEN (grandparentgroup.group_name IS NOT NULL) THEN grandparentgroup.group_name || ' / ' || parentgroup.group_name || ' / ' || usergroup.group_name ");
sql.append(" WHEN (parentgroup.group_name IS NOT NULL) THEN parentgroup.group_name || ' / ' || usergroup.group_name ");
sql.append(" ELSE usergroup.group_name ");
sql.append(" END AS group_path_list ");
sql.append(" FROM m_group usergroup ");
sql.append(" LEFT JOIN m_group parentgroup on usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE usergroup.group_id IN ");
sql.append(" (SELECT group_id ");
sql.append(" FROM m_shop_member sm INNER JOIN r_shop_member_group rsmg on sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE sm.shop_member_id = ? ) ");
return rawQueryGetStringList(sql.toString(), new String[] { "" + shopMemberId});
}
private String generateGetGroupsQuery(QueryType queryType, int[] groupRelationids, int[] parentGroupIds, Boolean downloaded, String searchKeyword, SearchDivisionType searchDivisionType, boolean isOnlineSearched) {
StringBuffer sql = new StringBuffer();
......@@ -528,7 +545,15 @@ public class GroupDao extends AbstractDao {
list = rawQueryGetDtoList("select * from m_group mg where (mg.parent_group_id = ?)", new String[]{""+ parentId}, GroupDto.class);
return list;
}
public GroupDto getRootGroup() {
return rawQueryGetDto("select * from m_group mg where (mg.parent_group_id = 0)",null, GroupDto.class);
}
public GroupDto getParentGroup(Integer childGroupId) {
return rawQueryGetDto("select parent.* from m_group parent inner join m_group child on child.parent_group_id = parent.group_id where child.group_id = ?",new String[]{""+ childGroupId}, GroupDto.class);
}
public boolean isExistParent(int baseId) {
return rawQueryGetInt("select * from m_group where parent_group_id = " + baseId, null) > 0;
}
......
......@@ -130,10 +130,12 @@ public class CommunicationLogic extends AbstractLogic {
List<ShopMemberDto> myGroupUsers = shopMemberDao.getMyGroupUsers();
JSONArray myGroupUsersJson = new JSONArray();
for (ShopMemberDto myGroupUser : myGroupUsers) {
List<String> groupPathList = groupDao.getUserGroupPathList(myGroupUser.shopMemberId);
Map<String, Object> myGroupUserMap = new HashMap<String, Object>();
myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, myGroupUser.shopMemberId);
myGroupUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, myGroupUser.shopMemberName);
myGroupUserMap.put(ABookCommConstants.KEY.PROFILE_URL, myGroupUser.profileUrl);
myGroupUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList);
JSONObject jsonObject = new JSONObject(myGroupUserMap);
myGroupUsersJson.put(jsonObject);
}
......@@ -160,9 +162,11 @@ public class CommunicationLogic extends AbstractLogic {
JSONArray resultJsonArray = new JSONArray();
for (ShopMemberDto favoriteUser : favoriteUsers) {
Map<String, Object> favoriteUserMap = new HashMap<String, Object>();
List<String> groupPathList = groupDao.getUserGroupPathList(favoriteUser.shopMemberId);
favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_ID, favoriteUser.shopMemberId);
favoriteUserMap.put(ABookCommConstants.KEY.SHOP_MEMBER_NAME, favoriteUser.shopMemberName);
favoriteUserMap.put(ABookCommConstants.KEY.PROFILE_URL, favoriteUser.profileUrl);
favoriteUserMap.put(ABookCommConstants.KEY.GROUP_PATH_LIST, groupPathList);
JSONObject jsonObject = new JSONObject(favoriteUserMap);
resultJsonArray.put(jsonObject);
}
......@@ -195,13 +199,23 @@ public class CommunicationLogic extends AbstractLogic {
//パラメータグループIDが0であれば自分のグループ情報を取得。
GroupDto myGroup = groupDao.getUserGroups().get(0);
GroupDto rootGroup = groupDao.getRootGroup();
Integer targetGroupId;
if (groupId == 0) {
targetGroupId = myGroup.groupId;
targetGroupId = rootGroup.groupId;
} else {
targetGroupId = groupId;
}
GroupDto parentGroup = groupDao.getParentGroup(targetGroupId);
if (parentGroup != null) {
groupSearchData.put(ABookCommConstants.KEY.PARENT_GROUP_ID,parentGroup.groupId);
}
if (rootGroup != null) {
groupSearchData.put(ABookCommConstants.KEY.ROOT_GROUP_ID,rootGroup.groupId);
}
//グループ
List<GroupDto> groupPathList = groupDao.getGroupTree(targetGroupId);
JSONArray groupPathJSONArray = new JSONArray();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment