Commit 080f365a by Lee Munkyeong

Modify for offline status

parent f5246fcd
......@@ -54,6 +54,10 @@ public class ChatMessageDao extends AbstractDao {
if (column != -1) {
dto.savePath = cursor.getString(column);
}
column = cursor.getColumnIndex("insert_date");
if (column != -1) {
dto.savePath = cursor.getString(column);
}
return dto;
}
......@@ -63,11 +67,11 @@ public class ChatMessageDao extends AbstractDao {
}
public void insertChatMessage(ChatMessageDto dto) {
insert("insert into t_chat_message (chat_message_id, chat_room_id, shop_member_id, message, message_type, image_name, download_file_name, save_path) values (?,?,?,?,?,?,?,?)", dto.getInsertValues());
insert("insert into t_chat_message (chat_message_id, chat_room_id, shop_member_id, message, message_type, image_name, download_file_name, save_path, insert_date) values (?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public boolean updateChatMessage(ChatMessageDto dto) {
long count = update("update t_chat_message set chat_room_id=?, shop_member_id=?, message=?, message_type=?, image_name=?, download_file_name=?, save_path=? where chat_message_id=?", dto.getUpdateValues());
long count = update("update t_chat_message set chat_room_id=?, shop_member_id=?, message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=? where chat_message_id=?", dto.getUpdateValues());
return count > 0;
}
......
......@@ -43,7 +43,25 @@ public class ChatRoomDao extends AbstractDao {
}
public List<ChatRoomDto> getAllChatRoom() {
List<ChatRoomDto> list = rawQueryGetDtoList("select * from t_chat_room", null, ChatRoomDto.class);
StringBuffer sql = new StringBuffer();
sql.append(" SELECT ");
sql.append(" cr.chat_room_id, ");
sql.append(" cr.chat_room_name, ");
sql.append(" cr.type, ");
sql.append(" cr.favorite_register_date ");
sql.append(" FROM ");
sql.append(" t_chat_room AS cr ");
sql.append(" INNER JOIN ");
sql.append(" ( SELECT max(insert_date) insert_date, message, message_type FROM t_chat_message GROUP BY chat_room_id ) AS cm ");
sql.append(" ON cr.chat_room_id = cm.chat_room_id ");
sql.append(" INNER JOIN ");
sql.append(" r_chat_room_shop_member AS rctsm ");
sql.append(" ON cr.chat_room_id = rctsm.chat_room_id ");
sql.append(" INNER JOIN ");
sql.append(" m_shop_member AS sm ");
sql.append(" ON rctsm.shop_menber_id = sm.shop_menber_id ");
sql.append(" GROUP BY chat_room_id ");
List<ChatRoomDto> list = rawQueryGetDtoList(sql.toString(), null, ChatRoomDto.class);
return list;
}
......
......@@ -19,7 +19,7 @@ public class MShopMember extends SQLiteTableScript {
sql.append(" shop_member_id INTEGER NOT NULL ");
sql.append(" , shop_member_name VARCHAR(64) ");
sql.append(" , profile_url VARCHAR(64) ");
sql.append(" , favorite_register_date DATETIME ");
sql.append(" , favorite_register_date VARCHAR(64) ");
sql.append(" , PRIMARY KEY (shop_member_id) ");
sql.append(" ) ");
......
......@@ -20,8 +20,6 @@ public class RChatUnreadMessage extends SQLiteTableScript {
sql.append(" chat_message_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (chat_message_id, shop_member_id) ");
sql.append(" , FOREIGN KEY (shop_member_id) REFERENCES m_shop_member (shop_member_id) ");
sql.append(" , FOREIGN KEY (chat_message_id) REFERENCES t_chat_message (chat_message_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -20,8 +20,6 @@ public class RCollaborationMember extends SQLiteTableScript {
sql.append(" collaboration_id INTEGER NOT NULL ");
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_id, shop_member_id) ");
sql.append(" , FOREIGN KEY (shop_member_id) REFERENCES m_shop_member (shop_member_id) ");
sql.append(" , FOREIGN KEY (collaboration_id) REFERENCES t_collaboration (collaboration_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -20,8 +20,6 @@ public class RShopMemberGroup extends SQLiteTableScript {
sql.append(" shop_member_id INTEGER NOT NULL ");
sql.append(" , group_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (shop_member_id, group_id) ");
sql.append(" , FOREIGN KEY (shop_member_id) REFERENCES m_shop_member (shop_member_id) ");
sql.append(" , FOREIGN KEY (group_id) REFERENCES m_group (group_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -24,8 +24,6 @@ public class TArchive extends SQLiteTableScript {
sql.append(" , shop_member_id INTEGER NOT NULL ");
sql.append(" , archive_save_path VARCHAR2 ");
sql.append(" , PRIMARY KEY (archive_id)");
sql.append(" , FOREIGN KEY (collaboration_id) REFERENCES t_collaboration (collaboration_id) ");
sql.append(" , FOREIGN KEY (shop_member_id) REFERENCES m_shop_member (shop_member_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -24,6 +24,7 @@ public class TChatMessage extends SQLiteTableScript {
sql.append(" , image_name VARCHAR2 ");
sql.append(" , download_file_name VARCHAR2 ");
sql.append(" , save_path VARCHAR2 ");
sql.append(" , insert_date VARCHAR2 ");
sql.append(" , PRIMARY KEY (chat_message_id) ");
sql.append(" ) ");
......
......@@ -17,9 +17,9 @@ public class TChatRoom extends SQLiteTableScript {
sql.append(" create table t_chat_room ( ");
sql.append(" chat_room_id INTEGER NOT NULL ");
sql.append(" , chat_room_name VARCHAR2 ");
sql.append(" , chat_room_name VARCHAR2(64) ");
sql.append(" , type INTEGER NOT NULL ");
sql.append(" , favorite_register_date DATETIME ");
sql.append(" , favorite_register_date VARCHAR2(64) ");
sql.append(" , PRIMARY KEY (chat_room_id) ");
sql.append(" ) ");
......
......@@ -22,8 +22,6 @@ public class TCollaborationDetail extends SQLiteTableScript {
sql.append(" , collaboration_duration VARCHAR2(64) ");
sql.append(" , chat_room_id INTEGER NOT NULL ");
sql.append(" , PRIMARY KEY (collaboration_detial_id)");
sql.append(" , FOREIGN KEY (collaboration_id) REFERENCES t_collaboration (collaboration_id) ");
sql.append(" , FOREIGN KEY (chat_room_id) REFERENCES t_chat_room (chat_room_id) ");
sql.append(" ) ");
ddl.add(sql.toString());
......
......@@ -9,15 +9,16 @@ public class ChatMessageDto extends AbstractDto {
public String imageName;
public String downloadFileName;
public String savePath;
public String insertDate;
@Override
public Object[] getInsertValues() {
return new Object[]{chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath};
return new Object[]{chatMessageId, chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate};
}
@Override
public Object[] getUpdateValues() {
return new Object[]{chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, chatMessageId};
return new Object[]{chatRoomId, shopMemberId, message, messageType, imageName, downloadFileName, savePath, insertDate, chatMessageId};
}
@Override
......
package jp.agentec.abook.abv.bl.dto;
import java.util.Date;
import java.util.List;
public class ChatRoomDto extends AbstractDto {
public Integer chatRoomId;
public String chatRoomName;
public Integer type;
public String favoriteRegisterDate;
public Integer unreadCnt;
public ChatMessageDto message;
public List<ShopMemberDto> users;
@Override
......
......@@ -816,12 +816,14 @@ CHAT_UI.refreshRoomList = function(rooms, activeRoomId = null){
// loadingIndicatorを表示しない
CHAT_UI.showLoadingIndicator();
// 新しいチャットルームをタッチする場合、チャットルームの接続処理を実行
socket.emit('joinRoom', room.roomId, room.roomName, function (){
CHAT.saveRoomInfo(room.roomId, room.roomName);
$('#messages').html('');
// チャットルーム名を変更する
$('.titleRoomName').text(room.roomName).data('roomName', room.roomName);
});
}
});
// チャットルームリストに追加する
......
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