优化数据仓储
This commit is contained in:
+328
-237
@@ -1,4 +1,12 @@
|
||||
using ZR.Repository;
|
||||
using Infrastructure.Model;
|
||||
using SqlSugar;
|
||||
using SqlSugar.IOC;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using ZR.Model;
|
||||
using ZR.Repository;
|
||||
|
||||
namespace ZR.Service
|
||||
{
|
||||
@@ -6,284 +14,367 @@ namespace ZR.Service
|
||||
/// 基础服务定义
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class BaseService<T> : BaseRepository<T>, IBaseService<T> where T : class, new()
|
||||
public class BaseService<T> : IBaseService<T> where T : class, new()
|
||||
{
|
||||
//#region 添加操作
|
||||
///// <summary>
|
||||
///// 添加一条数据
|
||||
///// </summary>
|
||||
///// <param name="parm">T</param>
|
||||
///// <returns></returns>
|
||||
//public int Add(T parm)
|
||||
public IBaseRepository<T> baseRepository;
|
||||
|
||||
public BaseService(IBaseRepository<T> repository)
|
||||
{
|
||||
this.baseRepository = repository ?? throw new ArgumentNullException(nameof(repository));
|
||||
}
|
||||
#region add
|
||||
/// <summary>
|
||||
/// 插入指定列使用
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <param name="iClumns"></param>
|
||||
/// <param name="ignoreNull"></param>
|
||||
/// <returns></returns>
|
||||
public int Insert(T parm, Expression<Func<T, object>> iClumns = null, bool ignoreNull = true)
|
||||
{
|
||||
return baseRepository.Insert(parm, iClumns, ignoreNull);
|
||||
}
|
||||
/// <summary>
|
||||
/// 插入实体
|
||||
/// </summary>
|
||||
/// <param name="t"></param>
|
||||
/// <returns></returns>
|
||||
public int Add(T t)
|
||||
{
|
||||
return baseRepository.Add(t);
|
||||
}
|
||||
public IInsertable<T> Insertable(T t)
|
||||
{
|
||||
return baseRepository.Insertable(t);
|
||||
}
|
||||
//public int Insert(SqlSugarClient client, T t)
|
||||
//{
|
||||
// return Add(parm);// Context.Insertable(parm).RemoveDataCache().ExecuteCommand();
|
||||
// return client.Insertable(t).ExecuteCommand();
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 添加
|
||||
///// </summary>
|
||||
///// <param name="parm"></param>
|
||||
///// <param name="iClumns">插入列</param>
|
||||
///// <param name="ignoreNull">忽略null列</param>
|
||||
///// <returns></returns>
|
||||
//public int Add(T parm, Expression<Func<T, object>> iClumns = null, bool ignoreNull = true)
|
||||
//public long InsertBigIdentity(T t)
|
||||
//{
|
||||
// return Add(parm);
|
||||
// return base.Context.Insertable(t).ExecuteReturnBigIdentity();
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 批量添加数据
|
||||
///// </summary>
|
||||
///// <param name="parm">List<T></param>
|
||||
///// <returns></returns>
|
||||
//public int Add(List<T> parm)
|
||||
public int Insert(List<T> t)
|
||||
{
|
||||
return baseRepository.Insert(t);
|
||||
}
|
||||
public long InsertReturnBigIdentity(T t)
|
||||
{
|
||||
return baseRepository.InsertReturnBigIdentity(t);
|
||||
}
|
||||
|
||||
//public int InsertIgnoreNullColumn(List<T> t)
|
||||
//{
|
||||
// return 1;// Context.Insertable(parm).RemoveDataCache().ExecuteCommand();
|
||||
// return base.Context.Insertable(t).IgnoreColumns(true).ExecuteCommand();
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 添加或更新数据,不推荐使用了
|
||||
///// </summary>
|
||||
///// <param name="parm">List<T></param>
|
||||
///// <returns></returns>
|
||||
//public T Saveable(T parm, Expression<Func<T, object>> uClumns = null, Expression<Func<T, object>> iColumns = null)
|
||||
//public int InsertIgnoreNullColumn(List<T> t, params string[] columns)
|
||||
//{
|
||||
// var command = Context.Saveable(parm);
|
||||
|
||||
// if (uClumns != null)
|
||||
// return base.Context.Insertable(t).IgnoreColumns(columns).ExecuteCommand();
|
||||
//}
|
||||
//public DbResult<bool> InsertTran(T t)
|
||||
//{
|
||||
// var result = base.Context.Ado.UseTran(() =>
|
||||
// {
|
||||
// command = command.UpdateIgnoreColumns(uClumns);
|
||||
// }
|
||||
// base.Context.Insertable(t).ExecuteCommand();
|
||||
// });
|
||||
// return result;
|
||||
//}
|
||||
|
||||
// if (iColumns != null)
|
||||
//public DbResult<bool> InsertTran(List<T> t)
|
||||
//{
|
||||
// var result = base.Context.Ado.UseTran(() =>
|
||||
// {
|
||||
// command = command.InsertIgnoreColumns(iColumns);
|
||||
// }
|
||||
|
||||
// return command.ExecuteReturnEntity();
|
||||
// base.Context.Insertable(t).ExecuteCommand();
|
||||
// });
|
||||
// return result;
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 批量添加或更新数据
|
||||
///// </summary>
|
||||
///// <param name="parm">List<T></param>
|
||||
///// <returns></returns>
|
||||
//public List<T> Saveable(List<T> parm, Expression<Func<T, object>> uClumns = null, Expression<Func<T, object>> iColumns = null)
|
||||
//public T InsertReturnEntity(T t)
|
||||
//{
|
||||
// var command = Context.Saveable(parm);
|
||||
// return base.Context.Insertable(t).ExecuteReturnEntity();
|
||||
//}
|
||||
|
||||
// if (uClumns != null)
|
||||
//public T InsertReturnEntity(T t, string sqlWith = SqlWith.UpdLock)
|
||||
//{
|
||||
// return base.Context.Insertable(t).With(sqlWith).ExecuteReturnEntity();
|
||||
//}
|
||||
|
||||
//public bool ExecuteCommand(string sql, object parameters)
|
||||
//{
|
||||
// return base.Context.Ado.ExecuteCommand(sql, parameters) > 0;
|
||||
//}
|
||||
|
||||
//public bool ExecuteCommand(string sql, params SugarParameter[] parameters)
|
||||
//{
|
||||
// return base.Context.Ado.ExecuteCommand(sql, parameters) > 0;
|
||||
//}
|
||||
|
||||
//public bool ExecuteCommand(string sql, List<SugarParameter> parameters)
|
||||
//{
|
||||
// return base.Context.Ado.ExecuteCommand(sql, parameters) > 0;
|
||||
//}
|
||||
|
||||
#endregion add
|
||||
|
||||
#region update
|
||||
|
||||
public bool Update(T entity, bool ignoreNullColumns = false)
|
||||
{
|
||||
return baseRepository.Update(entity, ignoreNullColumns);
|
||||
}
|
||||
|
||||
public bool Update(T entity, Expression<Func<T, object>> expression, bool ignoreAllNull = false)
|
||||
{
|
||||
return baseRepository.Update(entity, expression, ignoreAllNull);
|
||||
}
|
||||
|
||||
public bool Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
|
||||
{
|
||||
return baseRepository.Update(entity, expression, where);
|
||||
}
|
||||
|
||||
public bool Update(SqlSugarClient client, T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
|
||||
{
|
||||
return client.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand() > 0;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
/////
|
||||
///// </summary>
|
||||
///// <param name="entity"></param>
|
||||
///// <param name="list"></param>
|
||||
///// <param name="isNull">默认为true</param>
|
||||
///// <returns></returns>
|
||||
//public bool Update(T entity, List<string> list = null, bool isNull = true)
|
||||
//{
|
||||
// if (list == null)
|
||||
// {
|
||||
// command = command.UpdateIgnoreColumns(uClumns);
|
||||
// }
|
||||
|
||||
// if (iColumns != null)
|
||||
// list = new List<string>()
|
||||
// {
|
||||
// command = command.InsertIgnoreColumns(iColumns);
|
||||
// "Create_By",
|
||||
// "Create_time"
|
||||
// };
|
||||
// }
|
||||
|
||||
// return command.ExecuteReturnList();
|
||||
// //base.Context.Updateable(entity).IgnoreColumns(c => list.Contains(c)).Where(isNull).ExecuteCommand()
|
||||
// return baseRepository.Update(entity, list, isNull);
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
//#region 查询操作
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件查询数据是否存在
|
||||
///// </summary>
|
||||
///// <param name="where">条件表达式树</param>
|
||||
///// <returns></returns>
|
||||
//public bool Any(Expression<Func<T, bool>> where)
|
||||
//public bool Update(List<T> entity)
|
||||
//{
|
||||
// return true;// base.Context.Any(where);
|
||||
// var result = base.Context.Ado.UseTran(() =>
|
||||
// {
|
||||
// base.Context.Updateable(entity).ExecuteCommand();
|
||||
// });
|
||||
// return result.IsSuccess;
|
||||
//}
|
||||
public bool Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns)
|
||||
{
|
||||
return baseRepository.Update(where, columns);
|
||||
}
|
||||
#endregion update
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件合计字段
|
||||
///// </summary>
|
||||
///// <param name="where">条件表达式树</param>
|
||||
///// <returns></returns>
|
||||
//public TResult Sum<TResult>(Expression<Func<T, bool>> where, Expression<Func<T, TResult>> field)
|
||||
//{
|
||||
// return base.Context.Queryable<T>().Where(where).Sum(field);
|
||||
//}
|
||||
public DbResult<bool> UseTran(Action action)
|
||||
{
|
||||
var result = baseRepository.UseTran(action) ;
|
||||
return result;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 根据主值查询单条数据
|
||||
///// </summary>
|
||||
///// <param name="pkValue">主键值</param>
|
||||
///// <returns>泛型实体</returns>
|
||||
////public T GetId(object pkValue)
|
||||
////{
|
||||
//// return base.Context.Queryable<T>().InSingle(pkValue);
|
||||
////}
|
||||
public DbResult<bool> UseTran(SqlSugarClient client, Action action)
|
||||
{
|
||||
var result = client.Ado.UseTran(() => action());
|
||||
return result;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 根据主键查询多条数据
|
||||
///// </summary>
|
||||
///// <param name="ids"></param>
|
||||
///// <returns></returns>
|
||||
//public List<T> GetIn(object[] ids)
|
||||
//{
|
||||
// return Context.Queryable<T>().In(ids).ToList();
|
||||
//}
|
||||
public bool UseTran2(Action action)
|
||||
{
|
||||
var result = baseRepository.UseTran2(action);
|
||||
return result;
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件取条数
|
||||
///// </summary>
|
||||
///// <param name="where">条件表达式树</param>
|
||||
///// <returns></returns>
|
||||
//public int GetCount(Expression<Func<T, bool>> where)
|
||||
//{
|
||||
// return Context.Queryable<T>().Count(where);
|
||||
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 查询所有数据(无分页,请慎用)
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//public List<T> GetAll(bool useCache = false, int cacheSecond = 3600)
|
||||
//{
|
||||
// return Context.Queryable<T>().WithCacheIF(useCache, cacheSecond).ToList();
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 获得一条数据
|
||||
///// </summary>
|
||||
///// <param name="where">Expression<Func<T, bool>></param>
|
||||
///// <returns></returns>
|
||||
//public T GetFirst2(Expression<Func<T, bool>> where)
|
||||
//{
|
||||
// return base.GetFirst(where);// Context.Queryable<T>().Where(where).First();
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// 获得一条数据
|
||||
///// </summary>
|
||||
///// <param name="parm">string</param>
|
||||
///// <returns></returns>
|
||||
////public T GetFirst(string parm)
|
||||
////{
|
||||
//// return Context.Queryable<T>().Where(parm).First();
|
||||
////}
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件查询分页数据
|
||||
///// </summary>
|
||||
///// <param name="where"></param>
|
||||
///// <param name="parm"></param>
|
||||
///// <returns></returns>
|
||||
//public PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm)
|
||||
//{
|
||||
// var source = Context.Queryable<T>().Where(where);
|
||||
|
||||
// return source.ToPage(parm);
|
||||
//}
|
||||
|
||||
//public PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm, Expression<Func<T, object>> order, string orderEnum = "Asc")
|
||||
//{
|
||||
// var source = Context.Queryable<T>().Where(where).OrderByIF(orderEnum == "Asc", order, OrderByType.Asc).OrderByIF(orderEnum == "Desc", order, OrderByType.Desc);
|
||||
|
||||
// return source.ToPage(parm);
|
||||
//}
|
||||
#region delete
|
||||
|
||||
/// <summary>
|
||||
/// 根据条件查询数据
|
||||
/// 删除表达式
|
||||
/// </summary>
|
||||
/// <param name="where">条件表达式树</param>
|
||||
/// <param name="expression"></param>
|
||||
/// <returns></returns>
|
||||
// public List<T> GetWhere(Expression<Func<T, bool>> where, bool useCache = false, int cacheSecond = 3600)
|
||||
// {
|
||||
// var query = Context.Queryable<T>().Where(where).WithCacheIF(useCache, cacheSecond);
|
||||
// return query.ToList();
|
||||
// }
|
||||
public int Delete(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
return baseRepository.Delete(expression);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
///// 根据条件查询数据
|
||||
///// </summary>
|
||||
///// <param name="where">条件表达式树</param>
|
||||
///// <returns></returns>
|
||||
// public List<T> GetWhere(Expression<Func<T, bool>> where, Expression<Func<T, object>> order, string orderEnum = "Asc", bool useCache = false, int cacheSecond = 3600)
|
||||
// {
|
||||
// var query = Context.Queryable<T>().Where(where).OrderByIF(orderEnum == "Asc", order, OrderByType.Asc).OrderByIF(orderEnum == "Desc", order, OrderByType.Desc).WithCacheIF(useCache, cacheSecond);
|
||||
// return query.ToList();
|
||||
// }
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public int Delete(object[] obj)
|
||||
{
|
||||
return baseRepository.Delete(obj);
|
||||
}
|
||||
public int Delete(object id)
|
||||
{
|
||||
return baseRepository.Delete(id);
|
||||
}
|
||||
public bool DeleteTable()
|
||||
{
|
||||
return baseRepository.DeleteTable();
|
||||
}
|
||||
|
||||
// #endregion
|
||||
#endregion delete
|
||||
|
||||
//#region 修改操作
|
||||
#region query
|
||||
|
||||
/////// <summary>
|
||||
/////// 修改一条数据
|
||||
/////// </summary>
|
||||
/////// <param name="parm">T</param>
|
||||
/////// <returns></returns>
|
||||
////public int Update(T parm)
|
||||
////{
|
||||
//// return Context.Updateable(parm).RemoveDataCache().ExecuteCommand();
|
||||
////}
|
||||
public bool Any(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
return baseRepository.Any(expression);
|
||||
}
|
||||
|
||||
/////// <summary>
|
||||
/////// 批量修改
|
||||
/////// </summary>
|
||||
/////// <param name="parm">T</param>
|
||||
/////// <returns></returns>
|
||||
////public int Update(List<T> parm)
|
||||
////{
|
||||
//// return Context.Updateable(parm).RemoveDataCache().ExecuteCommand();
|
||||
////}
|
||||
public ISugarQueryable<T> Queryable()
|
||||
{
|
||||
return baseRepository.Queryable();
|
||||
}
|
||||
|
||||
/////// <summary>
|
||||
/////// 按查询条件更新
|
||||
/////// </summary>
|
||||
/////// <param name="where"></param>
|
||||
/////// <param name="columns"></param>
|
||||
/////// <returns></returns>
|
||||
////public int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns)
|
||||
////{
|
||||
//// return Context.Updateable<T>().SetColumns(columns).Where(where).RemoveDataCache().ExecuteCommand();
|
||||
////}
|
||||
public List<T> GetList(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
return baseRepository.GetList(expression);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 删除操作
|
||||
|
||||
/////// <summary>
|
||||
/////// 删除一条或多条数据
|
||||
/////// </summary>
|
||||
/////// <param name="parm">string</param>
|
||||
/////// <returns></returns>
|
||||
////public int Delete(object id)
|
||||
////{
|
||||
//// return Context.Deleteable<T>(id).RemoveDataCache().ExecuteCommand();
|
||||
////}
|
||||
|
||||
/////// <summary>
|
||||
/////// 删除一条或多条数据
|
||||
/////// </summary>
|
||||
/////// <param name="parm">string</param>
|
||||
/////// <returns></returns>
|
||||
////public int Delete(object[] ids)
|
||||
////{
|
||||
//// return Context.Deleteable<T>().In(ids).RemoveDataCache().ExecuteCommand();
|
||||
////}
|
||||
|
||||
/////// <summary>
|
||||
/////// 根据条件删除一条或多条数据
|
||||
/////// </summary>
|
||||
/////// <param name="where">过滤条件</param>
|
||||
/////// <returns></returns>
|
||||
////public int Delete(Expression<Func<T, bool>> where)
|
||||
////{
|
||||
//// return Context.Deleteable<T>().Where(where).RemoveDataCache().ExecuteCommand();
|
||||
////}
|
||||
|
||||
//public int DeleteTable()
|
||||
//public Task<List<T>> QueryableToListAsync(Expression<Func<T, bool>> expression)
|
||||
//{
|
||||
// return Context.Deleteable<T>().RemoveDataCache().ExecuteCommand();
|
||||
// return Context.Queryable<T>().Where(expression).ToListAsync();
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
//public string QueryableToJson(string select, Expression<Func<T, bool>> expressionWhere)
|
||||
//{
|
||||
// var query = base.Context.Queryable<T>().Select(select).Where(expressionWhere).ToList();
|
||||
// return query.JilToJson();
|
||||
//}
|
||||
|
||||
//public List<T> QueryableToList(string tableName)
|
||||
//{
|
||||
// return Context.Queryable<T>(tableName).ToList();
|
||||
//}
|
||||
|
||||
//public (List<T>, int) QueryableToPage(Expression<Func<T, bool>> expression, int pageIndex = 0, int pageSize = 10)
|
||||
//{
|
||||
// int totalNumber = 0;
|
||||
// var list = Context.Queryable<T>().Where(expression).ToPageList(pageIndex, pageSize, ref totalNumber);
|
||||
// return (list, totalNumber);
|
||||
//}
|
||||
|
||||
//public (List<T>, int) QueryableToPage(Expression<Func<T, bool>> expression, string order, int pageIndex = 0, int pageSize = 10)
|
||||
//{
|
||||
// int totalNumber = 0;
|
||||
// var list = Context.Queryable<T>().Where(expression).OrderBy(order).ToPageList(pageIndex, pageSize, ref totalNumber);
|
||||
// return (list, totalNumber);
|
||||
//}
|
||||
|
||||
//public (List<T>, int) QueryableToPage(Expression<Func<T, bool>> expression, Expression<Func<T, object>> orderFiled, string orderBy, int pageIndex = 0, int pageSize = 10)
|
||||
//{
|
||||
// int totalNumber = 0;
|
||||
|
||||
// if (orderBy.Equals("DESC", StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// var list = Context.Queryable<T>().Where(expression).OrderBy(orderFiled, OrderByType.Desc).ToPageList(pageIndex, pageSize, ref totalNumber);
|
||||
// return (list, totalNumber);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var list = Context.Queryable<T>().Where(expression).OrderBy(orderFiled, OrderByType.Asc).ToPageList(pageIndex, pageSize, ref totalNumber);
|
||||
// return (list, totalNumber);
|
||||
// }
|
||||
//}
|
||||
|
||||
//public List<T> SqlQueryToList(string sql, object obj = null)
|
||||
//{
|
||||
// return Context.Ado.SqlQuery<T>(sql, obj);
|
||||
//}
|
||||
/// <summary>
|
||||
/// 获得一条数据
|
||||
/// </summary>
|
||||
/// <param name="where">Expression<Func<T, bool>></param>
|
||||
/// <returns></returns>
|
||||
public T GetFirst(Expression<Func<T, bool>> where)
|
||||
{
|
||||
return baseRepository.GetFirst(where);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主值查询单条数据
|
||||
/// </summary>
|
||||
/// <param name="pkValue">主键值</param>
|
||||
/// <returns>泛型实体</returns>
|
||||
public T GetId(object pkValue)
|
||||
{
|
||||
return baseRepository.GetId(pkValue);
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="where"></param>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm)
|
||||
{
|
||||
var source = baseRepository.GetPages(where, parm);
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
public PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm, Expression<Func<T, object>> order, OrderByType orderEnum = OrderByType.Asc)
|
||||
{
|
||||
return baseRepository.GetPages(where, parm, order, orderEnum);
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询所有数据(无分页,请慎用)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<T> GetAll(bool useCache = false, int cacheSecond = 3600)
|
||||
{
|
||||
return baseRepository.GetAll(useCache, cacheSecond);
|
||||
}
|
||||
|
||||
public int Count(Expression<Func<T, bool>> where)
|
||||
{
|
||||
return baseRepository.Count(where);
|
||||
}
|
||||
#endregion query
|
||||
|
||||
/// <summary>
|
||||
/// 此方法不带output返回值
|
||||
/// var list = new List<SugarParameter>();
|
||||
/// list.Add(new SugarParameter(ParaName, ParaValue)); input
|
||||
/// </summary>
|
||||
/// <param name="procedureName"></param>
|
||||
/// <param name="parameters"></param>
|
||||
/// <returns></returns>
|
||||
public DataTable UseStoredProcedureToDataTable(string procedureName, List<SugarParameter> parameters)
|
||||
{
|
||||
return baseRepository.UseStoredProcedureToDataTable(procedureName, parameters);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 带output返回值
|
||||
/// var list = new List<SugarParameter>();
|
||||
/// list.Add(new SugarParameter(ParaName, ParaValue, true)); output
|
||||
/// list.Add(new SugarParameter(ParaName, ParaValue)); input
|
||||
/// </summary>
|
||||
/// <param name="procedureName"></param>
|
||||
/// <param name="parameters"></param>
|
||||
/// <returns></returns>
|
||||
public (DataTable, List<SugarParameter>) UseStoredProcedureToTuple(string procedureName, List<SugarParameter> parameters)
|
||||
{
|
||||
return baseRepository.UseStoredProcedureToTuple(procedureName, parameters);
|
||||
}
|
||||
|
||||
//public string QueryableToJson(string select, Expression<Func<T, bool>> expressionWhere)
|
||||
//{
|
||||
// throw new NotImplementedException();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
using ZR.Model.Models;
|
||||
using ZR.Repository;
|
||||
|
||||
@@ -12,10 +13,10 @@ namespace ZR.Service.Business
|
||||
/// @date 2021-11-24
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IGendemoService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class GendemoService: BaseService<Gendemo>, IGendemoService
|
||||
public class GendemoService : BaseService<Gendemo>, IGendemoService
|
||||
{
|
||||
private readonly GendemoRepository _Gendemorepository;
|
||||
public GendemoService(GendemoRepository repository)
|
||||
public GendemoService(GendemoRepository repository) : base(repository)
|
||||
{
|
||||
_Gendemorepository = repository;
|
||||
}
|
||||
|
||||
+115
-169
@@ -2,8 +2,9 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using ZR.Repository;
|
||||
using ZR.Model;
|
||||
|
||||
namespace ZR.Service
|
||||
{
|
||||
@@ -11,200 +12,145 @@ namespace ZR.Service
|
||||
/// 基础服务定义
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public interface IBaseService<T> : IBaseRepository<T> where T : class, new()
|
||||
public interface IBaseService<T> where T : class, new()
|
||||
{
|
||||
#region 添加操作
|
||||
#region add
|
||||
int Add(T t);
|
||||
|
||||
//int Insert(SqlSugarClient client, T t);
|
||||
|
||||
//long InsertBigIdentity(T t);
|
||||
IInsertable<T> Insertable(T t);
|
||||
int Insert(List<T> t);
|
||||
int Insert(T parm, Expression<Func<T, object>> iClumns = null, bool ignoreNull = true);
|
||||
|
||||
//int InsertIgnoreNullColumn(List<T> t);
|
||||
|
||||
//int InsertIgnoreNullColumn(List<T> t, params string[] columns);
|
||||
|
||||
//DbResult<bool> InsertTran(T t);
|
||||
|
||||
//DbResult<bool> InsertTran(List<T> t);
|
||||
long InsertReturnBigIdentity(T t);
|
||||
//T InsertReturnEntity(T t);
|
||||
|
||||
//T InsertReturnEntity(T t, string sqlWith = SqlWith.UpdLock);
|
||||
|
||||
//bool ExecuteCommand(string sql, object parameters);
|
||||
|
||||
//bool ExecuteCommand(string sql, params SugarParameter[] parameters);
|
||||
|
||||
//bool ExecuteCommand(string sql, List<SugarParameter> parameters);
|
||||
|
||||
#endregion add
|
||||
|
||||
#region update
|
||||
|
||||
bool Update(T entity, bool ignoreNullColumns = false);
|
||||
|
||||
/// <summary>
|
||||
/// 添加一条数据
|
||||
/// 只更新表达式的值
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="expression"></param>
|
||||
/// <returns></returns>
|
||||
bool Update(T entity, Expression<Func<T, object>> expression, bool ignoreAllNull = false);
|
||||
|
||||
bool Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where);
|
||||
|
||||
bool Update(SqlSugarClient client, T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="entity">T</param>
|
||||
/// <param name="list">忽略更新</param>
|
||||
/// <param name="isNull">Null不更新</param>
|
||||
/// <returns></returns>
|
||||
//bool Update(T entity, List<string> list = null, bool isNull = true);
|
||||
|
||||
//bool Update(List<T> entity);
|
||||
bool Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns);
|
||||
|
||||
#endregion update
|
||||
|
||||
DbResult<bool> UseTran(Action action);
|
||||
|
||||
DbResult<bool> UseTran(SqlSugarClient client, Action action);
|
||||
|
||||
bool UseTran2(Action action);
|
||||
|
||||
#region delete
|
||||
|
||||
int Delete(Expression<Func<T, bool>> expression);
|
||||
int Delete(object[] obj);
|
||||
int Delete(object id);
|
||||
bool DeleteTable();
|
||||
|
||||
#endregion delete
|
||||
|
||||
#region query
|
||||
/// <summary>
|
||||
/// 根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="where"></param>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
//int Add(T parm);
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm);
|
||||
|
||||
//int Add(T parm, Expression<Func<T, object>> iClumns = null, bool ignoreNull = false);
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm, Expression<Func<T, object>> order, OrderByType orderEnum = OrderByType.Asc);
|
||||
|
||||
///// <summary>
|
||||
///// 批量添加数据
|
||||
///// </summary>
|
||||
///// <param name="parm">List<T></param>
|
||||
///// <returns></returns>
|
||||
//int Add(List<T> parm);
|
||||
bool Any(Expression<Func<T, bool>> expression);
|
||||
|
||||
///// <summary>
|
||||
///// 添加或更新数据
|
||||
///// </summary>
|
||||
///// <param name="parm"><T></param>
|
||||
///// <returns></returns>
|
||||
//T Saveable(T parm, Expression<Func<T, object>> uClumns = null, Expression<Func<T, object>> iColumns = null);
|
||||
ISugarQueryable<T> Queryable();
|
||||
List<T> GetAll(bool useCache = false, int cacheSecond = 3600);
|
||||
|
||||
///// <summary>
|
||||
///// 批量添加或更新数据
|
||||
///// </summary>
|
||||
///// <param name="parm">List<T></param>
|
||||
///// <returns></returns>
|
||||
//List<T> Saveable(List<T> parm, Expression<Func<T, object>> uClumns = null, Expression<Func<T, object>> iColumns = null);
|
||||
//ISugarQueryable<ExpandoObject> Queryable(string tableName, string shortName);
|
||||
|
||||
//ISugarQueryable<T, T1, T2> Queryable<T1, T2>() where T1 : class where T2 : new();
|
||||
|
||||
List<T> GetList(Expression<Func<T, bool>> expression);
|
||||
|
||||
//#endregion
|
||||
//Task<List<T>> QueryableToListAsync(Expression<Func<T, bool>> expression);
|
||||
|
||||
//#region 查询操作
|
||||
//string QueryableToJson(string select, Expression<Func<T, bool>> expressionWhere);
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件查询数据是否存在
|
||||
///// </summary>
|
||||
///// <param name="where">条件表达式树</param>
|
||||
///// <returns></returns>
|
||||
//bool Any(Expression<Func<T, bool>> where);
|
||||
//List<T> QueryableToList(string tableName);
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件合计字段
|
||||
///// </summary>
|
||||
///// <param name="where">条件表达式树</param>
|
||||
///// <returns></returns>
|
||||
//TResult Sum<TResult>(Expression<Func<T, bool>> where, Expression<Func<T, TResult>> field);
|
||||
//(List<T>, int) QueryableToPage(Expression<Func<T, bool>> expression, int pageIndex = 0, int pageSize = 10);
|
||||
|
||||
//(List<T>, int) QueryableToPage(Expression<Func<T, bool>> expression, string order, int pageIndex = 0, int pageSize = 10);
|
||||
|
||||
///// <summary>
|
||||
///// 根据主值查询单条数据
|
||||
///// </summary>
|
||||
///// <param name="pkValue">主键值</param>
|
||||
///// <returns>泛型实体</returns>
|
||||
//T GetId(object pkValue);
|
||||
//(List<T>, int) QueryableToPage(Expression<Func<T, bool>> expression, Expression<Func<T, object>> orderFiled, string orderBy, int pageIndex = 0, int pageSize = 10);
|
||||
|
||||
//(List<T>, int) QueryableToPage(Expression<Func<T, bool>> expression, Bootstrap.BootstrapParams bootstrap);
|
||||
|
||||
///// <summary>
|
||||
///// 根据主键查询多条数据
|
||||
///// </summary>
|
||||
///// <param name="ids"></param>
|
||||
///// <returns></returns>
|
||||
//List<T> GetIn(object[] ids);
|
||||
//List<T> SqlQueryToList(string sql, object obj = null);
|
||||
/// <summary>
|
||||
/// 获得一条数据
|
||||
/// </summary>
|
||||
/// <param name="where">Expression<Func<T, bool>></param>
|
||||
/// <returns></returns>
|
||||
T GetFirst(Expression<Func<T, bool>> where);
|
||||
T GetId(object pkValue);
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件取条数
|
||||
///// </summary>
|
||||
///// <param name="where">条件表达式树</param>
|
||||
///// <returns></returns>
|
||||
//int GetCount(Expression<Func<T, bool>> where);
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 查询所有数据(无分页,请慎用)
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//List<T> GetAll(bool useCache = false, int cacheSecond = 3600);
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 获得一条数据
|
||||
///// </summary>
|
||||
///// <param name="where">Expression<Func<T, bool>></param>
|
||||
///// <returns></returns>
|
||||
//T GetFirst(Expression<Func<T, bool>> where);
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 获得一条数据
|
||||
///// </summary>
|
||||
///// <param name="parm">string</param>
|
||||
///// <returns></returns>
|
||||
/// <summary>
|
||||
/// 获得一条数据
|
||||
/// </summary>
|
||||
/// <param name="parm">string</param>
|
||||
/// <returns></returns>
|
||||
//T GetFirst(string parm);
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件查询分页数据
|
||||
///// </summary>
|
||||
///// <param name="where"></param>
|
||||
///// <param name="parm"></param>
|
||||
///// <returns></returns>
|
||||
//PagedInfo<T> GetPages(Expression<Func<T, bool>> where, Model.PagerInfo parm);
|
||||
int Count(Expression<Func<T, bool>> where);
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件查询分页
|
||||
///// </summary>
|
||||
///// <param name="where"></param>
|
||||
///// <param name="parm"></param>
|
||||
///// <param name="order"></param>
|
||||
///// <param name="orderEnum"></param>
|
||||
///// <returns></returns>
|
||||
//PagedInfo<T> GetPages(Expression<Func<T, bool>> where, Model.PagerInfo parm, Expression<Func<T, object>> order, string orderEnum = "Asc");
|
||||
#endregion query
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件查询数据
|
||||
///// </summary>
|
||||
///// <param name="where">条件表达式树</param>
|
||||
///// <returns></returns>
|
||||
////List<T> GetWhere(Expression<Func<T, bool>> where, bool useCache = false, int cacheSecond = 3600);
|
||||
#region Procedure
|
||||
|
||||
/////// <summary>
|
||||
/////// 根据条件查询数据
|
||||
/////// </summary>
|
||||
/////// <param name="where">条件表达式树</param>
|
||||
/////// <returns></returns>
|
||||
////List<T> GetWhere(Expression<Func<T, bool>> where, Expression<Func<T, object>> order, string orderEnum = "Asc", bool useCache = false, int cacheSecond = 3600);
|
||||
DataTable UseStoredProcedureToDataTable(string procedureName, List<SugarParameter> parameters);
|
||||
|
||||
(DataTable, List<SugarParameter>) UseStoredProcedureToTuple(string procedureName, List<SugarParameter> parameters);
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 修改操作
|
||||
|
||||
///// <summary>
|
||||
///// 修改一条数据
|
||||
///// </summary>
|
||||
///// <param name="parm">T</param>
|
||||
///// <returns></returns>
|
||||
//int Update(T parm);
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 批量修改
|
||||
///// </summary>
|
||||
///// <param name="parm">T</param>
|
||||
///// <returns></returns>
|
||||
//int Update(List<T> parm);
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 按查询条件更新
|
||||
///// </summary>
|
||||
///// <param name="where"></param>
|
||||
///// <param name="columns"></param>
|
||||
///// <returns></returns>
|
||||
//int Update(Expression<Func<T, bool>> where, Expression<Func<T, T>> columns);
|
||||
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 删除操作
|
||||
|
||||
///// <summary>
|
||||
///// 删除一条或多条数据
|
||||
///// </summary>
|
||||
///// <param name="parm">string</param>
|
||||
///// <returns></returns>
|
||||
//int Delete(object id);
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 删除一条或多条数据
|
||||
///// </summary>
|
||||
///// <param name="parm">string</param>
|
||||
///// <returns></returns>
|
||||
//int Delete(object[] ids);
|
||||
|
||||
///// <summary>
|
||||
///// 根据条件删除一条或多条数据
|
||||
///// </summary>
|
||||
///// <param name="where">过滤条件</param>
|
||||
///// <returns></returns>
|
||||
//int Delete(Expression<Func<T, bool>> where);
|
||||
|
||||
///// <summary>
|
||||
///// 清空表
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//int DeleteTable();
|
||||
#endregion
|
||||
|
||||
#endregion Procedure
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
using SqlSugar.IOC;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
@@ -12,6 +15,9 @@ namespace ZR.Service.System
|
||||
[AppService(ServiceType = typeof(IArticleCategoryService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ArticleCategoryService : BaseService<ArticleCategory>, IArticleCategoryService
|
||||
{
|
||||
public ArticleCategoryService(ArticleCategoryRepository repository) : base(repository)
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// 构建前端所需要树结构
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Infrastructure.Attribute;
|
||||
using SqlSugar;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
@@ -10,6 +12,8 @@ namespace ZR.Service.System
|
||||
[AppService(ServiceType = typeof(IArticleService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ArticleService : BaseService<Article>, IArticleService
|
||||
{
|
||||
|
||||
public ArticleService(ArticleRepository repository) : base(repository)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ZR.Common;
|
||||
using ZR.Model.Models;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository;
|
||||
|
||||
@@ -15,15 +6,12 @@ namespace ZR.Service.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 参数配置Service业务层处理
|
||||
///
|
||||
/// @author zhaorui
|
||||
/// @date 2021-09-29
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysConfigService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysConfigService: BaseService<SysConfig>, ISysConfigService
|
||||
public class SysConfigService : BaseService<SysConfig>, ISysConfigService
|
||||
{
|
||||
private readonly SysConfigRepository _SysConfigrepository;
|
||||
public SysConfigService(SysConfigRepository repository)
|
||||
public SysConfigService(SysConfigRepository repository) : base(repository)
|
||||
{
|
||||
_SysConfigrepository = repository;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace ZR.Service.System
|
||||
{
|
||||
public SysDeptRepository DeptRepository;
|
||||
|
||||
public SysDeptService(SysDeptRepository deptRepository)
|
||||
public SysDeptService(SysDeptRepository deptRepository) : base(deptRepository)
|
||||
{
|
||||
DeptRepository = deptRepository;
|
||||
}
|
||||
|
||||
@@ -9,12 +9,15 @@ using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典数据类
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysDictDataService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysDictDataService: ISysDictDataService
|
||||
public class SysDictDataService : BaseService<SysDictData>, ISysDictDataService
|
||||
{
|
||||
|
||||
private readonly SysDictDataRepository SysDictDataRepository;
|
||||
public SysDictDataService(SysDictDataRepository sysDictDataRepository)
|
||||
public SysDictDataService(SysDictDataRepository sysDictDataRepository) : base(sysDictDataRepository)
|
||||
{
|
||||
SysDictDataRepository = sysDictDataRepository;
|
||||
}
|
||||
@@ -32,7 +35,7 @@ namespace ZR.Service.System
|
||||
/// <summary>
|
||||
/// 根据字典类型查询
|
||||
/// </summary>
|
||||
/// <param name="dictData"></param>
|
||||
/// <param name="dictType"></param>
|
||||
/// <returns></returns>
|
||||
public List<SysDictData> SelectDictDataByType(string dictType)
|
||||
{
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace ZR.Service.System
|
||||
/// 字典类型
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysDictService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysDictService : ISysDictService
|
||||
public class SysDictService : BaseService<SysDictType>, ISysDictService
|
||||
{
|
||||
private SysDictRepository DictRepository;
|
||||
private SysDictDataRepository DictDataRepository;
|
||||
|
||||
public SysDictService(SysDictRepository sysDictRepository, SysDictDataRepository dictDataRepository)
|
||||
public SysDictService(SysDictRepository sysDictRepository, SysDictDataRepository dictDataRepository) : base(sysDictRepository)
|
||||
{
|
||||
this.DictRepository = sysDictRepository;
|
||||
this.DictDataRepository = dictDataRepository;
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace ZR.Service.System
|
||||
{
|
||||
private SysLogininfoRepository SysLogininfoRepository;
|
||||
|
||||
public SysLoginService(SysLogininfoRepository sysLogininfo)
|
||||
public SysLoginService(SysLogininfoRepository sysLogininfo): base(sysLogininfo)
|
||||
{
|
||||
SysLogininfoRepository = sysLogininfo;
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ namespace ZR.Service
|
||||
/// 菜单
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysMenuService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysMenuService: ISysMenuService
|
||||
public class SysMenuService : BaseService<SysMenu>, ISysMenuService
|
||||
{
|
||||
public SysMenuRepository MenuRepository;
|
||||
public ISysRoleService SysRoleService;
|
||||
|
||||
public SysMenuService(
|
||||
SysMenuRepository menuRepository,
|
||||
ISysRoleService sysRoleService)
|
||||
SysMenuRepository menuRepository,
|
||||
ISysRoleService sysRoleService) : base(menuRepository)
|
||||
{
|
||||
MenuRepository = menuRepository;
|
||||
SysRoleService = sysRoleService;
|
||||
|
||||
@@ -13,11 +13,11 @@ namespace ZR.Service.System
|
||||
/// 操作日志
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysOperLogService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysOperLogService : ISysOperLogService
|
||||
public class SysOperLogService : BaseService<SysOperLog>, ISysOperLogService
|
||||
{
|
||||
public SysOperLogRepository sysOperLogRepository;
|
||||
|
||||
public SysOperLogService(SysOperLogRepository sysOperLog)
|
||||
public SysOperLogService(SysOperLogRepository sysOperLog) : base(sysOperLog)
|
||||
{
|
||||
sysOperLogRepository = sysOperLog;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色权限
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysPermissionService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysPermissionService : ISysPermissionService
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace ZR.Service.System
|
||||
public class SysPostService : BaseService<SysPost>, ISysPostService
|
||||
{
|
||||
public SysPostRepository PostRepository;
|
||||
public SysPostService(SysPostRepository postRepository)
|
||||
public SysPostService(SysPostRepository postRepository): base(postRepository)
|
||||
{
|
||||
PostRepository = postRepository;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务日志
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient, ServiceType = typeof(ISysTasksLogService))]
|
||||
public class SysTasksLogService : BaseRepository<SysTasksLog>, ISysTasksLogService
|
||||
{
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
using Infrastructure.Attribute;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 定时任务
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysTasksQzService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysTasksQzService : BaseService<SysTasksQz>, ISysTasksQzService
|
||||
{
|
||||
|
||||
public SysTasksQzService(SysTasksQzRepository repository) : base(repository)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户角色
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysUserRoleService),ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysUserRoleService: ISysUserRoleService
|
||||
{
|
||||
|
||||
@@ -10,6 +10,9 @@ using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统用户
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysUserService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysUserService : BaseService<SysUser>, ISysUserService
|
||||
{
|
||||
@@ -22,7 +25,7 @@ namespace ZR.Service
|
||||
SysUserRepository userRepository,
|
||||
ISysRoleService sysRoleService,
|
||||
ISysUserRoleService userRoleService,
|
||||
ISysUserPostService userPostService)
|
||||
ISysUserPostService userPostService) : base(userRepository)
|
||||
{
|
||||
UserRepository = userRepository;
|
||||
RoleService = sysRoleService;
|
||||
|
||||
Reference in New Issue
Block a user