修复:删除最后店铺绑定时软删除用户

This commit is contained in:
xiaowang
2026-03-26 16:24:22 +08:00
parent c06d57873a
commit bd349473f0
2 changed files with 14 additions and 1 deletions
@@ -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