优化接口、仓储层
This commit is contained in:
@@ -10,7 +10,7 @@ namespace ZR.Service.System
|
||||
/// 文章目录
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IArticleCategoryService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ArticleCategoryService : IArticleCategoryService
|
||||
public class ArticleCategoryService : BaseService<ArticleCategory>, IArticleCategoryService
|
||||
{
|
||||
/// <summary>
|
||||
/// 构建前端所需要树结构
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ZR.Service.System
|
||||
///
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IArticleService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class ArticleService : IArticleService
|
||||
public class ArticleService : BaseService<Article>, IArticleService
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -67,11 +67,7 @@ namespace ZR.Service.System
|
||||
var predicate = Expressionable.Create<GenTable>();
|
||||
predicate = predicate.AndIF(genTable.TableName.IfNotEmpty(), it => it.TableName.Contains(genTable.TableName));
|
||||
|
||||
(List<GenTable>, int) ts = GenTableRepository.QueryableToPage(predicate.ToExpression(), pagerInfo.PageNum, pagerInfo.PageSize);
|
||||
|
||||
PagedInfo<GenTable> pagedInfo = new(ts.Item1, pagerInfo.PageNum, pagerInfo.PageSize);
|
||||
pagedInfo.TotalCount = ts.Item2;
|
||||
return pagedInfo;
|
||||
return GenTableRepository.GetPages(predicate.ToExpression(), pagerInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -7,7 +7,7 @@ using ZR.Model.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface IArticleCategoryService //: IBaseService<ArticleCategory>
|
||||
public interface IArticleCategoryService : IBaseService<ArticleCategory>
|
||||
{
|
||||
List<ArticleCategory> BuildCategoryTree(List<ArticleCategory> categories);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using ZR.Model.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface IArticleService //: IBaseService<Article>
|
||||
public interface IArticleService : IBaseService<Article>
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -6,15 +6,15 @@ using ZR.Model.Vo.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysDeptService //: IBaseService<SysDept>
|
||||
public interface ISysDeptService : IBaseService<SysDept>
|
||||
{
|
||||
public List<SysDept> GetSysDepts(SysDept dept);
|
||||
public string CheckDeptNameUnique(SysDept dept);
|
||||
public int InsertDept(SysDept dept);
|
||||
public int UpdateDept(SysDept dept);
|
||||
public void UpdateDeptChildren(long deptId, string newAncestors, string oldAncestors);
|
||||
public List<SysDept> GetChildrenDepts(List<SysDept> depts, long deptId);
|
||||
public List<SysDept> BuildDeptTree(List<SysDept> depts);
|
||||
public List<TreeSelectVo> BuildDeptTreeSelect(List<SysDept> depts);
|
||||
List<SysDept> GetSysDepts(SysDept dept);
|
||||
string CheckDeptNameUnique(SysDept dept);
|
||||
int InsertDept(SysDept dept);
|
||||
int UpdateDept(SysDept dept);
|
||||
void UpdateDeptChildren(long deptId, string newAncestors, string oldAncestors);
|
||||
List<SysDept> GetChildrenDepts(List<SysDept> depts, long deptId);
|
||||
List<SysDept> BuildDeptTree(List<SysDept> depts);
|
||||
List<TreeSelectVo> BuildDeptTreeSelect(List<SysDept> depts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace ZR.Service.System.IService
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface ISysDictService : IBaseService<SysDictType>
|
||||
public interface ISysDictService
|
||||
{
|
||||
public List<SysDictType> SelectDictTypeList(SysDictType dictType, Model.PagerInfo pager);
|
||||
|
||||
@@ -39,5 +39,12 @@ namespace ZR.Service.System.IService
|
||||
/// <param name="sysDictType"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateDictType(SysDictType sysDictType);
|
||||
|
||||
/// <summary>
|
||||
/// 获取字典信息
|
||||
/// </summary>
|
||||
/// <param name="dictId"></param>
|
||||
/// <returns></returns>
|
||||
SysDictType GetInfo(long dictId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ using ZR.Repository;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysPostService: IBaseRepository<SysPost>
|
||||
public interface ISysPostService : IBaseService<SysPost>
|
||||
{
|
||||
string CheckPostNameUnique(SysPost sysPost);
|
||||
string CheckPostCodeUnique(SysPost sysPost);
|
||||
|
||||
@@ -3,7 +3,7 @@ using ZR.Repository;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysTasksLogService: IBaseRepository<SysTasksLog>
|
||||
public interface ISysTasksLogService : IBaseService<SysTasksLog>
|
||||
{
|
||||
/// <summary>
|
||||
/// 记录任务执行日志
|
||||
|
||||
@@ -7,8 +7,8 @@ using ZR.Model.System;
|
||||
|
||||
namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysTasksQzService
|
||||
public interface ISysTasksQzService : IBaseService<SysTasksQz>
|
||||
{
|
||||
SysTasksQz GetId(object id);
|
||||
//SysTasksQz GetId(object id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace ZR.Service.System
|
||||
/// 部门管理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysDeptService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysDeptService :ISysDeptService
|
||||
public class SysDeptService : BaseService<SysDept>, ISysDeptService
|
||||
{
|
||||
public SysDeptRepository DeptRepository;
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace ZR.Service.System
|
||||
}
|
||||
|
||||
dept.Ancestors = info.Ancestors + "," + dept.ParentId;
|
||||
return DeptRepository.Insert(dept, true);
|
||||
return DeptRepository.Add(dept);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,8 +86,8 @@ namespace ZR.Service.System
|
||||
/// <returns></returns>
|
||||
public int UpdateDept(SysDept dept)
|
||||
{
|
||||
SysDept newParentDept = DeptRepository.GetSingle(it => it.ParentId == dept.ParentId);
|
||||
SysDept oldDept = DeptRepository.GetSingle(m => m.DeptId == dept.DeptId);
|
||||
SysDept newParentDept = DeptRepository.GetFirst(it => it.ParentId == dept.ParentId);
|
||||
SysDept oldDept = DeptRepository.GetFirst(m => m.DeptId == dept.DeptId);
|
||||
if (newParentDept != null && oldDept != null)
|
||||
{
|
||||
string newAncestors = newParentDept.Ancestors + "," + newParentDept.DeptId;
|
||||
@@ -129,12 +129,10 @@ namespace ZR.Service.System
|
||||
foreach (var child in children)
|
||||
{
|
||||
child.Ancestors = child.Ancestors.Replace(oldAncestors, newAncestors);
|
||||
|
||||
if (child.DeptId.Equals(deptId))
|
||||
{
|
||||
//TODO Saveable(child, it => new { it.Ancestors });
|
||||
//DeptRepository.UdateDeptChildren(child);
|
||||
}
|
||||
}
|
||||
if (children.Count > 0)
|
||||
{
|
||||
//DeptRepository.UdateDeptChildren(child);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ZR.Service.System
|
||||
public List<SysDictData> SelectDictDataByType(string dictType)
|
||||
{
|
||||
string CK = $"SelectDictDataByType_{dictType}";
|
||||
if (!(CacheHelper.GetCache(CK) is List<SysDictData> list))
|
||||
if (CacheHelper.GetCache(CK) is not List<SysDictData> list)
|
||||
{
|
||||
list = SysDictDataRepository.SelectDictDataByType(dictType);
|
||||
CacheHelper.SetCache(CK, list, 30);
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace ZR.Service.System
|
||||
/// 字典类型
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysDictService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysDictService : BaseService<SysDictType>, ISysDictService
|
||||
public class SysDictService : ISysDictService
|
||||
{
|
||||
private SysDictRepository DictRepository;
|
||||
private SysDictDataRepository DictDataRepository;
|
||||
@@ -79,7 +79,7 @@ namespace ZR.Service.System
|
||||
/// <returns></returns>
|
||||
public long InsertDictType(SysDictType sysDictType)
|
||||
{
|
||||
return DictRepository.InsertReturnEntity(sysDictType).DictId;
|
||||
return DictRepository.InsertReturnBigIdentity(sysDictType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -97,5 +97,15 @@ namespace ZR.Service.System
|
||||
}
|
||||
return DictRepository.UpdateDictType(sysDictType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字典信息
|
||||
/// </summary>
|
||||
/// <param name="dictId"></param>
|
||||
/// <returns></returns>
|
||||
public SysDictType GetInfo(long dictId)
|
||||
{
|
||||
return DictRepository.GetFirst(f => f.DictId == dictId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace ZR.Service.System
|
||||
/// 岗位管理
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(ISysPostService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysPostService : BaseRepository<SysPost>, ISysPostService
|
||||
public class SysPostService : BaseService<SysPost>, ISysPostService
|
||||
{
|
||||
public SysPostRepository PostRepository;
|
||||
public SysPostService(SysPostRepository postRepository)
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ZR.Service.System
|
||||
logModel.CreateTime = DateTime.Now;
|
||||
}
|
||||
|
||||
Insert(logModel, true);
|
||||
Add(logModel);
|
||||
return logModel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using ZR.Service.System.IService;
|
||||
namespace ZR.Service.System
|
||||
{
|
||||
[AppService(ServiceType = typeof(ISysTasksQzService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysTasksQzService : ISysTasksQzService
|
||||
public class SysTasksQzService : BaseService<SysTasksQz>, ISysTasksQzService
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user