mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-07 18:04:45 +08:00
Merge branch 'main' of https://gitee.com/dotnetchina/OpenAuth.Net
This commit is contained in:
@@ -13,7 +13,7 @@ namespace OpenAuth.App
|
|||||||
/// SqlSugar基础类
|
/// SqlSugar基础类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
public abstract class SqlSugarBaseApp<T> where T : class, new()
|
public abstract class SqlSugarBaseApp<T> where T : BaseEntity, new()
|
||||||
{
|
{
|
||||||
protected ISqlSugarClient SugarClient;
|
protected ISqlSugarClient SugarClient;
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace OpenAuth.App
|
|||||||
var user = _auth.GetCurrentUser().User;
|
var user = _auth.GetCurrentUser().User;
|
||||||
obj.CreateUserId = user.Id;
|
obj.CreateUserId = user.Id;
|
||||||
obj.CreateUserName = user.Name;
|
obj.CreateUserName = user.Name;
|
||||||
await SugarClient.Insertable(obj).ExecuteCommandAsync();
|
Repository.Insert(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(AddOrUpdateCategoryReq obj)
|
public void Update(AddOrUpdateCategoryReq obj)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using SqlSugar;
|
using OpenAuth.Repository.Core;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
namespace OpenAuth.Repository
|
namespace OpenAuth.Repository
|
||||||
{
|
{
|
||||||
@@ -6,12 +7,22 @@ namespace OpenAuth.Repository
|
|||||||
/// SqlSugar仓储
|
/// SqlSugar仓储
|
||||||
/// <para>具体用法参考:https://www.donet5.com/Home/Doc?typeId=1228</para>
|
/// <para>具体用法参考:https://www.donet5.com/Home/Doc?typeId=1228</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SqlSugarRepository<T> : SimpleClient<T> where T : class, new()
|
public class SqlSugarRepository<T> : SimpleClient<T> where T : BaseEntity, new()
|
||||||
{
|
{
|
||||||
public SqlSugarRepository(ISqlSugarClient client)
|
public SqlSugarRepository(ISqlSugarClient client)
|
||||||
{
|
{
|
||||||
base.Context = client;
|
base.Context = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public new bool Insert(T entity)
|
||||||
|
{
|
||||||
|
if (entity.KeyIsNull())
|
||||||
|
{
|
||||||
|
entity.GenerateDefaultKeyVal();
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.Insert(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ permalink: /core/multidbs/
|
|||||||
```csharp
|
```csharp
|
||||||
namespace OpenAuth.App
|
namespace OpenAuth.App
|
||||||
{
|
{
|
||||||
public abstract class SqlSugarApp2<T> : SqlSugarBaseApp<T> where T : class, new()
|
public abstract class SqlSugarApp2<T> : SqlSugarBaseApp<T> where T : BaseEntity, new()
|
||||||
{
|
{
|
||||||
public SqlSugarApp2(ISqlSugarClient client, IAuth auth) : base(client, auth)
|
public SqlSugarApp2(ISqlSugarClient client, IAuth auth) : base(client, auth)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user