From 0ee18681fd19d6b9c1bf41a99bed997ba13db8a4 Mon Sep 17 00:00:00 2001 From: "283591387@qq.com" Date: Sun, 3 Aug 2025 14:44:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=99=A8=E5=88=A0=E9=99=A4=E9=85=8D=E7=BD=AE=E6=97=B6?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=88=A0=E9=99=A4=E6=98=8E=E7=BB=86=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Core/Partial/Sys_TableInfoService.cs | 15 ++------------- .../Services/Core/Partial/Sys_TableInfoService.cs | 15 ++------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/vol.api.sqlsugar/VOL.Builder/Services/Core/Partial/Sys_TableInfoService.cs b/vol.api.sqlsugar/VOL.Builder/Services/Core/Partial/Sys_TableInfoService.cs index a1508f03..08c88ed1 100644 --- a/vol.api.sqlsugar/VOL.Builder/Services/Core/Partial/Sys_TableInfoService.cs +++ b/vol.api.sqlsugar/VOL.Builder/Services/Core/Partial/Sys_TableInfoService.cs @@ -1457,19 +1457,8 @@ DISTINCT public async Task DelTree(int table_Id) { if (table_Id == 0) return new WebResponseContent().Error("没有传入参数"); - Sys_TableInfo tableInfo = await repository.FindAsIQueryable(x => x.Table_Id == table_Id) - .Includes(c => c.TableColumns) - .FirstOrDefaultAsync(); - if (tableInfo == null) return new WebResponseContent().OK(); - if (tableInfo.TableColumns != null && tableInfo.TableColumns.Count > 0) - { - return new WebResponseContent().Error("当前删除的节点存在表结构信息,只能删除空节点"); - } - if (repository.Exists(x => x.ParentId == table_Id)) - { - return new WebResponseContent().Error("当前删除的节点存在子节点,不能删除"); - } - repository.Delete(tableInfo, true); + await repository.DbContext.Deleteable().Where(x => x.Table_Id == table_Id).ExecuteCommandAsync(); + await repository.DbContext.Deleteable().Where(x => x.Table_Id == table_Id).ExecuteCommandAsync(); return new WebResponseContent().OK(); } diff --git a/vol.api/VOL.Builder/Services/Core/Partial/Sys_TableInfoService.cs b/vol.api/VOL.Builder/Services/Core/Partial/Sys_TableInfoService.cs index ea62eeaa..0f0d1fec 100644 --- a/vol.api/VOL.Builder/Services/Core/Partial/Sys_TableInfoService.cs +++ b/vol.api/VOL.Builder/Services/Core/Partial/Sys_TableInfoService.cs @@ -1672,19 +1672,8 @@ DISTINCT public async Task DelTree(int table_Id) { if (table_Id == 0) return new WebResponseContent().Error("没有传入参数"); - Sys_TableInfo tableInfo = (await repository.FindAsIQueryable(x => x.Table_Id == table_Id) - .Include(c => c.TableColumns) - .ToListAsync()).FirstOrDefault(); - if (tableInfo == null) return new WebResponseContent().OK(); - if (tableInfo.TableColumns != null && tableInfo.TableColumns.Count > 0) - { - return new WebResponseContent().Error("当前删除的节点存在表结构信息,只能删除空节点"); - } - if (repository.Exists(x => x.ParentId == table_Id)) - { - return new WebResponseContent().Error("当前删除的节点存在子节点,不能删除"); - } - repository.Delete(tableInfo, true); + await repository.FindAsIQueryable(x => x.Table_Id == table_Id).ExecuteDeleteAsync(); + await repository.DbContext.Set().Where(x => x.Table_Id == table_Id).ExecuteDeleteAsync(); return new WebResponseContent().OK(); }