优化数据仓储

This commit is contained in:
不做码农
2021-11-27 09:43:04 +08:00
parent 640776181a
commit 67e1343e24
57 changed files with 689 additions and 627 deletions

View File

@@ -13,8 +13,17 @@ namespace ZR.Repository.System
/// 文章管理
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class ArticleRepository
public class ArticleRepository : BaseRepository<Article>
{
}
/// <summary>
/// 文章目录
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class ArticleCategoryRepository : BaseRepository<ArticleCategory>
{
}
}

View File

@@ -1,4 +1,5 @@
using Infrastructure.Attribute;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;

View File

@@ -33,13 +33,13 @@ namespace ZR.Repository.System
/// <returns></returns>
public PagedInfo<SysRole> SelectRoleList(SysRole sysRole, PagerInfo pager)
{
return Context.Queryable<SysRole>()
.Where(role => role.DelFlag == "0")
.WhereIF(!string.IsNullOrEmpty(sysRole.RoleName), role => role.RoleName.Contains(sysRole.RoleName))
.WhereIF(!string.IsNullOrEmpty(sysRole.Status), role => role.Status == sysRole.Status)
.WhereIF(!string.IsNullOrEmpty(sysRole.RoleKey), role => role.RoleKey == sysRole.RoleKey)
.OrderBy(role => role.RoleSort)
.ToPage(pager);
var exp = Expressionable.Create<SysRole>();
exp.And(role => role.DelFlag == "0");
exp.AndIF(!string.IsNullOrEmpty(sysRole.RoleName), role => role.RoleName.Contains(sysRole.RoleName));
exp.AndIF(!string.IsNullOrEmpty(sysRole.Status), role => role.Status == sysRole.Status);
exp.AndIF(!string.IsNullOrEmpty(sysRole.RoleKey), role => role.RoleKey == sysRole.RoleKey);
return GetPages(exp.ToExpression(), pager, x => x.RoleSort);
}
/// <summary>

View File

@@ -0,0 +1,15 @@
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.System;
namespace ZR.Repository.System
{
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysTasksQzRepository: BaseRepository<SysTasksQz>
{
}
}