chore: 构建稳定版本
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
using Volo.Abp.DependencyInjection;
|
||||
|
||||
namespace Yi.Framework.SqlSugarCore.Abstractions
|
||||
{
|
||||
public interface ISqlSugarDbContext
|
||||
{
|
||||
// IAbpLazyServiceProvider LazyServiceProvider { get; set; }
|
||||
ISqlSugarClient SqlSugarClient { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
using System.Linq.Expressions;
|
||||
using SqlSugar;
|
||||
using Volo.Abp.Domain.Entities;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
|
||||
namespace Yi.Framework.SqlSugarCore.Abstractions
|
||||
{
|
||||
|
||||
public interface ISqlSugarRepository<TEntity>:IRepository<TEntity> where TEntity : class, IEntity,new ()
|
||||
{
|
||||
ISqlSugarClient _Db { get; }
|
||||
ISugarQueryable<TEntity> _DbQueryable { get; }
|
||||
|
||||
Task<ISqlSugarClient> GetDbContextAsync();
|
||||
Task<IDeleteable<TEntity>> AsDeleteable();
|
||||
Task<IInsertable<TEntity>> AsInsertable(List<TEntity> insertObjs);
|
||||
Task<IInsertable<TEntity>> AsInsertable(TEntity insertObj);
|
||||
Task<IInsertable<TEntity>> AsInsertable(TEntity[] insertObjs);
|
||||
Task<ISugarQueryable<TEntity>> AsQueryable();
|
||||
Task<ISqlSugarClient> AsSugarClient();
|
||||
Task<ITenant> AsTenant();
|
||||
Task<IUpdateable<TEntity>> AsUpdateable(List<TEntity> updateObjs);
|
||||
Task<IUpdateable<TEntity>> AsUpdateable(TEntity updateObj);
|
||||
Task<IUpdateable<TEntity>> AsUpdateable();
|
||||
Task<IUpdateable<TEntity>> AsUpdateable(TEntity[] updateObjs);
|
||||
|
||||
#region 单查
|
||||
//单查
|
||||
Task<TEntity> GetByIdAsync(dynamic id);
|
||||
Task<TEntity> GetSingleAsync(Expression<Func<TEntity, bool>> whereExpression);
|
||||
Task<TEntity> GetFirstAsync(Expression<Func<TEntity, bool>> whereExpression);
|
||||
Task<bool> IsAnyAsync(Expression<Func<TEntity, bool>> whereExpression);
|
||||
Task<int> CountAsync(Expression<Func<TEntity, bool>> whereExpression);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 多查
|
||||
//多查
|
||||
Task<List<TEntity>> GetListAsync();
|
||||
Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> whereExpression);
|
||||
#endregion
|
||||
|
||||
|
||||
#region 分页查
|
||||
//分页查
|
||||
Task<List<TEntity>> GetPageListAsync(Expression<Func<TEntity, bool>> whereExpression, int pageNum, int pageSize);
|
||||
Task<List<TEntity>> GetPageListAsync(Expression<Func<TEntity, bool>> whereExpression, int pageNum, int pageSize, Expression<Func<TEntity, object>>? orderByExpression = null, OrderByType orderByType = OrderByType.Asc);
|
||||
#endregion
|
||||
|
||||
#region 插入
|
||||
//插入
|
||||
Task<bool> InsertAsync(TEntity insertObj);
|
||||
Task<bool> InsertOrUpdateAsync(TEntity data);
|
||||
Task<bool> InsertOrUpdateAsync(List<TEntity> datas);
|
||||
Task<int> InsertReturnIdentityAsync(TEntity insertObj);
|
||||
Task<long> InsertReturnBigIdentityAsync(TEntity insertObj);
|
||||
Task<long> InsertReturnSnowflakeIdAsync(TEntity insertObj);
|
||||
Task<TEntity> InsertReturnEntityAsync(TEntity insertObj);
|
||||
Task<bool> InsertRangeAsync(List<TEntity> insertObjs);
|
||||
#endregion
|
||||
|
||||
|
||||
#region 更新
|
||||
//更新
|
||||
Task<bool> UpdateAsync(TEntity updateObj);
|
||||
Task<bool> UpdateRangeAsync(List<TEntity> updateObjs);
|
||||
Task<bool> UpdateAsync(Expression<Func<TEntity, TEntity>> columns, Expression<Func<TEntity, bool>> whereExpression);
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
//删除
|
||||
Task<bool> DeleteAsync(TEntity deleteObj);
|
||||
Task<bool> DeleteAsync(List<TEntity> deleteObjs);
|
||||
Task<bool> DeleteAsync(Expression<Func<TEntity, bool>> whereExpression);
|
||||
Task<bool> DeleteByIdAsync(dynamic id);
|
||||
Task<bool> DeleteByIdsAsync(dynamic[] ids);
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
public interface ISqlSugarRepository<TEntity, TKey> : ISqlSugarRepository<TEntity>,IRepository<TEntity, TKey> where TEntity : class, IEntity<TKey>, new()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.Framework.SqlSugarCore.Abstractions
|
||||
{
|
||||
public interface ISugarDbContextProvider<TDbContext>
|
||||
where TDbContext : ISqlSugarDbContext
|
||||
{
|
||||
|
||||
Task<TDbContext> GetDbContextAsync();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\common.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.124" />
|
||||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="7.4.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.Framework.Core\Yi.Framework.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Yi.Framework.SqlSugarCore.Abstractions</name>
|
||||
</assembly>
|
||||
<members>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,11 @@
|
||||
using Volo.Abp.Modularity;
|
||||
using Yi.Framework.Core;
|
||||
|
||||
namespace Yi.Framework.SqlSugarCore.Abstractions
|
||||
{
|
||||
[DependsOn(typeof(YiFrameworkCoreModule))]
|
||||
public class YiFrameworkSqlSugarCoreAbstractionsModule : AbpModule
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user