Commit 08ff391f78b9dc83c862e3c7e4334e41860f4c87
1 parent
46f929ee
🐛 Websocket 断开时,未删除会话缓存 bug
Showing
2 changed files
with
15 additions
and
15 deletions
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/mapper/BaseMapperX.java
| @@ -121,8 +121,8 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | @@ -121,8 +121,8 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | ||
| 121 | * | 121 | * |
| 122 | * @param entities 实体们 | 122 | * @param entities 实体们 |
| 123 | */ | 123 | */ |
| 124 | - default void insertBatch(Collection<T> entities) { | ||
| 125 | - Db.saveBatch(entities); | 124 | + default Boolean insertBatch(Collection<T> entities) { |
| 125 | + return Db.saveBatch(entities); | ||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | /** | 128 | /** |
| @@ -131,28 +131,28 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | @@ -131,28 +131,28 @@ public interface BaseMapperX<T> extends MPJBaseMapper<T> { | ||
| 131 | * @param entities 实体们 | 131 | * @param entities 实体们 |
| 132 | * @param size 插入数量 Db.saveBatch 默认为 1000 | 132 | * @param size 插入数量 Db.saveBatch 默认为 1000 |
| 133 | */ | 133 | */ |
| 134 | - default void insertBatch(Collection<T> entities, int size) { | ||
| 135 | - Db.saveBatch(entities, size); | 134 | + default Boolean insertBatch(Collection<T> entities, int size) { |
| 135 | + return Db.saveBatch(entities, size); | ||
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | - default void updateBatch(T update) { | ||
| 139 | - update(update, new QueryWrapper<>()); | 138 | + default int updateBatch(T update) { |
| 139 | + return update(update, new QueryWrapper<>()); | ||
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | - default void updateBatch(Collection<T> entities) { | ||
| 143 | - Db.updateBatchById(entities); | 142 | + default Boolean updateBatch(Collection<T> entities) { |
| 143 | + return Db.updateBatchById(entities); | ||
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | - default void updateBatch(Collection<T> entities, int size) { | ||
| 147 | - Db.updateBatchById(entities, size); | 146 | + default Boolean updateBatch(Collection<T> entities, int size) { |
| 147 | + return Db.updateBatchById(entities, size); | ||
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | - default void insertOrUpdate(T entity) { | ||
| 151 | - Db.saveOrUpdate(entity); | 150 | + default Boolean insertOrUpdate(T entity) { |
| 151 | + return Db.saveOrUpdate(entity); | ||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | - default void insertOrUpdateBatch(Collection<T> collection) { | ||
| 155 | - Db.saveOrUpdateBatch(collection); | 154 | + default Boolean insertOrUpdateBatch(Collection<T> collection) { |
| 155 | + return Db.saveOrUpdateBatch(collection); | ||
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | default int delete(String field, String value) { | 158 | default int delete(String field, String value) { |
yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/session/WebSocketSessionManagerImpl.java
| @@ -66,7 +66,7 @@ public class WebSocketSessionManagerImpl implements WebSocketSessionManager { | @@ -66,7 +66,7 @@ public class WebSocketSessionManagerImpl implements WebSocketSessionManager { | ||
| 66 | @Override | 66 | @Override |
| 67 | public void removeSession(WebSocketSession session) { | 67 | public void removeSession(WebSocketSession session) { |
| 68 | // 移除从 idSessions 中 | 68 | // 移除从 idSessions 中 |
| 69 | - idSessions.remove(session.getId(), session); | 69 | + idSessions.remove(session.getId()); |
| 70 | // 移除从 idSessions 中 | 70 | // 移除从 idSessions 中 |
| 71 | LoginUser user = WebSocketFrameworkUtils.getLoginUser(session); | 71 | LoginUser user = WebSocketFrameworkUtils.getLoginUser(session); |
| 72 | if (user == null) { | 72 | if (user == null) { |