zuoxiang 4 jaren geleden
bovenliggende
commit
22e78359f4
29 gewijzigde bestanden met toevoegingen van 995 en 46 verwijderingen
  1. 87 0
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminAttachController.cs
  2. 10 2
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSensitiveWordController.cs
  3. 5 3
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSlideController.cs
  4. 115 0
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSystemRoleController.cs
  5. 10 2
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs
  6. 4 7
      gx_api/GxPress/Api/GxPress.Api/AppControllers/SlideController.cs
  7. 6 0
      gx_api/GxPress/Model/GxPress.Entity/Menus/Menus.cs
  8. 14 8
      gx_api/GxPress/Model/GxPress.Entity/Slide.cs
  9. 2 8
      gx_api/GxPress/Model/GxPress.Entity/SystemRole/SystemRole.cs
  10. 24 0
      gx_api/GxPress/Model/GxPress.Entity/SystemRole/SystemRoleMenus.cs
  11. 119 0
      gx_api/GxPress/Model/GxPress.Entity/tede2/Attach/Attach.cs
  12. 14 2
      gx_api/GxPress/Model/GxPress.EnumConst/VipTypeConst.cs
  13. 38 0
      gx_api/GxPress/Model/GxPress.Request/Attach/AttachRequest.cs
  14. 37 0
      gx_api/GxPress/Model/GxPress.Request/Role/RoleRequest.cs
  15. 28 0
      gx_api/GxPress/Model/GxPress.Request/Slide/SlideRequest.cs
  16. 75 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Attach/AttachRepository.cs
  17. 27 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Menus/MenusRepository.cs
  18. 14 7
      gx_api/GxPress/Repository/GxPress.Repository.Implement/SlideRepository.cs
  19. 19 2
      gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemRole/SystemRoleRepository.cs
  20. 67 0
      gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemRoleMenus/SystemRoleMenusRepository.cs
  21. 20 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Attach/IAttachRepository.cs
  22. 3 1
      gx_api/GxPress/Repository/GxPress.Repository.Interface/ISlideRepository.cs
  23. 12 2
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Menus/IMenusRepository.cs
  24. 7 2
      gx_api/GxPress/Repository/GxPress.Repository.Interface/SystemRole/ISystemRoleRepository.cs
  25. 19 0
      gx_api/GxPress/Repository/GxPress.Repository.Interface/SystemRoleMenus/ISystemRoleMenusRepository.cs
  26. 31 0
      gx_api/GxPress/Service/GxPress.Service.Implement/Attach/AttachService.cs
  27. 111 0
      gx_api/GxPress/Service/GxPress.Service.Implement/Role/RoleService.cs
  28. 11 0
      gx_api/GxPress/Service/GxPress.Service.Interface/Attach/IAttachService.cs
  29. 66 0
      gx_api/GxPress/Service/GxPress.Service.Interface/Role/IRoleService.cs

+ 87 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminAttachController.cs

@@ -0,0 +1,87 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using GxPress.Auth;
+using GxPress.Common.Page;
+using GxPress.Repository.Interface.Attach;
+using GxPress.Request.Attach;
+using GxPress.Service.Interface.Attach;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace GxPress.Api.AdminControllers
+{
+    /// <summary>
+    /// 名栏 公众号 期刊
+    /// </summary>
+    [Route("/api/admin/attach")]
+    [ApiController]
+    [Authorize]
+    public class AdminAttachController : Controller
+    {
+        private readonly IAttachRepository repository;
+
+        private readonly IAttachService service;
+        private readonly ILoginContext _loginContext;
+        public AdminAttachController(IAttachRepository repository, ILoginContext _loginContext, IAttachService service)
+        {
+            this.repository = repository;
+            this._loginContext = _loginContext;
+            this.service = service;
+        }
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpDelete("{id}")]
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await repository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 获取所有
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost("list")]
+        public async Task<PagedList<Entity.tede2.Attach.Attach>> GetAllAsync(AttachRequest request)
+        {
+            return await repository.GetAllAsync(request);
+        }
+
+
+        /// <summary>
+        /// 获取详情
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [HttpGet("{id}")]
+        public async Task<Entity.tede2.Attach.Attach> GetAsync(int id)
+        {
+            return await repository.GetAsync(id);
+        }
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="note"></param>
+        /// <returns></returns>
+        [HttpPost]
+        public async Task<int> InsertAsync(Entity.tede2.Attach.Attach note)
+        {
+            note.AdminId = _loginContext.AccountId;
+            note.Creator = _loginContext.Name;
+            return await service.InsertAsync(note);
+        }
+        /// <summary>
+        /// 修改
+        /// </summary>
+        /// <param name="note"></param>
+        /// <returns></returns>
+        [HttpPut]
+        public async Task<bool> UpdateAsync(Entity.tede2.Attach.Attach note)
+        {
+            note.AdminId = _loginContext.AccountId;
+            note.Creator = _loginContext.Name;
+            return await service.UpdateAsync(note);
+        }
+    }
+}

+ 10 - 2
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSensitiveWordController.cs

@@ -1,4 +1,5 @@
 using System.Threading.Tasks;
+using GxPress.Auth;
 using GxPress.Common.Page;
 using GxPress.Repository.Interface.SensitiveWord;
 using GxPress.Request.SensitiveWord;
@@ -16,9 +17,12 @@ namespace GxPress.Api.AdminControllers
     public class AdminSensitiveWordController : Controller
     {
         private readonly ISensitiveWordRepository _repository;
-        public AdminSensitiveWordController(ISensitiveWordRepository _repository)
+        private readonly ILoginContext _loginContext;
+
+        public AdminSensitiveWordController(ISensitiveWordRepository _repository, ILoginContext _loginContext)
         {
             this._repository = _repository;
+            this._loginContext = _loginContext;
         }
         /// <summary>
         /// 查询详情
@@ -48,6 +52,8 @@ namespace GxPress.Api.AdminControllers
         [HttpPost]
         public async Task<int> InsertAsync(Entity.tede2.SensitiveWord.SensitiveWord note)
         {
+            note.AdminId = _loginContext.AccountId;
+            note.Creator = _loginContext.Name;
             return await _repository.InsertAsync(note);
         }
         /// <summary>
@@ -58,6 +64,8 @@ namespace GxPress.Api.AdminControllers
         [HttpPut]
         public async Task<bool> UpdateAsync(Entity.tede2.SensitiveWord.SensitiveWord note)
         {
+            note.AdminId = _loginContext.AccountId;
+            note.Creator = _loginContext.Name;
             return await _repository.UpdateAsync(note);
         }
         /// <summary>
@@ -68,7 +76,7 @@ namespace GxPress.Api.AdminControllers
         [HttpPost("list")]
         public async Task<PagedList<Entity.tede2.SensitiveWord.SensitiveWord>> GetAllAsync(SensitiveWordRequest request)
         {
-             return await _repository.GetAllAsync(request);
+            return await _repository.GetAllAsync(request);
         }
     }
 }

+ 5 - 3
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSlideController.cs

@@ -1,7 +1,9 @@
 using System.Collections.Generic;
 using System.Threading.Tasks;
+using GxPress.Common.Page;
 using GxPress.Entity;
 using GxPress.Repository.Interface;
+using GxPress.Request.Slide;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 
@@ -48,10 +50,10 @@ namespace GxPress.Api.AdminControllers
         /// 列表
         /// </summary>
         /// <returns></returns>
-        [HttpGet("")]
-        public async Task<IEnumerable<Slide>> GetList([FromQuery] Slide request)
+        [HttpPost]
+        public async Task<PagedList<Slide>> GetListAsync(SlideSearchRequest request)
         {
-            var pagedList = await _slideRepository.GetListAsync();
+            var pagedList = await _slideRepository.GetListAsync(request);
             return pagedList;
         }
 

+ 115 - 0
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminSystemRoleController.cs

@@ -0,0 +1,115 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using GxPress.Request.Role;
+using GxPress.Service.Interface.Role;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+
+namespace GxPress.Api.AdminControllers
+{
+    [Route("api/admin/system-role")]
+    [ApiController]
+    [Authorize]
+    public class AdminSystemRoleController : Controller
+    {
+        private readonly IRoleService roleService;
+        public AdminSystemRoleController(IRoleService roleService)
+        {
+            this.roleService = roleService;
+
+        }
+
+        /// <summary>
+        /// 添加权限菜单关联
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        [HttpPost("add-role-menus")]
+        public async Task<bool> InsertSystemRoleMenusAsync(SystemRoleMenusInRequest models)
+        {
+            return await roleService.InsertSystemRoleMenusAsync(models);
+        }
+
+        /// <summary>
+        /// 添加权限
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        [HttpPost("add-role")]
+        public async Task<bool> InsertSystemRoleAsync(Entity.SystemRole.SystemRole model)
+        {
+            return await roleService.InsertSystemRoleAsync(model);
+        }
+        /// <summary>
+        /// 修改权限
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+         [HttpPut("update-role")]
+        public async Task<bool> UpdateSystemRoleAsync(Entity.SystemRole.SystemRole model)
+        {
+            return await roleService.UpdateSystemRoleAsync(model);
+        }
+        /// <summary>
+        /// 删除权限
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+         [HttpDelete("role")]
+        public async Task<bool> DeleteSystemRoleAsync(int id)
+        {
+            return await roleService.DeleteSystemRoleAsync(id);
+        }
+        /// <summary>
+        /// 添加菜单
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+         [HttpPost("add-menu")]
+        public async Task<bool> InsertMenusAsync(Entity.Menus.Menus model)
+        {
+            return await roleService.InsertMenusAsync(model);
+        }
+        /// <summary>
+        /// 修改菜单
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+          [HttpPut("update-menu")]
+        public async Task<bool> UpdateMenusAsync(Entity.Menus.Menus model)
+        {
+            return await roleService.UpdateMenusAsync(model);
+        }
+        /// <summary>
+        /// 删除菜单
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+         [HttpDelete("delete-menu")]
+        public async Task<bool> DeleteMenusAsync(int id)
+        {
+            return await roleService.DeleteMenusAsync(id);
+        }
+        /// <summary>
+        /// 根据权限ID获取菜单
+        /// </summary>
+        /// <param name="roleId"></param>
+        /// <returns></returns>
+        [HttpGet("menus/{roid}")]
+        public async Task<IEnumerable<Entity.Menus.Menus>> GetMenusAllAsync(int roleId)
+        {
+            //获取
+            return await roleService.GetMenusAllAsync(roleId);
+        }
+
+        /// <summary>
+        /// 获取所有菜单
+        /// </summary>
+        /// <returns></returns>
+         [HttpGet("menus")]
+        public async Task<IEnumerable<Entity.Menus.Menus>> GetMenusAllAsync()
+        {
+            return await roleService.GetMenusAllAsync();
+        }
+    }
+}

File diff suppressed because it is too large
+ 10 - 2
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs


+ 4 - 7
gx_api/GxPress/Api/GxPress.Api/AppControllers/SlideController.cs

@@ -3,6 +3,7 @@ using System.Threading.Tasks;
 using GxPress.Common.Page;
 using GxPress.Entity;
 using GxPress.Repository.Interface;
+using GxPress.Request.Slide;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 
@@ -29,14 +30,10 @@ namespace GxPress.Api.AppControllers
         /// </summary>
         /// <returns></returns>
         [HttpGet("list")]
-        public async Task<PagedList<Slide>> GetList()
+        public async Task<PagedList<Slide>> GetList(SlideSearchRequest request)
         {
-            var pagedList =new PagedList<Slide>();
-            var result = await _slideRepository.GetListAsync();
-            var pagedListItems = result as Slide[] ?? result.ToArray();
-            pagedList.Items = pagedListItems;
-            pagedList.Total = pagedListItems.Count();
-            return pagedList;
+            var result = await _slideRepository.GetListAsync(request);
+            return result;
         }
 
 

+ 6 - 0
gx_api/GxPress/Model/GxPress.Entity/Menus/Menus.cs

@@ -26,5 +26,11 @@ namespace GxPress.Entity.Menus
         /// <value></value>
         [DataColumn]
         public int parentId { get; set; }
+        /// <summary>
+        /// 名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Name { get; set; }
     }
 }

+ 14 - 8
gx_api/GxPress/Model/GxPress.Entity/Slide.cs

@@ -12,31 +12,37 @@ namespace GxPress.Entity
         /// <summary>
         /// 标题
         /// </summary>
-        [DataColumn] 
+        [DataColumn]
         public string Title { get; set; }
 
         /// <summary>
         /// 标题图片
         /// </summary>
-        [DataColumn] 
+        [DataColumn]
         public string ImageUrl { get; set; }
 
         /// <summary>
-        /// 文章Id
+        /// 媒体ID
         /// </summary>
-        [DataColumn] 
-        public int ArticleId { get; set; }
-
+        [DataColumn]
+        public int MediaId { get; set; }
         /// <summary>
-        /// 文章标题
+        /// 是否启用
         /// </summary>
+        /// <value></value>
         [DataColumn]
-        public string ArticleTitle { get; set; }
+        public bool IsDisable { get; set; }
 
         /// <summary>
         /// 排序
         /// </summary>
         [DataColumn]
         public int Sort { get; set; }
+        /// <summary>
+        /// 1 APP 2 首页频道  3首页精选
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int TypeId { get; set; }
     }
 }

+ 2 - 8
gx_api/GxPress/Model/GxPress.Entity/SystemRole/SystemRole.cs

@@ -10,16 +10,10 @@ namespace GxPress.Entity.SystemRole
     public class SystemRole : Datory.Entity
     {
         /// <summary>
-        /// 管理人员ID
+        /// 名称
         /// </summary>
         /// <value></value>
         [DataColumn]
-        public int AdminId { get; set; }
-        /// <summary>
-        /// 菜单
-        /// </summary>
-        /// <value></value>
-        [DataColumn]
-        public int MenusId { get; set; }
+        public int Name { get; set; }
     }
 }

+ 24 - 0
gx_api/GxPress/Model/GxPress.Entity/SystemRole/SystemRoleMenus.cs

@@ -0,0 +1,24 @@
+using Datory.Annotations;
+
+namespace GxPress.Entity.SystemRole
+{
+    /// <summary>
+    /// 系统管理角色权限关联表
+    /// </summary>
+    [DataTable("tede_system_role_menus")]
+    public class SystemRoleMenus : Datory.Entity
+    {
+        /// <summary>
+        /// 权限ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int RoleId { get; set; }
+        /// <summary>
+        /// 菜单ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int MenuId { get; set; }
+    }
+}

+ 119 - 0
gx_api/GxPress/Model/GxPress.Entity/tede2/Attach/Attach.cs

@@ -0,0 +1,119 @@
+using System;
+using Datory.Annotations;
+using GxPress.EnumConst;
+
+namespace GxPress.Entity.tede2.Attach
+{
+    /// <summary>
+    /// 名栏 公众号 期刊
+    /// </summary>
+    [DataTable("tede_attach")]
+    public class Attach : Datory.Entity
+    {
+        /// <summary>
+        /// 名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Name { get; set; }
+        /// <summary>
+        /// 操作人
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Creator { get; set; }
+
+        /// <summary>
+        /// 操作人姓名
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int AdminId { get; set; }
+        /// <summary>
+        /// 简介
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Summary { get; set; }
+
+        /// <summary>
+        /// 分类ID
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int CategoryId { get; set; }
+
+        /// <summary>
+        /// 分类名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string CategoryName { get; set; }
+        /// <summary>
+        /// 资源数量
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int ResourceCount { get; set; }
+        /// <summary>
+        /// 收藏数量
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public int CollectCount { get; set; }
+        /// <summary>
+        /// 排序
+        /// </summary>
+        [DataColumn]
+        public int Sort { get; set; }
+
+        /// <summary>
+        /// 是否禁用
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsDisable { get; set; }
+        /// <summary>
+        /// 职位
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Job { get; set; }
+        /// <summary>
+        /// 是否推荐
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsRecommend { get; set; }
+
+        /// <summary>
+        /// 图片
+        /// </summary>
+        [DataColumn]
+        public string ImageUrl { get; set; }
+        /// <summary>
+        /// 是否下架
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public bool IsWithdraw { get; set; }
+        /// <summary>
+        /// 期刊名称
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string JournalName { get; set; }
+        /// <summary>
+        /// 期刊时间
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public DateTime JournalTime { get; set; }
+        /// <summary>
+        /// 类型 名栏 公众号 期刊
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public AttachTypeConst AttachType { get; set; }
+    }
+}

+ 14 - 2
gx_api/GxPress/Model/GxPress.EnumConst/VipTypeConst.cs

@@ -37,7 +37,7 @@ namespace GxPress.EnumConst
     /// </summary>
     public enum ResourceTypeConst
     {
-        Article=1,
+        Article = 1,
         //书籍
         Book = 2,
         //课程
@@ -47,7 +47,19 @@ namespace GxPress.EnumConst
         //期刊
         Journal = 5,
         //视频
-        Video=6
+        Video = 6
 
     }
+    /// <summary>
+    /// 名栏 公众号 期刊
+    /// </summary>
+    public enum AttachTypeConst
+    {
+        //名栏
+        StarColumn = 1,
+        //公众号
+        PublicNumber = 2,
+        //期刊
+        Journal = 3
+    }
 }

+ 38 - 0
gx_api/GxPress/Model/GxPress.Request/Attach/AttachRequest.cs

@@ -0,0 +1,38 @@
+using GxPress.Common.Page;
+
+namespace GxPress.Request.Attach
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public class AttachRequest : PageParameter
+    {
+        /// <summary>
+        /// 搜索
+        /// </summary>
+        /// <value></value>
+        public string KeyWord { get; set; }
+        /// <summary>
+        /// 类别ID
+        /// </summary>
+        /// <value></value>
+        public int CategoryId { get; set; }
+        /// <summary>
+        /// 操作人员ID
+        /// </summary>
+        /// <value></value>
+        public int AdminId { get; set; }
+        /// <summary>
+        ///  0 全部 1 上架 2 下架
+        /// </summary>
+        /// <value></value>
+        public int WithdrawType { get; set; }
+
+        /// <summary>
+        ///  1名栏 2公众号 3期刊
+        /// </summary>
+        /// <value></value>
+        public int TypeId { get; set; }
+
+    }
+}

+ 37 - 0
gx_api/GxPress/Model/GxPress.Request/Role/RoleRequest.cs

@@ -0,0 +1,37 @@
+using System.Collections.Generic;
+
+namespace GxPress.Request.Role
+{
+    public class RoleRequest
+    {
+
+    }
+    /// <summary>
+    /// 权限关联
+    /// </summary>
+    public class SystemRoleMenusInRequest
+    {
+        /// <summary>
+        /// 权限
+        /// </summary>
+        /// <value></value>
+        public int RoleId { get; set; }
+        /// <summary>
+        /// 菜单
+        /// </summary>
+        /// <value></value>
+        public List<SystemRoleMenuInRequest> SystemRoleMenuInRequest { get; set; }
+    }
+    /// <summary>
+    /// 菜单ID列表
+    /// </summary>
+    public class SystemRoleMenuInRequest
+    {
+
+        /// <summary>
+        /// 菜单ID
+        /// </summary>
+        /// <value></value>
+        public int MenuId { get; set; }
+    }
+}

+ 28 - 0
gx_api/GxPress/Model/GxPress.Request/Slide/SlideRequest.cs

@@ -0,0 +1,28 @@
+using GxPress.Common.Page;
+
+namespace GxPress.Request.Slide
+{
+    /// <summary>
+    /// 轮播
+    /// </summary>
+    public class SlideRequest
+    {
+
+    }
+    /// <summary>
+    /// 轮播查询
+    /// </summary>
+    public class SlideSearchRequest : PageParameter
+    {
+        /// <summary>
+        /// 搜索
+        /// </summary>
+        /// <value></value>
+        public string KeyWord { get; set; }
+        /// <summary>
+        /// 1 APP 2 首页频道  3首页精选 0全部
+        /// </summary>
+        /// <value></value>
+        public int TypeId { get; set; }
+    }
+}

+ 75 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Attach/AttachRepository.cs

@@ -0,0 +1,75 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using AutoMapper;
+using Datory;
+using GxPress.Common.AppOptions;
+using GxPress.Common.Page;
+using GxPress.Common.Tools;
+using GxPress.Repository.Interface.Attach;
+using GxPress.Request.Attach;
+using Microsoft.Extensions.Options;
+
+namespace GxPress.Repository.Implement.Attach
+{
+    public class AttachRepository : IAttachRepository
+    {
+        private readonly Repository<Entity.tede2.Attach.Attach> _repository;
+        private readonly IMapper _mapper;
+        private readonly string _connectionString;
+        private readonly string _databaseTypestr;
+        public AttachRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        {
+            _databaseTypestr = dbOptionsAccessor.CurrentValue.DatabaseType;
+            _connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
+            var databaseType =
+                StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
+            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
+            _repository = new Repository<Entity.tede2.Attach.Attach>(database);
+            _mapper = mapper;
+        }
+
+        public IDatabase Database => _repository.Database;
+        public string TableName => _repository.TableName;
+        public List<TableColumn> TableColumns => _repository.TableColumns;
+
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
+
+        public async Task<PagedList<Entity.tede2.Attach.Attach>> GetAllAsync(AttachRequest request)
+        {
+            var result = new PagedList<Entity.tede2.Attach.Attach>();
+            var query = Q.NewQuery();
+            query.Where(nameof(Entity.tede2.Attach.Attach.AttachType), request.TypeId);
+            if (!string.IsNullOrEmpty(request.KeyWord))
+                query.WhereLike(nameof(Entity.tede2.Attach.Attach.Name), $"%{request.KeyWord}%");
+            if (request.CategoryId > 0)
+                query.Where(nameof(Entity.tede2.Attach.Attach.CategoryId), request.CategoryId);
+            if (request.AdminId > 0)
+                query.Where(nameof(Entity.tede2.Attach.Attach.CategoryId), request.AdminId);
+            if (request.WithdrawType > 0)
+                query.Where(nameof(Entity.tede2.Attach.Attach.IsWithdraw), request.WithdrawType == 2);
+            result.Items = await _repository.GetAllAsync(query.ForPage(request.Page, request.PerPage));
+            result.Total = await _repository.CountAsync(query);
+            return result;
+        }
+
+        public async Task<Entity.tede2.Attach.Attach> GetAsync(int id)
+        {
+            return await _repository.GetAsync(id);
+        }
+
+        public async Task<int> InsertAsync(Entity.tede2.Attach.Attach note)
+        {
+
+            return await _repository.InsertAsync(note);
+        }
+
+        public async Task<bool> UpdateAsync(Entity.tede2.Attach.Attach note)
+        {
+            return await _repository.UpdateAsync(note);
+        }
+
+    }
+}

+ 27 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/Menus/MenusRepository.cs

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Threading.Tasks;
 using AutoMapper;
 using Datory;
 using GxPress.Common.AppOptions;
@@ -24,5 +25,31 @@ namespace GxPress.Repository.Implement.Menus
         public IDatabase Database => _repository.Database;
         public string TableName => _repository.TableName;
         public List<TableColumn> TableColumns => _repository.TableColumns;
+
+        public async Task<int> InsertAsync(Entity.Menus.Menus model)
+        {
+            return await _repository.InsertAsync(model);
+
+        }
+
+        public async Task<bool> UpdateAsync(Entity.Menus.Menus model)
+        {
+            return await _repository.UpdateAsync(model);
+        }
+
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
+
+        public async Task<IEnumerable<Entity.Menus.Menus>> GetAllAsync()
+        {
+            return await _repository.GetAllAsync();
+        }
+
+         public async Task<IEnumerable<Entity.Menus.Menus>> GetAllAsync(List<int> menusIds)
+        {
+            return await _repository.GetAllAsync(Q.WhereIn(nameof(Entity.Menus.Menus.Id),menusIds));
+        }
     }
 }

+ 14 - 7
gx_api/GxPress/Repository/GxPress.Repository.Implement/SlideRepository.cs

@@ -8,6 +8,8 @@ using GxPress.Entity;
 using GxPress.Repository.Interface;
 using Microsoft.Extensions.Options;
 using Datory;
+using GxPress.Request.Slide;
+using GxPress.Common.Page;
 
 namespace GxPress.Repository.Implement
 {
@@ -40,15 +42,20 @@ namespace GxPress.Repository.Implement
             return slide;
         }
 
-        public async Task<IEnumerable<Slide>> GetListAsync()
+        public async Task<PagedList<Slide>> GetListAsync(SlideSearchRequest request)
         {
-            var slides= await _repository.GetAllAsync(Q.OrderBy(nameof(Slide.Sort)));
-            var slideList = slides.ToList();
-            foreach (var slide in slideList)
-            {
+            var result = new PagedList<Slide>();
+            var query = Q.NewQuery();
+            if (!string.IsNullOrEmpty(request.KeyWord))
+                query.WhereLike(nameof(Slide.Title), $"%{request.KeyWord}%");
+            if (request.TypeId > 0)
+                query.Where(nameof(Slide.TypeId), request.TypeId);
+            result.Total = await _repository.CountAsync(query);
+            var slides = await _repository.GetAllAsync(query.OrderBy(nameof(Slide.Sort)).ForPage(request.Page, request.PerPage));
+            foreach (var slide in slides)
                 slide.ImageUrl = StringUtils.AddDomain(slide.ImageUrl);
-            }
-            return slideList;
+            result.Items = slides;
+            return result;
         }
 
         /// <summary>

+ 19 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemRole/SystemRoleRepository.cs

@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using System.Threading.Tasks;
 using AutoMapper;
 using Datory;
 using GxPress.Common.AppOptions;
@@ -8,9 +9,9 @@ using Microsoft.Extensions.Options;
 
 namespace GxPress.Repository.Implement.SystemRole
 {
-    public class SystemRoleRepository: ISystemRoleRepository
+    public class SystemRoleRepository : ISystemRoleRepository
     {
-         private readonly Repository<Entity.SystemRole.SystemRole> _repository;
+        private readonly Repository<Entity.SystemRole.SystemRole> _repository;
         private readonly IMapper _mapper;
 
         public SystemRoleRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
@@ -24,5 +25,21 @@ namespace GxPress.Repository.Implement.SystemRole
         public IDatabase Database => _repository.Database;
         public string TableName => _repository.TableName;
         public List<TableColumn> TableColumns => _repository.TableColumns;
+
+        public async Task<int> InsertAsync(Entity.SystemRole.SystemRole model)
+        {
+            return await _repository.InsertAsync(model);
+
+        }
+
+        public async Task<bool> UpdateAsync(Entity.SystemRole.SystemRole model)
+        {
+            return await _repository.UpdateAsync(model);
+        }
+
+        public async Task<bool> DeleteAsync(int id)
+        {
+            return await _repository.DeleteAsync(id);
+        }
     }
 }

+ 67 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/SystemRoleMenus/SystemRoleMenusRepository.cs

@@ -0,0 +1,67 @@
+using System.Collections.Generic;
+using AutoMapper;
+using Datory;
+using GxPress.Common.AppOptions;
+using GxPress.Common.Tools;
+using GxPress.Repository.Interface.SystemRoleMenus;
+using Microsoft.Extensions.Options;
+using System.Transactions;
+using System.Threading.Tasks;
+using GxPress.Request.Role;
+
+namespace GxPress.Repository.Implement.SystemRoleMenus
+{
+    public class SystemRoleMenusRepository : ISystemRoleMenusRepository
+    {
+        private readonly Repository<Entity.SystemRole.SystemRoleMenus> _repository;
+        private readonly IMapper _mapper;
+
+        public SystemRoleMenusRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        {
+            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
+            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
+            _repository = new Repository<Entity.SystemRole.SystemRoleMenus>(database);
+            _mapper = mapper;
+        }
+
+        public IDatabase Database => _repository.Database;
+        public string TableName => _repository.TableName;
+        public List<TableColumn> TableColumns => _repository.TableColumns;
+
+        public async Task<IEnumerable<Entity.SystemRole.SystemRoleMenus>> GetAllAsync(int roleId)
+        {
+            return await _repository.GetAllAsync(Q.Where(nameof(Entity.SystemRole.SystemRoleMenus.RoleId), roleId));
+        }
+
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        public async Task<bool> InsertAsync(SystemRoleMenusInRequest models)
+        {
+            try
+            {
+                using (var transactionScope = new TransactionScope())
+                {
+                    //删除
+                    await _repository.DeleteAsync(Q.Where(nameof(Entity.SystemRole.SystemRoleMenus.RoleId), models.RoleId));
+                    foreach (var item in models.SystemRoleMenuInRequest)
+                    {
+                        var model = new Entity.SystemRole.SystemRoleMenus();
+                        model.RoleId = models.RoleId;
+                        model.MenuId = item.MenuId;
+                        await _repository.InsertAsync(model);
+                    }
+                    transactionScope.Complete();
+                }
+            }
+            catch (System.Exception ex)
+            {
+                throw new Common.Exceptions.BusinessException(ex.Message);
+            }
+            return true;
+
+        }
+    }
+}

+ 20 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/Attach/IAttachRepository.cs

@@ -0,0 +1,20 @@
+using System.Threading.Tasks;
+using Datory;
+using GxPress.Common.Page;
+using GxPress.Request.Attach;
+
+namespace GxPress.Repository.Interface.Attach
+{
+    public interface IAttachRepository : IRepository
+    {
+        Task<bool> DeleteAsync(int id);
+
+        Task<PagedList<Entity.tede2.Attach.Attach>> GetAllAsync(AttachRequest request);
+
+        Task<Entity.tede2.Attach.Attach> GetAsync(int id);
+
+        Task<int> InsertAsync(Entity.tede2.Attach.Attach note);
+
+        Task<bool> UpdateAsync(Entity.tede2.Attach.Attach note);
+    }
+}

+ 3 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/ISlideRepository.cs

@@ -2,6 +2,8 @@ using System.Collections.Generic;
 using System.Threading.Tasks;
 using GxPress.Entity;
 using Datory;
+using GxPress.Request.Slide;
+using GxPress.Common.Page;
 
 namespace GxPress.Repository.Interface
 {
@@ -9,7 +11,7 @@ namespace GxPress.Repository.Interface
     {
         Task<bool> ExistsAsync(int id);
 
-        Task<IEnumerable<Slide>> GetListAsync();
+        Task<PagedList<Slide>> GetListAsync(SlideSearchRequest request);
 
         Task<Slide> GetAsync(int id);
 

+ 12 - 2
gx_api/GxPress/Repository/GxPress.Repository.Interface/Menus/IMenusRepository.cs

@@ -1,9 +1,19 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
 using Datory;
 
 namespace GxPress.Repository.Interface.Menus
 {
-    public interface IMenusRepository: IRepository
+    public interface IMenusRepository : IRepository
     {
-         
+        Task<int> InsertAsync(Entity.Menus.Menus model);
+
+        Task<bool> UpdateAsync(Entity.Menus.Menus model);
+
+        Task<bool> DeleteAsync(int id);
+
+          Task<IEnumerable<Entity.Menus.Menus>> GetAllAsync();
+
+          Task<IEnumerable<Entity.Menus.Menus>> GetAllAsync(List<int> menusIds);
     }
 }

+ 7 - 2
gx_api/GxPress/Repository/GxPress.Repository.Interface/SystemRole/ISystemRoleRepository.cs

@@ -1,9 +1,14 @@
+using System.Threading.Tasks;
 using Datory;
 
 namespace GxPress.Repository.Interface.SystemRole
 {
-    public interface ISystemRoleRepository: IRepository
+    public interface ISystemRoleRepository : IRepository
     {
-         
+        Task<int> InsertAsync(Entity.SystemRole.SystemRole model);
+
+        Task<bool> UpdateAsync(Entity.SystemRole.SystemRole model);
+
+        Task<bool> DeleteAsync(int id);
     }
 }

+ 19 - 0
gx_api/GxPress/Repository/GxPress.Repository.Interface/SystemRoleMenus/ISystemRoleMenusRepository.cs

@@ -0,0 +1,19 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Datory;
+using GxPress.Request.Role;
+
+namespace GxPress.Repository.Interface.SystemRoleMenus
+{
+    public interface ISystemRoleMenusRepository : IRepository
+    {
+        /// <summary>
+        /// 添加
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        Task<bool> InsertAsync(SystemRoleMenusInRequest models);
+
+        Task<IEnumerable<Entity.SystemRole.SystemRoleMenus>> GetAllAsync(int roleId);
+    }
+}

+ 31 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/Attach/AttachService.cs

@@ -0,0 +1,31 @@
+using System.Threading.Tasks;
+using GxPress.Repository.Interface.Attach;
+using GxPress.Repository.Interface.Category;
+using GxPress.Service.Interface.Attach;
+
+namespace GxPress.Service.Implement.Attach
+{
+    public class AttachService : IAttachService
+    {
+        private readonly ICategoryRepository categoryRepository;
+        private readonly IAttachRepository attachRepository;
+
+        public AttachService(ICategoryRepository categoryRepository, IAttachRepository attachRepository)
+        {
+            this.categoryRepository = categoryRepository;
+            this.attachRepository = attachRepository;
+        }
+
+        public async Task<int> InsertAsync(Entity.tede2.Attach.Attach note)
+        {
+            note.CategoryName = await categoryRepository.GetCategoryParentAsync(note.CategoryId, note.CategoryName);
+            return await attachRepository.InsertAsync(note);
+        }
+
+        public async Task<bool> UpdateAsync(Entity.tede2.Attach.Attach note)
+        {
+            note.CategoryName = await categoryRepository.GetCategoryParentAsync(note.CategoryId, note.CategoryName);
+            return await attachRepository.UpdateAsync(note);
+        }
+    }
+}

+ 111 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/Role/RoleService.cs

@@ -0,0 +1,111 @@
+using GxPress.Repository.Interface.SystemRoleMenus;
+using GxPress.Service.Interface.Role;
+using GxPress.Repository.Interface.SystemRole;
+using GxPress.Repository.Interface.Menus;
+using System.Threading.Tasks;
+using GxPress.Request.Role;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace GxPress.Service.Implement.Role
+{
+    public class RoleService : IRoleService
+    {
+        private readonly ISystemRoleMenusRepository systemRoleMenusRepository;
+        private readonly IMenusRepository menusRepository;
+
+        private readonly ISystemRoleRepository systemRoleRepository;
+        public RoleService(ISystemRoleMenusRepository systemRoleMenusRepository, IMenusRepository menusRepository, ISystemRoleRepository systemRoleRepository)
+        {
+            this.systemRoleRepository = systemRoleRepository;
+            this.systemRoleMenusRepository = systemRoleMenusRepository;
+            this.menusRepository = menusRepository;
+        }
+        /// <summary>
+        /// 添加权限菜单关联
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        public async Task<bool> InsertSystemRoleMenusAsync(SystemRoleMenusInRequest models)
+        {
+            return await systemRoleMenusRepository.InsertAsync(models);
+        }
+
+        /// <summary>
+        /// 添加权限
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        public async Task<bool> InsertSystemRoleAsync(Entity.SystemRole.SystemRole model)
+        {
+            return await systemRoleRepository.InsertAsync(model) > 0;
+        }
+        /// <summary>
+        /// 修改权限
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public async Task<bool> UpdateSystemRoleAsync(Entity.SystemRole.SystemRole model)
+        {
+            return await systemRoleRepository.UpdateAsync(model);
+        }
+        /// <summary>
+        /// 删除权限
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteSystemRoleAsync(int id)
+        {
+            return await systemRoleRepository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 添加菜单
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        public async Task<bool> InsertMenusAsync(Entity.Menus.Menus model)
+        {
+            return await menusRepository.InsertAsync(model) > 0;
+        }
+        /// <summary>
+        /// 修改菜单
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        public async Task<bool> UpdateMenusAsync(Entity.Menus.Menus model)
+        {
+            return await menusRepository.UpdateAsync(model);
+        }
+        /// <summary>
+        /// 删除菜单
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteMenusAsync(int id)
+        {
+            return await menusRepository.DeleteAsync(id);
+        }
+        /// <summary>
+        /// 根据权限ID获取菜单
+        /// </summary>
+        /// <param name="roleId"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<Entity.Menus.Menus>> GetMenusAllAsync(int roleId)
+        {
+            //获取
+            var models = await systemRoleMenusRepository.GetAllAsync(roleId);
+
+            return await menusRepository.GetAllAsync(models.Select(n => n.Id).ToList());
+        }
+
+        /// <summary>
+        /// 获取所有菜单
+        /// </summary>
+        /// <param name="roleId"></param>
+        /// <returns></returns>
+        public async Task<IEnumerable<Entity.Menus.Menus>> GetMenusAllAsync()
+        {
+            return await menusRepository.GetAllAsync();
+        }
+    }
+}

+ 11 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/Attach/IAttachService.cs

@@ -0,0 +1,11 @@
+using System.Threading.Tasks;
+
+namespace GxPress.Service.Interface.Attach
+{
+    public interface IAttachService : IService
+    {
+        Task<int> InsertAsync(Entity.tede2.Attach.Attach note);
+
+        Task<bool> UpdateAsync(Entity.tede2.Attach.Attach note);
+    }
+}

+ 66 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/Role/IRoleService.cs

@@ -0,0 +1,66 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using GxPress.Request.Role;
+
+namespace GxPress.Service.Interface.Role
+{
+    public interface IRoleService : IService
+    {
+        /// <summary>
+        /// 添加权限菜单关联
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        Task<bool> InsertSystemRoleMenusAsync(SystemRoleMenusInRequest models);
+
+        /// <summary>
+        /// 添加权限
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        Task<bool> InsertSystemRoleAsync(Entity.SystemRole.SystemRole model);
+        /// <summary>
+        /// 修改权限
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        Task<bool> UpdateSystemRoleAsync(Entity.SystemRole.SystemRole model);
+        /// <summary>
+        /// 删除权限
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<bool> DeleteSystemRoleAsync(int id);
+        /// <summary>
+        /// 添加菜单
+        /// </summary>
+        /// <param name="models"></param>
+        /// <returns></returns>
+        Task<bool> InsertMenusAsync(Entity.Menus.Menus model);
+        /// <summary>
+        /// 修改菜单
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        Task<bool> UpdateMenusAsync(Entity.Menus.Menus model);
+        /// <summary>
+        /// 删除菜单
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        Task<bool> DeleteMenusAsync(int id);
+        /// <summary>
+        /// 根据权限ID获取菜单
+        /// </summary>
+        /// <param name="roleId"></param>
+        /// <returns></returns>
+        Task<IEnumerable<Entity.Menus.Menus>> GetMenusAllAsync(int roleId);
+
+        /// <summary>
+        /// 获取所有菜单
+        /// </summary>
+        /// <param name="roleId"></param>
+        /// <returns></returns>
+        Task<IEnumerable<Entity.Menus.Menus>> GetMenusAllAsync();
+    }
+}