优化数据仓储
This commit is contained in:
parent
3e6d2fdce1
commit
1c3cdb99e0
@ -20,26 +20,21 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
[Route("system/user")]
|
||||
public class SysUserController : BaseController
|
||||
{
|
||||
private readonly NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly ISysUserService UserService;
|
||||
private readonly ISysRoleService RoleService;
|
||||
private readonly ISysPostService PostService;
|
||||
private readonly ISysUserPostService UserPostService;
|
||||
private IWebHostEnvironment WebHostEnvironment;
|
||||
|
||||
public SysUserController(
|
||||
ISysUserService userService,
|
||||
ISysRoleService roleService,
|
||||
ISysPostService postService,
|
||||
ISysUserPostService userPostService,
|
||||
IWebHostEnvironment HostEnvironment)
|
||||
ISysUserPostService userPostService)
|
||||
{
|
||||
UserService = userService;
|
||||
RoleService = roleService;
|
||||
PostService = postService;
|
||||
UserPostService = userPostService;
|
||||
WebHostEnvironment = HostEnvironment;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -21,7 +21,7 @@ namespace ${options.ServicesNamespace}.${options.SubNamespace}
|
||||
public class ${replaceDto.ModelTypeName}Service : BaseService<${replaceDto.ModelTypeName}>, I${replaceDto.ModelTypeName}Service
|
||||
{
|
||||
private readonly ${replaceDto.ModelTypeName}Repository _${replaceDto.ModelTypeName}repository;
|
||||
public ${replaceDto.ModelTypeName}Service(${replaceDto.ModelTypeName}Repository repository) : base(repository)
|
||||
public ${replaceDto.ModelTypeName}Service(${replaceDto.ModelTypeName}Repository repository)
|
||||
{
|
||||
_${replaceDto.ModelTypeName}repository = repository;
|
||||
}
|
||||
|
||||
@ -15,16 +15,17 @@ namespace ZR.Repository
|
||||
///
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class BaseRepository<T> : IBaseRepository<T> where T : class, new()
|
||||
public class BaseRepository<T> : SimpleClient<T> where T : class, new()
|
||||
{
|
||||
public ISqlSugarClient Context;
|
||||
|
||||
public BaseRepository(ISqlSugarClient client = null)
|
||||
public ITenant itenant = null;//多租户事务
|
||||
public BaseRepository(ISqlSugarClient client = null) : base(client)
|
||||
{
|
||||
//通过特性拿到ConfigId
|
||||
var configId = typeof(T).GetCustomAttribute<TenantAttribute>()?.configId;
|
||||
if(configId != null)
|
||||
if (configId != null)
|
||||
{
|
||||
Context = DbScoped.SugarScope.GetConnection(configId);
|
||||
itenant = DbScoped.SugarScope;//设置租户接口
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -53,10 +54,10 @@ namespace ZR.Repository
|
||||
{
|
||||
return Context.Insertable(t).ExecuteCommand();
|
||||
}
|
||||
public long InsertReturnBigIdentity(T t)
|
||||
{
|
||||
return Context.Insertable(t).ExecuteReturnBigIdentity();
|
||||
}
|
||||
//public long InsertReturnBigIdentity(T t)
|
||||
//{
|
||||
// return Context.Insertable(t).ExecuteReturnBigIdentity();
|
||||
//}
|
||||
|
||||
//public int InsertIgnoreNullColumn(List<T> t)
|
||||
//{
|
||||
@ -193,16 +194,40 @@ namespace ZR.Repository
|
||||
#endregion update
|
||||
|
||||
public DbResult<bool> UseTran(Action action)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = Context.Ado.UseTran(() => action());
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
Console.WriteLine(ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="client"></param>
|
||||
/// <param name="action">增删改查方法</param>
|
||||
/// <returns></returns>
|
||||
public DbResult<bool> UseTran(SqlSugarClient client, Action action)
|
||||
{
|
||||
var result = client.Ado.UseTran(() => action());
|
||||
try
|
||||
{
|
||||
var result = client.AsTenant().UseTran(() => action());
|
||||
return result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
client.AsTenant().RollbackTran();
|
||||
Console.WriteLine(ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public bool UseTran2(Action action)
|
||||
{
|
||||
@ -216,16 +241,6 @@ namespace ZR.Repository
|
||||
return Context.Deleteable<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除表达式
|
||||
/// </summary>
|
||||
/// <param name="expression"></param>
|
||||
/// <returns></returns>
|
||||
public int Delete(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
return Context.Deleteable<T>().Where(expression).ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
@ -258,32 +273,6 @@ namespace ZR.Repository
|
||||
return Context.Queryable<T>();
|
||||
}
|
||||
|
||||
//public ISugarQueryable<ExpandoObject> Queryable(string tableName, string shortName)
|
||||
//{
|
||||
// return Context.Queryable(tableName, shortName);
|
||||
//}
|
||||
|
||||
public List<T> GetList(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
return Context.Queryable<T>().Where(expression).ToList();
|
||||
}
|
||||
|
||||
//public Task<List<T>> QueryableToListAsync(Expression<Func<T, bool>> expression)
|
||||
//{
|
||||
// return Context.Queryable<T>().Where(expression).ToListAsync();
|
||||
//}
|
||||
|
||||
//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;
|
||||
@ -318,15 +307,6 @@ namespace ZR.Repository
|
||||
{
|
||||
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 Context.Queryable<T>().Where(where).First();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主值查询单条数据
|
||||
@ -371,10 +351,6 @@ namespace ZR.Repository
|
||||
return Context.Queryable<T>().WithCacheIF(useCache, cacheSecond).ToList();
|
||||
}
|
||||
|
||||
public int Count(Expression<Func<T, bool>> where)
|
||||
{
|
||||
return Context.Queryable<T>().Count(where);
|
||||
}
|
||||
#endregion query
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -1,44 +1,20 @@
|
||||
using Infrastructure.Model;
|
||||
using SqlSugar;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model;
|
||||
|
||||
namespace ZR.Repository
|
||||
{
|
||||
public interface IBaseRepository<T> where T : class, new()
|
||||
public interface IBaseRepository<T> : ISimpleClient<T> where T : class, new()
|
||||
{
|
||||
#region add
|
||||
int Add(T t);
|
||||
|
||||
//int Insert(SqlSugarClient client, 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);
|
||||
IInsertable<T> Insertable(T t);
|
||||
#endregion add
|
||||
|
||||
@ -70,7 +46,6 @@ namespace ZR.Repository
|
||||
|
||||
#region delete
|
||||
IDeleteable<T> Deleteable();
|
||||
int Delete(Expression<Func<T, bool>> expression);
|
||||
int Delete(object[] obj);
|
||||
int Delete(object id);
|
||||
int DeleteTable();
|
||||
@ -94,18 +69,6 @@ namespace ZR.Repository
|
||||
ISugarQueryable<T> Queryable();
|
||||
List<T> GetAll(bool useCache = false, int cacheSecond = 3600);
|
||||
|
||||
//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);
|
||||
|
||||
//Task<List<T>> QueryableToListAsync(Expression<Func<T, bool>> expression);
|
||||
|
||||
//string QueryableToJson(string select, Expression<Func<T, bool>> expressionWhere);
|
||||
|
||||
//List<T> QueryableToList(string tableName);
|
||||
|
||||
(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);
|
||||
@ -113,23 +76,9 @@ namespace ZR.Repository
|
||||
(List<T>, int) QueryableToPage(Expression<Func<T, bool>> expression, Expression<Func<T, object>> orderFiled, string orderBy, int pageIndex = 0, int pageSize = 10);
|
||||
|
||||
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="parm">string</param>
|
||||
/// <returns></returns>
|
||||
//T GetFirst(string parm);
|
||||
|
||||
int Count(Expression<Func<T, bool>> where);
|
||||
|
||||
#endregion query
|
||||
|
||||
#region Procedure
|
||||
|
||||
@ -1,12 +1,4 @@
|
||||
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;
|
||||
using ZR.Repository;
|
||||
|
||||
namespace ZR.Service
|
||||
{
|
||||
@ -14,393 +6,13 @@ namespace ZR.Service
|
||||
/// 基础服务定义
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class BaseService<T> : IBaseService<T> where T : class, new()
|
||||
public class BaseService<T> : BaseRepository<T> where T : class, new()
|
||||
{
|
||||
public IBaseRepository<T> baseRepository;
|
||||
//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)
|
||||
//public BaseService(IBaseRepository<T> repository)
|
||||
//{
|
||||
// return client.Insertable(t).ExecuteCommand();
|
||||
//}
|
||||
|
||||
//public long InsertBigIdentity(T t)
|
||||
//{
|
||||
// return base.Context.Insertable(t).ExecuteReturnBigIdentity();
|
||||
//}
|
||||
|
||||
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 base.Context.Insertable(t).IgnoreColumns(true).ExecuteCommand();
|
||||
//}
|
||||
|
||||
//public int InsertIgnoreNullColumn(List<T> t, params string[] columns)
|
||||
//{
|
||||
// return base.Context.Insertable(t).IgnoreColumns(columns).ExecuteCommand();
|
||||
//}
|
||||
//public DbResult<bool> InsertTran(T t)
|
||||
//{
|
||||
// var result = base.Context.Ado.UseTran(() =>
|
||||
// {
|
||||
// base.Context.Insertable(t).ExecuteCommand();
|
||||
// });
|
||||
// return result;
|
||||
//}
|
||||
|
||||
//public DbResult<bool> InsertTran(List<T> t)
|
||||
//{
|
||||
// var result = base.Context.Ado.UseTran(() =>
|
||||
// {
|
||||
// base.Context.Insertable(t).ExecuteCommand();
|
||||
// });
|
||||
// return result;
|
||||
//}
|
||||
|
||||
//public T InsertReturnEntity(T t)
|
||||
//{
|
||||
// return base.Context.Insertable(t).ExecuteReturnEntity();
|
||||
//}
|
||||
|
||||
//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 int Update(T entity, bool ignoreNullColumns = false)
|
||||
{
|
||||
return baseRepository.Update(entity, ignoreNullColumns);
|
||||
}
|
||||
|
||||
public int Update(T entity, Expression<Func<T, object>> expression, bool ignoreAllNull = false)
|
||||
{
|
||||
return baseRepository.Update(entity, expression, ignoreAllNull);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据实体类更新 eg:Update(dept, it => new { it.Status }, f => depts.Contains(f.DeptId));只更新Status列,条件是包含
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="expression"></param>
|
||||
/// <param name="where"></param>
|
||||
/// <returns></returns>
|
||||
public int Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
|
||||
{
|
||||
return baseRepository.Update(entity, expression, where);
|
||||
}
|
||||
|
||||
public int Update(SqlSugarClient client, T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where)
|
||||
{
|
||||
return client.Updateable(entity).UpdateColumns(expression).Where(where).ExecuteCommand();
|
||||
}
|
||||
|
||||
///// <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)
|
||||
// {
|
||||
// list = new List<string>()
|
||||
// {
|
||||
// "Create_By",
|
||||
// "Create_time"
|
||||
// };
|
||||
// }
|
||||
// //base.Context.Updateable(entity).IgnoreColumns(c => list.Contains(c)).Where(isNull).ExecuteCommand()
|
||||
// return baseRepository.Update(entity, list, isNull);
|
||||
//}
|
||||
|
||||
//public bool Update(List<T> entity)
|
||||
//{
|
||||
// var result = base.Context.Ado.UseTran(() =>
|
||||
// {
|
||||
// base.Context.Updateable(entity).ExecuteCommand();
|
||||
// });
|
||||
// return result.IsSuccess;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定列 eg:Update(w => w.NoticeId == model.NoticeId, it => new SysNotice(){ Update_time = DateTime.Now, Title = "通知标题" });
|
||||
/// </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 baseRepository.Update(where, columns);
|
||||
}
|
||||
#endregion update
|
||||
|
||||
public DbResult<bool> UseTran(Action action)
|
||||
{
|
||||
var result = baseRepository.UseTran(action);
|
||||
return result;
|
||||
}
|
||||
|
||||
public DbResult<bool> UseTran(SqlSugarClient client, Action action)
|
||||
{
|
||||
var result = client.Ado.UseTran(() => action());
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool UseTran2(Action action)
|
||||
{
|
||||
var result = baseRepository.UseTran2(action);
|
||||
return result;
|
||||
}
|
||||
|
||||
#region delete
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IDeleteable<T> Deleteable()
|
||||
{
|
||||
return baseRepository.Deleteable();
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除表达式
|
||||
/// </summary>
|
||||
/// <param name="expression"></param>
|
||||
/// <returns></returns>
|
||||
public int Delete(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
return baseRepository.Delete(expression);
|
||||
}
|
||||
|
||||
/// <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 int DeleteTable()
|
||||
{
|
||||
return baseRepository.DeleteTable();
|
||||
}
|
||||
|
||||
#endregion delete
|
||||
|
||||
#region query
|
||||
|
||||
public bool Any(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
return baseRepository.Any(expression);
|
||||
}
|
||||
|
||||
public ISugarQueryable<T> Queryable()
|
||||
{
|
||||
return baseRepository.Queryable();
|
||||
}
|
||||
|
||||
public List<T> GetList(Expression<Func<T, bool>> expression)
|
||||
{
|
||||
return baseRepository.GetList(expression);
|
||||
}
|
||||
|
||||
//public Task<List<T>> QueryableToListAsync(Expression<Func<T, bool>> expression)
|
||||
//{
|
||||
// return Context.Queryable<T>().Where(expression).ToListAsync();
|
||||
//}
|
||||
|
||||
//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);
|
||||
}
|
||||
public PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm, Expression<Func<T, object>> order, string orderByType)
|
||||
{
|
||||
return baseRepository.GetPages(where, parm, order, orderByType == "desc" ? OrderByType.Desc : OrderByType.Asc);
|
||||
}
|
||||
/// <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();
|
||||
// this.baseRepository = repository ?? throw new ArgumentNullException(nameof(repository));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,4 @@
|
||||
using Infrastructure.Model;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq.Expressions;
|
||||
using ZR.Model;
|
||||
using ZR.Repository;
|
||||
|
||||
namespace ZR.Service
|
||||
{
|
||||
@ -12,145 +6,7 @@ namespace ZR.Service
|
||||
/// 基础服务定义
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public interface IBaseService<T> where T : class, new()
|
||||
public interface IBaseService<T> : IBaseRepository<T> where T : class, new()
|
||||
{
|
||||
#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
|
||||
|
||||
int Update(T entity, bool ignoreNullColumns = false);
|
||||
|
||||
/// <summary>
|
||||
/// 只更新表达式的值
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="expression"></param>
|
||||
/// <returns></returns>
|
||||
int Update(T entity, Expression<Func<T, object>> expression, bool ignoreAllNull = false);
|
||||
|
||||
int Update(T entity, Expression<Func<T, object>> expression, Expression<Func<T, bool>> where);
|
||||
|
||||
int 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);
|
||||
int 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
|
||||
IDeleteable<T> Deleteable();
|
||||
int Delete(Expression<Func<T, bool>> expression);
|
||||
int Delete(object[] obj);
|
||||
int Delete(object id);
|
||||
int DeleteTable();
|
||||
|
||||
#endregion delete
|
||||
|
||||
#region query
|
||||
/// <summary>
|
||||
/// 根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="where"></param>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm);
|
||||
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm, Expression<Func<T, object>> order, OrderByType orderEnum = OrderByType.Asc);
|
||||
PagedInfo<T> GetPages(Expression<Func<T, bool>> where, PagerInfo parm, Expression<Func<T, object>> order, string orderType);
|
||||
bool Any(Expression<Func<T, bool>> expression);
|
||||
|
||||
ISugarQueryable<T> Queryable();
|
||||
List<T> GetAll(bool useCache = false, int cacheSecond = 3600);
|
||||
|
||||
//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);
|
||||
|
||||
//Task<List<T>> QueryableToListAsync(Expression<Func<T, bool>> expression);
|
||||
|
||||
//string QueryableToJson(string select, Expression<Func<T, bool>> expressionWhere);
|
||||
|
||||
//List<T> QueryableToList(string tableName);
|
||||
|
||||
//(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);
|
||||
|
||||
//(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);
|
||||
|
||||
//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="parm">string</param>
|
||||
/// <returns></returns>
|
||||
//T GetFirst(string parm);
|
||||
|
||||
int Count(Expression<Func<T, bool>> where);
|
||||
|
||||
#endregion query
|
||||
|
||||
#region Procedure
|
||||
|
||||
DataTable UseStoredProcedureToDataTable(string procedureName, List<SugarParameter> parameters);
|
||||
|
||||
(DataTable, List<SugarParameter>) UseStoredProcedureToTuple(string procedureName, List<SugarParameter> parameters);
|
||||
|
||||
#endregion Procedure
|
||||
}
|
||||
}
|
||||
@ -15,9 +15,6 @@ 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>
|
||||
|
||||
@ -12,8 +12,5 @@ namespace ZR.Service.System
|
||||
[AppService(ServiceType = typeof(IArticleService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ArticleService : BaseService<Article>, IArticleService
|
||||
{
|
||||
public ArticleService(ArticleRepository repository) : base(repository)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ namespace ZR.Service.System
|
||||
{
|
||||
private GenTableRepository GenTableRepository;
|
||||
private IGenTableColumnService GenTableColumnService;
|
||||
public GenTableService(IGenTableColumnService genTableColumnService, GenTableRepository genTableRepository) : base(genTableRepository)
|
||||
public GenTableService(IGenTableColumnService genTableColumnService, GenTableRepository genTableRepository)
|
||||
{
|
||||
GenTableColumnService = genTableColumnService;
|
||||
GenTableRepository = genTableRepository;
|
||||
@ -45,7 +45,7 @@ namespace ZR.Service.System
|
||||
/// <returns></returns>
|
||||
public int DeleteGenTableByTbName(string tableName)
|
||||
{
|
||||
return GenTableRepository.Delete(f => f.TableName == tableName);
|
||||
return GenTableRepository.Delete(f => f.TableName == tableName) ? 1: 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -180,7 +180,7 @@ namespace ZR.Service.System
|
||||
{
|
||||
|
||||
private GenTableColumnRepository GetTableColumnRepository;
|
||||
public GenTableColumnService(GenTableColumnRepository genTableColumnRepository) : base(genTableColumnRepository)
|
||||
public GenTableColumnService(GenTableColumnRepository genTableColumnRepository)
|
||||
{
|
||||
GetTableColumnRepository = genTableColumnRepository;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ using ZR.Model.System.Generate;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface IGenTableService: IBaseService<GenTable>
|
||||
public interface IGenTableService : IBaseService<GenTable>
|
||||
{
|
||||
List<GenTable> SelectDbTableListByNamess(string[] tableNames);
|
||||
|
||||
@ -19,7 +19,7 @@ namespace ZR.Service.System.IService
|
||||
int UpdateGenTable(GenTable genTable);
|
||||
}
|
||||
|
||||
public interface IGenTableColumnService: IBaseService<GenTableColumn>
|
||||
public interface IGenTableColumnService : IBaseService<GenTableColumn>
|
||||
{
|
||||
int InsertGenTableColumn(List<GenTableColumn> tableColumn);
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ namespace ZR.Service.System
|
||||
/// @author zhaorui
|
||||
/// @date 2021-09-29
|
||||
/// </summary>
|
||||
public interface ISysConfigService: IBaseService<SysConfig>
|
||||
public interface ISysConfigService : IBaseService<SysConfig>
|
||||
{
|
||||
SysConfig GetSysConfigByKey(string key);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ZR.Model.System;
|
||||
using ZR.Model.Vo.System;
|
||||
using ZR.Repository;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
@ -19,7 +20,7 @@ namespace ZR.Service.System.IService
|
||||
List<SysRoleDept> SelectRoleDeptByRoleId(long roleId);
|
||||
|
||||
List<long> SelectRoleDepts(long roleId);
|
||||
int DeleteRoleDeptByRoleId(long roleId);
|
||||
bool DeleteRoleDeptByRoleId(long roleId);
|
||||
int InsertRoleDepts(SysRole role);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,5 +10,6 @@ namespace ZR.Service.System.IService
|
||||
{
|
||||
string CheckPostNameUnique(SysPost sysPost);
|
||||
string CheckPostCodeUnique(SysPost sysPost);
|
||||
List<SysPost> GetAll();
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,6 @@ namespace ZR.Service.System.IService
|
||||
public List<long> GetUserPostsByUserId(long userId);
|
||||
|
||||
public string GetPostsStrByUserId(long userId);
|
||||
int Delete(long userId);
|
||||
bool Delete(long userId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
|
||||
@ -11,7 +11,7 @@ namespace ZR.Service.System
|
||||
public class SysConfigService : BaseService<SysConfig>, ISysConfigService
|
||||
{
|
||||
private readonly SysConfigRepository _SysConfigrepository;
|
||||
public SysConfigService(SysConfigRepository repository) : base(repository)
|
||||
public SysConfigService(SysConfigRepository repository)
|
||||
{
|
||||
_SysConfigrepository = repository;
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ namespace ZR.Service.System
|
||||
{
|
||||
public SysDeptRepository DeptRepository;
|
||||
public SysRoleDeptRepository RoleDeptRepository;
|
||||
public SysDeptService(SysDeptRepository deptRepository, SysRoleDeptRepository roleDeptRepository) : base(deptRepository)
|
||||
public SysDeptService(SysDeptRepository deptRepository, SysRoleDeptRepository roleDeptRepository)
|
||||
{
|
||||
DeptRepository = deptRepository;
|
||||
RoleDeptRepository = roleDeptRepository;
|
||||
@ -256,7 +256,7 @@ namespace ZR.Service.System
|
||||
/// </summary>
|
||||
/// <param name="roleId"></param>
|
||||
/// <returns></returns>
|
||||
public int DeleteRoleDeptByRoleId(long roleId)
|
||||
public bool DeleteRoleDeptByRoleId(long roleId)
|
||||
{
|
||||
return RoleDeptRepository.Delete(f => f.RoleId == roleId);
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ namespace ZR.Service.System
|
||||
{
|
||||
|
||||
private readonly SysDictDataRepository SysDictDataRepository;
|
||||
public SysDictDataService(SysDictDataRepository sysDictDataRepository) : base(sysDictDataRepository)
|
||||
public SysDictDataService(SysDictDataRepository sysDictDataRepository)
|
||||
{
|
||||
SysDictDataRepository = sysDictDataRepository;
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ namespace ZR.Service.System
|
||||
private SysDictRepository DictRepository;
|
||||
private SysDictDataRepository DictDataRepository;
|
||||
|
||||
public SysDictService(SysDictRepository sysDictRepository, SysDictDataRepository dictDataRepository) : base(sysDictRepository)
|
||||
public SysDictService(SysDictRepository sysDictRepository, SysDictDataRepository dictDataRepository)
|
||||
{
|
||||
this.DictRepository = sysDictRepository;
|
||||
this.DictDataRepository = dictDataRepository;
|
||||
|
||||
@ -11,7 +11,6 @@ using System.Net;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository.System;
|
||||
using Infrastructure.Extensions;
|
||||
using SqlSugar.DistributedSystem.Snowflake;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
@ -24,7 +23,7 @@ namespace ZR.Service.System
|
||||
private string domainUrl = AppSettings.GetConfig("ALIYUN_OSS:domainUrl");
|
||||
private readonly SysFileRepository SysFileRepository;
|
||||
|
||||
public SysFileService(SysFileRepository repository) : base(repository)
|
||||
public SysFileService(SysFileRepository repository)
|
||||
{
|
||||
SysFileRepository = repository;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ namespace ZR.Service.System
|
||||
{
|
||||
private SysLogininfoRepository SysLogininfoRepository;
|
||||
|
||||
public SysLoginService(SysLogininfoRepository sysLogininfo): base(sysLogininfo)
|
||||
public SysLoginService(SysLogininfoRepository sysLogininfo)
|
||||
{
|
||||
SysLogininfoRepository = sysLogininfo;
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ namespace ZR.Service
|
||||
|
||||
public SysMenuService(
|
||||
SysMenuRepository menuRepository,
|
||||
ISysRoleService sysRoleService) : base(menuRepository)
|
||||
ISysRoleService sysRoleService)
|
||||
{
|
||||
MenuRepository = menuRepository;
|
||||
SysRoleService = sysRoleService;
|
||||
|
||||
@ -19,7 +19,7 @@ namespace ZR.Service.System
|
||||
public class SysNoticeService : BaseService<SysNotice>, ISysNoticeService
|
||||
{
|
||||
private readonly SysNoticeRepository _SysNoticerepository;
|
||||
public SysNoticeService(SysNoticeRepository repository) : base(repository)
|
||||
public SysNoticeService(SysNoticeRepository repository)
|
||||
{
|
||||
_SysNoticerepository = repository;
|
||||
}
|
||||
|
||||
@ -1,12 +1,10 @@
|
||||
using Infrastructure.Attribute;
|
||||
using System.Collections.Generic;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System.Dto;
|
||||
using ZR.Model.System;
|
||||
using ZR.Model.System.Dto;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Model;
|
||||
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
@ -18,7 +16,7 @@ namespace ZR.Service.System
|
||||
{
|
||||
public SysOperLogRepository sysOperLogRepository;
|
||||
|
||||
public SysOperLogService(SysOperLogRepository sysOperLog) : base(sysOperLog)
|
||||
public SysOperLogService(SysOperLogRepository sysOperLog)
|
||||
{
|
||||
sysOperLogRepository = sysOperLog;
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ namespace ZR.Service.System
|
||||
public class SysPostService : BaseService<SysPost>, ISysPostService
|
||||
{
|
||||
public SysPostRepository PostRepository;
|
||||
public SysPostService(SysPostRepository postRepository): base(postRepository)
|
||||
public SysPostService(SysPostRepository postRepository)
|
||||
{
|
||||
PostRepository = postRepository;
|
||||
}
|
||||
@ -50,5 +50,10 @@ namespace ZR.Service.System
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
public List<SysPost> GetAll()
|
||||
{
|
||||
return PostRepository.GetAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ namespace ZR.Service
|
||||
public SysRoleService(
|
||||
SysRoleRepository sysRoleRepository,
|
||||
ISysUserRoleService sysUserRoleService,
|
||||
ISysDeptService deptService) : base(sysRoleRepository)
|
||||
ISysDeptService deptService)
|
||||
{
|
||||
SysRoleRepository = sysRoleRepository;
|
||||
SysUserRoleService = sysUserRoleService;
|
||||
|
||||
@ -11,7 +11,7 @@ namespace ZR.Service.System
|
||||
[AppService(ServiceType = typeof(ISysTasksQzService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysTasksQzService : BaseService<SysTasksQz>, ISysTasksQzService
|
||||
{
|
||||
public SysTasksQzService(SysTasksQzRepository repository) : base(repository)
|
||||
public SysTasksQzService(SysTasksQzRepository repository)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ namespace ZR.Service.System
|
||||
return string.Join(',', list.Select(x => x.PostName));
|
||||
}
|
||||
|
||||
public int Delete(long userId)
|
||||
public bool Delete(long userId)
|
||||
{
|
||||
return UserPostRepository.Delete(x => x.UserId == userId);
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ namespace ZR.Service
|
||||
SysUserRepository userRepository,
|
||||
ISysRoleService sysRoleService,
|
||||
ISysUserRoleService userRoleService,
|
||||
ISysUserPostService userPostService) : base(userRepository)
|
||||
ISysUserPostService userPostService)
|
||||
{
|
||||
UserRepository = userRepository;
|
||||
RoleService = sysRoleService;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user