优化接口、仓储层

This commit is contained in:
izory
2021-09-27 16:07:55 +08:00
parent 40026f596f
commit 56a04bbf73
48 changed files with 621 additions and 745 deletions

View File

@@ -1,21 +0,0 @@
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZR.Repository.DbProvider;
namespace ZR.Repository.System
{
public class BaseRepository : SugarDbContext
{
protected void PrintLog()
{
//调式代码 用来打印SQL
Db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine("【SQL语句】" + sql.ToLower() + "\r\n" + Db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
};
}
}
}

View File

@@ -1,4 +1,5 @@
using System;
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,11 +8,12 @@ using ZR.Model.System.Generate;
namespace ZR.Repository.System
{
[AppService(ServiceLifetime = LifeTime.Transient)]
public class GenTableRepository : BaseRepository<GenTable>
{
}
[AppService(ServiceLifetime = LifeTime.Transient)]
public class GenTableColumnRepository : BaseRepository<GenTableColumn>
{
/// <summary>

View File

@@ -44,8 +44,7 @@ namespace ZR.Repository.System
/// <returns></returns>
public long InsertDictData(SysDictData dict)
{
var result = Context.Insertable(dict).IgnoreColumns(it => new { dict.Update_by })
.ExecuteReturnIdentity();
var result = InsertReturnBigIdentity(dict);
return result;
}
@@ -76,7 +75,7 @@ namespace ZR.Repository.System
/// <returns></returns>
public int DeleteDictDataByIds(long[] dictCodes)
{
return Context.Deleteable<SysDictData>().In(dictCodes).ExecuteCommand();
return Delete(dictCodes);
}
/// <summary>

View File

@@ -1,4 +1,5 @@
using System;
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -7,6 +8,7 @@ using ZR.Model.System;
namespace ZR.Repository.System
{
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysPostRepository : BaseRepository<SysPost>
{
}