2025-06-26 21:02:11 +08:00
|
|
|
|
using OpenAuth.Repository.Core;
|
|
|
|
|
using SqlSugar;
|
2023-08-27 00:23:45 +08:00
|
|
|
|
|
2023-08-30 13:51:37 +08:00
|
|
|
|
namespace OpenAuth.Repository
|
2023-08-27 00:23:45 +08:00
|
|
|
|
{
|
2023-08-30 13:51:37 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// SqlSugar仓储
|
|
|
|
|
/// <para>具体用法参考:https://www.donet5.com/Home/Doc?typeId=1228</para>
|
|
|
|
|
/// </summary>
|
2025-06-26 21:02:11 +08:00
|
|
|
|
public class SqlSugarRepository<T> : SimpleClient<T> where T : BaseEntity, new()
|
2023-08-30 13:51:37 +08:00
|
|
|
|
{
|
|
|
|
|
public SqlSugarRepository(ISqlSugarClient client)
|
|
|
|
|
{
|
|
|
|
|
base.Context = client;
|
|
|
|
|
}
|
2025-06-26 21:02:11 +08:00
|
|
|
|
|
|
|
|
|
public new bool Insert(T entity)
|
|
|
|
|
{
|
|
|
|
|
if (entity.KeyIsNull())
|
|
|
|
|
{
|
|
|
|
|
entity.GenerateDefaultKeyVal();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.Insert(entity);
|
|
|
|
|
}
|
2023-08-27 00:23:45 +08:00
|
|
|
|
}
|
2023-08-30 13:51:37 +08:00
|
|
|
|
}
|
|
|
|
|
|