From 17b6b725a42dd99ddf3cafd26d3588259ef3aaeb Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Mon, 15 Apr 2024 14:45:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E5=82=A8=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=95=B0=E6=8D=AE=E6=98=AF=E5=90=A6=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Repository/BASE/BaseRepository.cs | 4 ++++ Tiobon.Core.Repository/BASE/IBaseRepository.cs | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Tiobon.Core.Repository/BASE/BaseRepository.cs b/Tiobon.Core.Repository/BASE/BaseRepository.cs index e4ef3be3..5d5c7b62 100644 --- a/Tiobon.Core.Repository/BASE/BaseRepository.cs +++ b/Tiobon.Core.Repository/BASE/BaseRepository.cs @@ -74,6 +74,10 @@ namespace Tiobon.Core.Repository.Base //return await Task.Run(() => _db.Queryable().InSingle(objId)); return await _db.Queryable().In(objId).SingleAsync(); } + public async Task AnyAsync(object objId) + { + return await _db.Queryable().In(objId).AnyAsync(); + } /// /// 根据ID查询一条数据 diff --git a/Tiobon.Core.Repository/BASE/IBaseRepository.cs b/Tiobon.Core.Repository/BASE/IBaseRepository.cs index 0f672cf0..d1126c74 100644 --- a/Tiobon.Core.Repository/BASE/IBaseRepository.cs +++ b/Tiobon.Core.Repository/BASE/IBaseRepository.cs @@ -11,7 +11,15 @@ namespace Tiobon.Core.IRepository.Base /// /// SqlsugarClient实体 /// - ISqlSugarClient Db { get;} + ISqlSugarClient Db { get; } + + /// + /// 查询实体数据是否存在 + /// + /// + /// + Task AnyAsync(object objId); + /// /// 根据Id查询实体 /// @@ -25,7 +33,7 @@ namespace Tiobon.Core.IRepository.Base /// /// Task> QueryByIDs(object[] lstIds); - + /// /// 添加 ///