修复:删除最后店铺绑定时软删除用户
This commit is contained in:
+9
-1
@@ -1076,12 +1076,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteUserInShop(Long id, Long shopId) {
|
||||
Long normalizedShopId = normalizeShopId(shopId);
|
||||
if (normalizedShopId == null) {
|
||||
throw new RuntimeException("当前操作缺少店铺上下文");
|
||||
}
|
||||
return userShopBindingSupport.deleteBinding(id, normalizedShopId);
|
||||
boolean deleted = userShopBindingSupport.deleteBinding(id, normalizedShopId);
|
||||
if (!deleted) {
|
||||
return false;
|
||||
}
|
||||
if (userShopBindingSupport.listBindingsByUserId(id, false).isEmpty()) {
|
||||
return deleteUser(id);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
### 3. 用户按店铺删除的残留显示修复
|
||||
|
||||
- 文件:`YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/support/UserShopBindingSupport.java`
|
||||
- 文件:`YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl/UserServiceImpl.java`
|
||||
- 文件:`Frontend/src/views/admin/UsersView.vue`
|
||||
- 修复“删除当前店铺下用户绑定后,列表里仍能看到用户”的问题:
|
||||
- 后端原先只删除一条匹配绑定记录,历史重复绑定数据会残留
|
||||
@@ -37,6 +38,10 @@
|
||||
- 前端删除和停用动作新增布尔结果判断:
|
||||
- 后端返回 `false` 时,不再误提示成功
|
||||
- 会明确提示当前店铺下未找到可操作的用户绑定,并刷新列表
|
||||
- 当用户删除的是最后一个剩余店铺绑定时,后端会同步对该用户做逻辑删除:
|
||||
- 数据仍保留在数据库中
|
||||
- 前台会把该账号视为已删除,无法继续查看或登录
|
||||
- 若用户仍有其他店铺绑定,则只移除当前店铺,不影响其他店铺使用
|
||||
|
||||
## 结果说明
|
||||
|
||||
|
||||
Reference in New Issue
Block a user