添加自动分表功能

This commit is contained in:
橙子
2022-04-23 00:57:14 +08:00
parent c8b2a38c99
commit c6931e3492
11 changed files with 190 additions and 2 deletions

View File

@@ -0,0 +1,23 @@
using SqlSugar;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class LogService
{
public async Task<List<long>> AddListTest(List<LogEntity> logEntities)
{
return await _repository._Db.Insertable(logEntities).SplitTable().ExecuteReturnSnowflakeIdListAsync();
}
public async Task<List<LogEntity>> GetListTest()
{
return await _repository._Db.Queryable<LogEntity>().SplitTable(tas => tas.Where(u => u.TableName.Contains("2020") || u.TableName.Contains("2021"))).ToListAsync();
}
}
}

View File

@@ -0,0 +1,14 @@
using SqlSugar;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class LogService : BaseService<LogEntity>, ILogService
{
public LogService(IRepository<LogEntity> repository) : base(repository)
{
}
}
}