diff --git a/ZR.Repository/Business/GendemoRepository.cs b/ZR.Repository/Business/GendemoRepository.cs deleted file mode 100644 index 6d9548c..0000000 --- a/ZR.Repository/Business/GendemoRepository.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Infrastructure.Attribute; -using ZR.Repository.System; -using ZR.Model.Models; - -namespace ZR.Repository -{ - /// - /// 演示仓储 - /// - /// @author zz - /// @date 2022-03-31 - /// - [AppService(ServiceLifetime = LifeTime.Transient)] - public class GenDemoRepository : BaseRepository - { - #region 业务逻辑代码 - #endregion - } -} \ No newline at end of file diff --git a/ZR.Repository/System/SysMenuRepository.cs b/ZR.Repository/System/SysMenuRepository.cs deleted file mode 100644 index da2b763..0000000 --- a/ZR.Repository/System/SysMenuRepository.cs +++ /dev/null @@ -1,204 +0,0 @@ -using Infrastructure.Attribute; -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using ZR.Model.System.Dto; -using ZR.Model.System; - -namespace ZR.Repository.System -{ - /// - /// 系统菜单 - /// - [AppService(ServiceLifetime = LifeTime.Transient)] - public class SysMenuRepository : BaseRepository - { - /// - /// 获取所有菜单(菜单管理) - /// - /// - public List SelectTreeMenuList(MenuQueryDto menu) - { - int parentId = 0; - if (menu.ParentId != null) - { - parentId = (int)menu.ParentId; - } - var list = Queryable() - .WhereIF(!string.IsNullOrEmpty(menu.MenuName), it => it.MenuName.Contains(menu.MenuName)) - .WhereIF(!string.IsNullOrEmpty(menu.Visible), it => it.Visible == menu.Visible) - .WhereIF(!string.IsNullOrEmpty(menu.Status), it => it.Status == menu.Status) - .WhereIF(!string.IsNullOrEmpty(menu.MenuTypeIds), it => menu.MenuTypeIdArr.Contains(it.MenuType)) - .WhereIF(menu.ParentId != null, it => it.ParentId == menu.ParentId) - .OrderBy(it => new { it.ParentId, it.OrderNum }) - .ToTree(it => it.Children, it => it.ParentId, menu.ParentId); - - return list; - } - - /// - /// 根据用户查询系统菜单列表 - /// - /// - /// 用户角色集合 - /// - public List SelectTreeMenuListByRoles(MenuQueryDto menu, List roles) - { - var roleMenus = Context.Queryable() - .Where(r => roles.Contains(r.Role_id)) - .Select(f => f.Menu_id).Distinct().ToList(); - - return Queryable() - .Where(c => roleMenus.Contains(c.MenuId)) - .WhereIF(!string.IsNullOrEmpty(menu.MenuName), (c) => c.MenuName.Contains(menu.MenuName)) - .WhereIF(!string.IsNullOrEmpty(menu.Visible), (c) => c.Visible == menu.Visible) - .WhereIF(!string.IsNullOrEmpty(menu.Status), (c) => c.Status == menu.Status) - .WhereIF(!string.IsNullOrEmpty(menu.MenuTypeIds), c => menu.MenuTypeIdArr.Contains(c.MenuType)) - .OrderBy((c) => new { c.ParentId, c.OrderNum }) - .Select(c => c) - .ToTree(it => it.Children, it => it.ParentId, 0); - } - - /// - /// 获取所有菜单 - /// - /// - public List SelectMenuList(MenuQueryDto menu) - { - return Queryable() - .WhereIF(!string.IsNullOrEmpty(menu.MenuName), it => it.MenuName.Contains(menu.MenuName)) - .WhereIF(!string.IsNullOrEmpty(menu.Visible), it => it.Visible == menu.Visible) - .WhereIF(!string.IsNullOrEmpty(menu.Status), it => it.Status == menu.Status) - .WhereIF(menu.ParentId != null, it => it.ParentId == menu.ParentId) - .OrderBy(it => new { it.ParentId, it.OrderNum }) - .ToList(); - } - - /// - /// 根据用户查询系统菜单列表 - /// - /// - /// 用户角色集合 - /// - public List SelectMenuListByRoles(MenuQueryDto sysMenu, List roles) - { - var roleMenus = Context.Queryable() - .Where(r => roles.Contains(r.Role_id)); - - return Queryable() - .InnerJoin(roleMenus, (c, j) => c.MenuId == j.Menu_id) - .Where((c, j) => c.Status == "0") - .WhereIF(!string.IsNullOrEmpty(sysMenu.MenuName), (c, j) => c.MenuName.Contains(sysMenu.MenuName)) - .WhereIF(!string.IsNullOrEmpty(sysMenu.Visible), (c, j) => c.Visible == sysMenu.Visible) - .OrderBy((c, j) => new { c.ParentId, c.OrderNum }) - .Select(c => c) - .ToList(); - } - - /// - /// 获取菜单详情 - /// - /// - /// - public SysMenu SelectMenuById(int menuId) - { - return GetFirst(it => it.MenuId == menuId); - } - - /// - /// 添加菜单 - /// - /// - /// - public int AddMenu(SysMenu menu) - { - menu.Create_time = DateTime.Now; - menu.MenuId = InsertReturnIdentity(menu); - return 1; - } - - /// - /// 编辑菜单 - /// - /// - /// - public int EditMenu(SysMenu menu) - { - return Update(menu, false); - } - - /// - /// 删除菜单 - /// - /// - /// - public int DeleteMenuById(int menuId) - { - return Delete(menuId); - } - - /// - /// 菜单排序 - /// - /// 菜单Dto - /// - public int ChangeSortMenu(MenuDto menuDto) - { - var result = Context.Updateable(new SysMenu() { MenuId = menuDto.MenuId, OrderNum = menuDto.OrderNum }) - .UpdateColumns(it => new { it.OrderNum }).ExecuteCommand(); - return result; - } - - /// - /// 查询菜单权限 - /// - /// - /// - public List SelectMenuPermsByUserId(long userId) - { - return Context.Queryable((m, rm, ur, r) => new JoinQueryInfos( - JoinType.Left, m.MenuId == rm.Menu_id, - JoinType.Left, rm.Role_id == ur.RoleId, - JoinType.Left, ur.RoleId == r.RoleId - )) - //.Distinct() - .Where((m, rm, ur, r) => m.Status == "0" && r.Status == "0" && ur.UserId == userId) - .Select((m, rm, ur, r) => m).ToList(); - } - - /// - /// 校验菜单名称是否唯一 - /// - /// - /// - public SysMenu CheckMenuNameUnique(SysMenu menu) - { - return GetFirst(it => it.MenuName == menu.MenuName && it.ParentId == menu.ParentId); - } - - /// - /// 是否存在菜单子节点 - /// - /// - /// - public int HasChildByMenuId(long menuId) - { - return Count(it => it.ParentId == menuId); - } - - #region RoleMenu - - /// - /// 查询菜单使用数量 - /// - /// - /// - public int CheckMenuExistRole(long menuId) - { - return Context.Queryable().Where(it => it.Menu_id == menuId).Count(); - } - - #endregion - } -} diff --git a/ZR.Repository/System/SysNoticeRepository.cs b/ZR.Repository/System/SysNoticeRepository.cs deleted file mode 100644 index 01dd4f4..0000000 --- a/ZR.Repository/System/SysNoticeRepository.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using Infrastructure.Attribute; -using ZR.Repository.System; -using ZR.Model.Models; -using ZR.Model.System; - -namespace ZR.Repository.System -{ - /// - /// 通知公告表仓储 - /// - /// @author zr - /// @date 2021-12-15 - /// - [AppService(ServiceLifetime = LifeTime.Transient)] - public class SysNoticeRepository : BaseRepository - { - #region 业务逻辑代码 - #endregion - } -} \ No newline at end of file diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj index b12346e..be7e697 100644 --- a/ZR.Repository/ZR.Repository.csproj +++ b/ZR.Repository/ZR.Repository.csproj @@ -19,5 +19,6 @@ + diff --git a/ZR.Service/Business/GendemoService.cs b/ZR.Service/Business/GendemoService.cs index 91dd21d..d733707 100644 --- a/ZR.Service/Business/GendemoService.cs +++ b/ZR.Service/Business/GendemoService.cs @@ -20,12 +20,6 @@ namespace ZR.Service.Business [AppService(ServiceType = typeof(IGenDemoService), ServiceLifetime = LifeTime.Transient)] public class GenDemoService : BaseService, IGenDemoService { - private readonly GenDemoRepository _GenDemorepository; - public GenDemoService(GenDemoRepository repository) - { - _GenDemorepository = repository; - } - #region 业务逻辑代码 /// @@ -44,8 +38,7 @@ namespace ZR.Service.Business predicate = predicate.AndIF(parm.ShowStatus != null, it => it.ShowStatus == parm.ShowStatus); predicate = predicate.AndIF(parm.BeginAddTime == null, it => it.AddTime >= DateTime.Now.AddDays(-1)); predicate = predicate.AndIF(parm.BeginAddTime != null, it => it.AddTime >= parm.BeginAddTime && it.AddTime <= parm.EndAddTime); - var response = _GenDemorepository - .Queryable() + var response = Queryable() .Where(predicate.ToExpression()) .ToPage(parm); return response; diff --git a/ZR.Service/System/SysDeptService.cs b/ZR.Service/System/SysDeptService.cs index d45d84d..4993dbf 100644 --- a/ZR.Service/System/SysDeptService.cs +++ b/ZR.Service/System/SysDeptService.cs @@ -9,7 +9,6 @@ using System.Text; using ZR.Common; using ZR.Model.System; using ZR.Model.System.Vo; -using ZR.Repository.System; using ZR.Service.System.IService; namespace ZR.Service.System