Browse Source

添加权限板块

wangh 2 years ago
parent
commit
d5a5356c4a

+ 20 - 0
OASystem/OASystem.Domain/Dtos/System/AuthDto.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.System
+{
+    public class AuthDto
+    {
+        /// <summary>
+        /// 显示的行数
+        /// </summary>
+        public int pageSize { get; set; }
+        /// <summary>
+        /// 当前页
+        /// </summary>
+        public int currentPage { get; set; }
+    }
+}

+ 22 - 0
OASystem/OASystem.Domain/ViewModels/System/SetDataView.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.System
+{
+    public class SetDataView
+    {
+        public int Id { get; set; }
+        /// <summary>
+        /// 分类名称
+        /// </summary>
+        public string Name { get; set; }
+        /// <summary>
+        /// setdatatype id
+        /// </summary>
+        public int STid { get; set; }
+
+    }
+}

+ 27 - 0
OASystem/OASystem.Domain/ViewModels/System/SystemMenuPermissionView.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.System
+{
+    public class SystemMenuPermissionView
+    {
+        public int Id { get; set; }
+        /// <summary>
+        /// 页面名称
+        /// </summary>
+        public string Name { get; set; }
+        /// <summary>
+        /// 页面code
+        /// </summary>
+        public string SystemMenuCode { get; set; }
+        
+        /// <summary>
+        /// 页面所属模块
+        /// </summary>
+        public int Mid { get; set; }
+
+    }
+}

+ 47 - 0
OASystem/OASystem.Infrastructure/Repositories/System/SetDataRepository.cs

@@ -0,0 +1,47 @@
+
+using OASystem.Domain;
+using OASystem.Domain.Dtos.UserDto;
+using OASystem.Domain.Entities.System;
+using OASystem.Domain.ViewModels.System;
+
+namespace OASystem.Infrastructure.Repositories.System
+{
+    public class SetDataRepository : BaseRepository<Sys_SetData, SetDataView>
+    {
+        public SetDataRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
+        {
+
+        }
+
+        /// <summary>
+        /// 获取所有系统模块
+        /// </summary>
+        /// <param name="_SetData"></param>
+        /// <returns></returns>
+        public async Task<Result> GetSySDefultModule(SetDataRepository _SetData)
+        {
+            Result result = new Result();
+            string sql = "select * from Sys_SetData where STid = 5 and isdel = 0";
+            var DBdata = await _SetData.GetListBySqlWithNolockAsync(sql);
+
+            if (DBdata == null || DBdata.Count == 0)
+            {
+                return result;
+            }
+
+            result.Data = DBdata.Select(x=> new SetDataView
+            {
+                 Name = x.Name,
+                 STid = x.STid,
+                 Id = x.Id,
+            });
+
+            result.Code = 0;
+            result.Msg = "成功!";
+
+            return result;
+        }
+
+
+    }
+}

+ 72 - 0
OASystem/OASystem.Infrastructure/Repositories/System/SystemMenuPermissionRepository.cs

@@ -0,0 +1,72 @@
+using OASystem.Domain;
+using OASystem.Domain.Entities.System;
+using OASystem.Domain.ViewModels.System;
+
+namespace OASystem.Infrastructure.Repositories.System
+{
+    public class SystemMenuPermissionRepository : BaseRepository<Sys_SystemMenuPermission, SystemMenuPermissionView>
+    {
+        public SystemMenuPermissionRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
+        {
+
+        }
+
+        /// <summary>
+        /// 分页查询页面表
+        /// </summary>
+        /// <param name="_SystemMenuPermissionRepository"></param>
+        /// <param name="mid">模块id</param>
+        /// <param name="pageSize">行数</param>
+        /// <param name="currentPage">页码</param>
+        /// <returns></returns>
+        public Result GetSystemMenuViweData(SystemMenuPermissionRepository _SystemMenuPermissionRepository,int mid,int pageSize,int currentPage)
+        {
+            Result result = new Result();
+            if (currentPage == 0 || pageSize == 0)
+            {
+                return result;
+            }
+
+            string sql = $@"select top {pageSize} * from (select row_number() 
+                        over(order by id asc) as rownumber,*    
+                        from Sys_SystemMenuPermission where mid = {mid} and isdel = 0 and IsEnable = 1 ) temp_row
+                        where rownumber> {(currentPage - 1) * pageSize};";
+
+            var DBdata = _SystemMenuPermissionRepository.GetListBySqlWithNolock(sql);
+
+            if (DBdata == null || DBdata.Count == 0)
+            {
+                result.Code = -1;
+                result.Msg = "暂无数据!";
+                result.Data = new
+                {
+                    DBdata,
+                    total = 0
+                };
+                return result;
+            }
+
+            var total = _SystemMenuPermissionRepository.Query<Sys_SystemMenuPermission>(x => x.Mid == mid).Count();
+
+            result.Code = 0;
+            result.Msg = "成功!";
+            result.Data = new
+            {
+                DBdata = DBdata.Select(x => new SystemMenuPermissionView
+                {
+                    Id = x.Id,
+                    Name = x.Name,
+                    Mid = mid,
+                    SystemMenuCode = x.SystemMenuCode
+                }),
+                total = total
+            };
+            return result;
+        }
+
+
+
+
+
+    }
+}