Commit 02afc046 by onuma

文字列を外部リソースに移動、SQL修正他

parent 3ed63fe8
......@@ -70,7 +70,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
sql.append(" FROM m_chat_group mygroup ");
sql.append(" LEFT JOIN m_chat_group parentgroup on mygroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" WHERE mygroup.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1)");
sql.append(" WHERE mygroup.group_id IN (select group_id from m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1)");
return rawQueryGetStringList(sql.toString(), null);
}
......@@ -83,7 +83,7 @@ public class ChatGroupDao extends AbstractCommunicationDao {
sql.append(" END AS group_path, usergroup.group_id ");
sql.append(" FROM m_chat_group usergroup ");
sql.append(" LEFT JOIN m_chat_group parentgroup on usergroup.parent_group_id = parentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_group grandparentgroup on parentgroup.parent_group_id = grandparentgroup.group_id ");
sql.append(" LEFT JOIN m_chat_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 ");
......@@ -156,11 +156,11 @@ public class ChatGroupDao extends AbstractCommunicationDao {
}
public ChatGroupDto getGroup(int groupId) {
return rawQueryGetDto("select * from m_chat_group where group_id = " + groupId, null, ChatGroupDto.class);
return rawQueryGetDto("SELECT * from m_chat_group WHERE group_id = " + groupId, null, ChatGroupDto.class);
}
public List<ChatGroupDto> getFavoriteGroup() {
return rawQueryGetDtoList("select * from m_chat_group where favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, ChatGroupDto.class);
return rawQueryGetDtoList("SELECT * from m_chat_group WHERE favorite_register_date IS NOT NULL ORDER BY favorite_register_date ", null, ChatGroupDto.class);
}
public List<ChatGroupDto> getGroupByName(String[] keywords) {
......@@ -187,10 +187,10 @@ public class ChatGroupDao extends AbstractCommunicationDao {
StringBuffer sql = new StringBuffer();
sql.append(" WITH group_loop AS ");
sql.append(" ( ");
sql.append(" SELECT 1 rownum, group_id, group_name, parent_group_id from m_chat_group where group_id = ? ");
sql.append(" SELECT 1 rownum, group_id, group_name, parent_group_id FROM m_chat_group WHERE group_id = ? ");
sql.append(" UNION ALL ");
sql.append(" SELECT rownum+1 rownum, parent.group_id, parent.group_name, parent.parent_group_id ");
sql.append(" FROM group_loop inner join m_chat_group parent on parent.group_id = group_loop.parent_group_id ");
sql.append(" FROM group_loop inner JOIN m_chat_group parent on parent.group_id = group_loop.parent_group_id ");
sql.append(" ) ");
sql.append(" SELECT * FROM group_loop ORDER BY group_loop.rownum DESC ");
......@@ -200,24 +200,24 @@ public class ChatGroupDao extends AbstractCommunicationDao {
public List<ChatGroupDto> getGroupChildList(int parentId) {
List<ChatGroupDto> list;
list = rawQueryGetDtoList("select * from m_chat_group mg where (mg.parent_group_id = ?) ORDER BY group_name", new String[]{""+ parentId}, ChatGroupDto.class);
list = rawQueryGetDtoList("SELECT * FROM m_chat_group mg WHERE (mg.parent_group_id = ?) ORDER BY group_name", new String[]{""+ parentId}, ChatGroupDto.class);
return list;
}
public ChatGroupDto getRootGroup() {
return rawQueryGetDto("select * from m_chat_group mg where (mg.parent_group_id = 0)",null, ChatGroupDto.class);
return rawQueryGetDto("SELECT * FROM m_chat_group mg WHERE (mg.parent_group_id = 0)",null, ChatGroupDto.class);
}
public ChatGroupDto getParentGroup(Integer childGroupId) {
return rawQueryGetDto("select parent.* from m_chat_group parent inner join m_chat_group child on child.parent_group_id = parent.group_id where child.group_id = ?", new String[]{""+ childGroupId}, ChatGroupDto.class);
return rawQueryGetDto("SELECT parent.* from m_chat_group parent INNER JOIN m_chat_group child on child.parent_group_id = parent.group_id WHERE child.group_id = ?", new String[]{""+ childGroupId}, ChatGroupDto.class);
}
public boolean isExistParent(int baseId) {
return rawQueryGetInt("select * from m_chat_group where parent_group_id = " + baseId, null) > 0;
return rawQueryGetInt("SELECT * FROM m_chat_group WHERE parent_group_id = " + baseId, null) > 0;
}
public List<ChatGroupDto> getMyGroups() {
return rawQueryGetDtoList("select * from m_chat_group where group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1) ORDER BY group_name ASC", null, ChatGroupDto.class);
return rawQueryGetDtoList("SELECT * FROM m_chat_group WHERE group_id IN (SELECT group_id from m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1) ORDER BY group_name ASC", null, ChatGroupDto.class);
}
public void insertGroupList(List<ChatGroupDto> groupList) {
......@@ -277,13 +277,13 @@ public class ChatGroupDao extends AbstractCommunicationDao {
public void deleteGroupList(List<ChatGroupDto> groupList) {
StringBuffer sql = new StringBuffer();
sql.append(" delete from m_chat_group ");
sql.append(" DELETE FROM m_chat_group ");
sql.append(" WHERE group_id = ? ");
try {
beginTransaction();
for (ChatGroupDto groupDto : groupList) {
update(sql.toString(), new Object[] { groupDto.groupId });
update("delete from r_shop_member_group where group_id = ? ", new Object[] { groupDto.groupId });
update("DELETE FROM r_shop_member_group WHERE group_id = ? ", new Object[] { groupDto.groupId });
}
commit();
} catch (Exception e) {
......@@ -292,6 +292,4 @@ public class ChatGroupDao extends AbstractCommunicationDao {
throw new RuntimeException(e);
}
}
}
......@@ -187,7 +187,7 @@ public class ChatMessageDao extends AbstractCommunicationDao {
}
public void insertChatMessage(ChatMessageDto dto) {
insert("insert or replace into t_chat_message (chat_message_id, chat_room_id, shop_member_id, login_id, message, message_type, image_name, download_file_name, save_path, insert_date, unread_count) values (?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
insert("INSERT OR replace INTO t_chat_message (chat_message_id, chat_room_id, shop_member_id, login_id, message, message_type, image_name, download_file_name, save_path, insert_date, unread_count) VALUES (?,?,?,?,?,?,?,?,?,?,?)", dto.getInsertValues());
}
public void insertChatMessage(List<ChatMessageDto> chatMessageDtoList) {
......@@ -205,15 +205,15 @@ public class ChatMessageDao extends AbstractCommunicationDao {
}
public boolean updateChatMessage(ChatMessageDto dto) {
long count = update("update t_chat_message set chat_room_id=?, shop_member_id=?, login_id=?,message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=?, unread_count where chat_message_id=?", dto.getUpdateValues());
long count = update("UPDATE t_chat_message set chat_room_id=?, shop_member_id=?, login_id=?,message=?, message_type=?, image_name=?, download_file_name=?, save_path=?, insert_date=?, unread_count WHERE chat_message_id=?", dto.getUpdateValues());
return count > 0;
}
public void updatUnreadCount(List<ChatMessageDto> messageDtoList, String roomId) {
beginTransaction();
update("update t_chat_message set unread_count = 0 where chat_room_id=?", new String[]{"" + roomId});
update("UPDATE t_chat_message set unread_count = 0 WHERE chat_room_id=?", new String[]{"" + roomId});
for (ChatMessageDto messageDto : messageDtoList) {
update("update t_chat_message set unread_count = ? where chat_message_id=?", new String[]{"" + messageDto.unreadCount, "" + messageDto.chatMessageId});
update("UPDATE t_chat_message set unread_count = ? WHERE chat_message_id=?", new String[]{"" + messageDto.unreadCount, "" + messageDto.chatMessageId});
}
commit();
}
......
......@@ -2,16 +2,12 @@ package jp.agentec.abook.abv.bl.data.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import jp.agentec.abook.abv.bl.common.db.Cursor;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.ChatRoomDto;
import jp.agentec.abook.abv.bl.dto.MemberInfoDto;
import jp.agentec.abook.abv.bl.dto.ShopMemberDto;
import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil;
......@@ -58,22 +54,22 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public List<ShopMemberDto> getAllShopMember() {
List<ShopMemberDto> list = rawQueryGetDtoList("select * from m_shop_member", null, ShopMemberDto.class);
List<ShopMemberDto> list = rawQueryGetDtoList("SELECT * FROM m_shop_member", null, ShopMemberDto.class);
return list;
}
public ShopMemberDto getShopMember(int shopMemberId) {
return rawQueryGetDto("select * from m_shop_member where shop_member_id=?", new String[]{""+ shopMemberId}, ShopMemberDto.class);
return rawQueryGetDto("SELECT * FROM m_shop_member WHERE shop_member_id=?", new String[]{""+ shopMemberId}, ShopMemberDto.class);
}
public void insertShopMember(ShopMemberDto dto) {
try {
beginTransaction();
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, login_id, profile_url, self_flg, favorite_register_date) values (?,?,?,?,?,(select favorite_register_date from m_shop_member where shop_member_id = ?))", dto.getInsertValues());
insert("INSERT OR REPLACE INTO m_shop_member (shop_member_id, shop_member_name, login_id, profile_url, self_flg, favorite_register_date) VALUES (?,?,?,?,?,(SELECT favorite_register_date FROM m_shop_member WHERE shop_member_id = ?))", dto.getInsertValues());
if (dto.groupIdList != null && dto.groupIdList.size() > 0) {
update(" delete from r_shop_member_group WHERE shop_member_id = ? ", new Integer[]{dto.shopMemberId});
update(" DELETE FROM r_shop_member_group WHERE shop_member_id = ? ", new Integer[]{dto.shopMemberId});
for (Integer groupId : dto.groupIdList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
insert("INSERT OR REPLACE INTO r_shop_member_group (shop_member_id, group_id) VALUES ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
}
commit();
......@@ -89,10 +85,10 @@ public class ShopMemberDao extends AbstractCommunicationDao {
try {
beginTransaction();
for (ShopMemberDto dto : dtoList) {
insert("insert or replace into m_shop_member (shop_member_id, shop_member_name, login_id, profile_url, self_flg, favorite_register_date) values (?,?,?,?,?, (select favorite_register_date from m_shop_member where shop_member_id = ?))", dto.getInsertValues());
insert("INSERT OR REPLACE INTO m_shop_member (shop_member_id, shop_member_name, login_id, profile_url, self_flg, favorite_register_date) VALUES (?,?,?,?,?, (SELECT favorite_register_date FROM m_shop_member WHERE shop_member_id = ?))", dto.getInsertValues());
if (dto.groupIdList == null) { continue; }
for (Integer groupId : dto.groupIdList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
insert("INSERT OR REPLACE INTO r_shop_member_group (shop_member_id, group_id) VALUES ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
}
commit();
......@@ -107,9 +103,9 @@ public class ShopMemberDao extends AbstractCommunicationDao {
public void insertShopMemberGroupRelation(Integer groupId, List<ShopMemberDto> dtoList) {
try {
update("delete from r_shop_member_group where group_id = ? ", new Object[] { groupId });
update("DELETE FROM r_shop_member_group WHERE group_id = ? ", new Object[] { groupId });
for (ShopMemberDto dto : dtoList) {
insert("insert or replace into r_shop_member_group (shop_member_id, group_id) values ("+dto.shopMemberId+",?)", new Integer[]{groupId});
insert("INSERT OR REPLACE INTO r_shop_member_group (shop_member_id, group_id) VALUES ("+dto.shopMemberId+",?)", new Integer[]{groupId});
}
} catch (Exception e) {
rollback();
......@@ -120,11 +116,11 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public ShopMemberDto getMyInfo() {
return rawQueryGetDto("select * from m_shop_member where self_flg = 1", null, ShopMemberDto.class);
return rawQueryGetDto("SELECT * FROM m_shop_member WHERE self_flg = 1", null, ShopMemberDto.class);
}
public void resetSelfFlg() {
update("update m_shop_member set self_flg = 0", new String[]{});
update("UPDATE m_shop_member SET self_flg = 0", new String[]{});
}
public List<ShopMemberDto> getUserInRoom(Integer chatRoomId) {
......@@ -196,7 +192,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public List<ShopMemberDto> getfavoriteUserList() {
return rawQueryGetDtoList("select * from m_shop_member where favorite_register_date NOT NULL", null, ShopMemberDto.class);
return rawQueryGetDtoList("SELECT * FROM m_shop_member WHERE favorite_register_date NOT NULL", null, ShopMemberDto.class);
}
public List<ShopMemberDto> getfavoriteUserListNotInRoom(Integer roomId) {
......@@ -257,7 +253,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append("WHERE rsmg.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1) ");
sql.append("WHERE rsmg.group_id IN (SELECT group_id FROM m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1) ");
sql.append(" AND sm.self_flg != 1 ");
ArrayList<String> whereSqlList = new ArrayList<String>();
for (String keyword : keywords) {
......@@ -286,7 +282,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
sql.append(" m_shop_member AS sm ");
sql.append(" INNER JOIN r_shop_member_group AS rsmg ");
sql.append(" ON sm.shop_member_id = rsmg.shop_member_id ");
sql.append(" WHERE rsmg.group_id IN (select group_id from m_shop_member sm inner join r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id where sm.self_flg = 1)");
sql.append(" WHERE rsmg.group_id IN (SELECT group_id FROM m_shop_member sm INNER JOIN r_shop_member_group rmg on sm.shop_member_id = rmg.shop_member_id WHERE sm.self_flg = 1)");
sql.append(" AND sm.self_flg != 1");
sql.append(" AND sm.shop_member_id NOT IN (SELECT shop_member_id FROM r_chat_room_shop_member WHERE chat_room_id = ?)");
ArrayList<String> whereSqlList = new ArrayList<String>();
......@@ -389,12 +385,12 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public boolean updateShopMember(ShopMemberDto dto) {
long count = update("update m_shop_member set shop_member_name=?, profile_url=? where shop_member_id=?", dto.getUpdateValues());
long count = update("UPDATE m_shop_member SET shop_member_name=?, profile_url=? WHERE shop_member_id=?", dto.getUpdateValues());
return count > 0;
}
public boolean deleteShopMember(ShopMemberDto dto) {
long count = update("delete from m_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
long count = update("DELETE FROM m_shop_member WHERE shop_member_id=?", new String[] {"" + dto.shopMemberId});
return count > 0;
}
......@@ -402,9 +398,9 @@ public class ShopMemberDao extends AbstractCommunicationDao {
try {
beginTransaction();
for (ShopMemberDto dto : dtoList) {
update("delete from r_shop_member_group where shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("delete from r_chat_room_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("delete from m_shop_member where shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("DELETE FROM r_shop_member_group WHERE shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("DELETE FROM r_chat_room_shop_member WHERE shop_member_id=?", new String[] {"" + dto.shopMemberId});
update("DELETE FROM m_shop_member WHERE shop_member_id=?", new String[] {"" + dto.shopMemberId});
}
commit();
} catch (Exception e) {
......@@ -417,7 +413,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
}
public boolean updateFavoriteUser(ShopMemberDto dto) {
long count = update("update m_shop_member set favorite_register_date=? where shop_member_id=?", new Object[]{dto.favoriteRegisterDate, dto.shopMemberId});
long count = update("UPDATE m_shop_member SET favorite_register_date=? WHERE shop_member_id=?", new Object[]{dto.favoriteRegisterDate, dto.shopMemberId});
return count > 0;
}
......@@ -427,7 +423,7 @@ public class ShopMemberDao extends AbstractCommunicationDao {
ShopMemberDto favoriteUserDto= new ShopMemberDto();
favoriteUserDto.shopMemberId = shopMemberId;
favoriteUserDto.favoriteRegisterDate = DateTimeUtil.toString_yyyyMMddHHmmss_none(new Date(System.currentTimeMillis()));
update("update m_shop_member set favorite_register_date=? where shop_member_id=?", new Object[]{favoriteUserDto.favoriteRegisterDate, favoriteUserDto.shopMemberId});
update("UPDATE m_shop_member SET favorite_register_date=? WHERE shop_member_id=?", new Object[]{favoriteUserDto.favoriteRegisterDate, favoriteUserDto.shopMemberId});
}
commit();
}
......
......@@ -1490,9 +1490,11 @@
<string name="msg_destroy_exist_collaboration">進行中の協業が存在します。既存協業を終了し、新しい協業を開始してもよろしいですか</string>
<string name="not_found_camera">利用可能なカメラを見つかりませんでした。</string>
<string name="error_fail_record">レコーディングに失敗しました。管理者にお問い合わせしてください。</string>
<!-- 連続作業 -->
<string name="msg_error_all_process_delete">全削除の送信に失敗しました。</string>
<string name="msg_ozd_file_could_not_opened">帳票ファイルを開くことができませんでした。</string>
<!-- Communication 会議室 -->
<string name="msg_error_favorites_100_over">お気に入りは最大100件までです。</string>
<string name="msg_eroor_network_offline">接続しているネットワークがありません。</string>
<string name="msg_error_connection_error_meeting_room">会議室サーバに接続できませんでした。</string>
</resources>
......@@ -1498,4 +1498,8 @@
<string name="not_found_camera">사용 가능한 카메라 기기를 찾을수 없습니다.</string>
<string name="msg_destroy_exist_collaboration">진행중인 협업이 존재합니다. 기존 협업을 종료하고 새로운 협업을 시작 하시겠습니까?</string>
<string name="error_fail_record">레코드에 실패했습니다. 관리자에게 문의해주세요.</string>
<!-- Communication 会議室 -->
<string name="msg_error_favorites_100_over">즐겨찾기는 최대 100개까지 입니다.</string>
<string name="msg_eroor_network_offline">연결된 네트워크가 없습니다.</string>
<string name="msg_error_connection_error_meeting_room">회의실 서버에 연결할 수 없습니다.</string>
</resources>
\ No newline at end of file
......@@ -1495,4 +1495,8 @@
<string name="not_found_camera">Not found camera device.</string>
<string name="msg_destroy_exist_collaboration">Ongoing collaboration exist. Do you want to terminate exist collaboration and start new?</string>
<string name="error_fail_record">Recording failed. Please contact the administrator.</string>
<!-- Communication 会議室 -->
<string name="msg_error_favorites_100_over">You can have up to 100 favorites.</string>
<string name="msg_eroor_network_offline">There is no network connected.</string>
<string name="msg_error_connection_error_meeting_room">Could not connect to the meeting room server.</string>
</resources>
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