From 395a0350d69cb864d13380b4da479a0277435219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Thu, 14 Oct 2021 13:15:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=A4=8D=E6=9D=82=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/MenuController.cs | 13 +- .../Controllers/MouldController.cs | 2 +- .../Controllers/RoleController.cs | 15 +- .../Controllers/UserController.cs | 11 ++ .../SwaggerDoc.xml | 97 ++++++++++++ Yi.Framework/Yi.Framework.DTOModel/Class1.cs | 8 - Yi.Framework/Yi.Framework.DTOModel/IdsDto.cs | 23 +++ Yi.Vue/src/components/Table.vue | 112 +++++++------ Yi.Vue/src/layouts/default/Drawer.vue | 2 +- Yi.Vue/src/main.js | 8 +- Yi.Vue/src/router/index.js | 1 + Yi.Vue/src/views/AdmMenu.vue | 2 + Yi.Vue/src/views/AdmRole.vue | 5 +- Yi.Vue/src/views/AdmRoleMenu.vue | 148 ++++++++++++++++++ Yi.Vue/src/views/AdmUser.vue | 3 +- Yi.Vue/src/views/Index.vue | 2 +- 16 files changed, 390 insertions(+), 62 deletions(-) delete mode 100644 Yi.Framework/Yi.Framework.DTOModel/Class1.cs create mode 100644 Yi.Framework/Yi.Framework.DTOModel/IdsDto.cs create mode 100644 Yi.Vue/src/views/AdmRoleMenu.vue diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs index bd7a3695..ac119d6a 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MenuController.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Yi.Framework.Common.Models; +using Yi.Framework.DTOModel; using Yi.Framework.Interface; using Yi.Framework.Model.Models; namespace Yi.Framework.ApiMicroservice.Controllers { - [Route("api/[controller]")] + [Route("api/[controller]/[action]")] [ApiController] public class MenuController : ControllerBase { @@ -61,5 +62,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers await _menuService.AddAsync(_menu); return Result.Success(); } + + /// + /// 给一个菜单设置一个接口,Id1为菜单id,Id2为接口id + /// + /// + /// + [HttpPost] + public async Task SetMouldByMenu(IdDto idDto) + { + } } } diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs index 57b9af6f..8b64de62 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/MouldController.cs @@ -10,7 +10,7 @@ using Yi.Framework.Model.Models; namespace Yi.Framework.ApiMicroservice.Controllers { - [Route("api/[controller]")] + [Route("api/[controller]/[action]")] [ApiController] public class MouldController : ControllerBase { diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs index 94571487..0858911a 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/RoleController.cs @@ -5,12 +5,13 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Yi.Framework.Common.Models; +using Yi.Framework.DTOModel; using Yi.Framework.Interface; using Yi.Framework.Model.Models; namespace Yi.Framework.ApiMicroservice.Controllers { - [Route("api/[controller]")] + [Route("api/[controller]/[action]")] [ApiController] public class RoleController : ControllerBase { @@ -20,7 +21,7 @@ namespace Yi.Framework.ApiMicroservice.Controllers _roleService = roleService; } [HttpGet] - public async Task GetURole() + public async Task GetRole() { return Result.Success().SetData(await _roleService.GetAllEntitiesTrueAsync()); } @@ -61,5 +62,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers await _roleService.AddAsync(_role); return Result.Success(); } + + /// + /// 给角色设置菜单,多个角色与多个菜单,让每一个角色都设置,ids1为角色,ids2为菜单 + /// + /// + /// + [HttpPost] + public async Task SetMenuByRole(IdsListDto idsListDto) + { + } } } diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs index 3472ddd1..22930893 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/Controllers/UserController.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Yi.Framework.Common.Models; +using Yi.Framework.DTOModel; using Yi.Framework.Interface; using Yi.Framework.Model.Models; using Yi.Framework.WebCore; @@ -82,5 +83,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers var menu_data = await _userService.GetMenusByUser(_user); return Result.Success().SetData(menu_data); } + + /// + /// 给单个用户设置多个角色,ids有用户id与 角列表色ids,1对多 + /// + /// + /// + [HttpPost] + public async Task SetRoleByUser(IdsDto idsDto) + { + } } } diff --git a/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml b/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml index b5d09261..c81b652a 100644 --- a/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml +++ b/Yi.Framework/Yi.Framework.ApiMicroservice/SwaggerDoc.xml @@ -4,6 +4,97 @@ Yi.Framework.ApiMicroservice + + + 登录方法,要返回data:{user,token} token先写123456789,不要有导航属性 + + + + + + + 不用写,单纯制作日志 + + + + + + code为验证码,判断一下,假装验证码都是对的 + + + + + + + + 传入邮箱,需要先到数据库判断该邮箱是否被人注册过,到userservice写mail_exist方法,还有接口别忘了。这个接口不需要洞,只需要完成userservice写mail_exist与接口即可 + + + + + + + 更 + + + + + + + 删 + + + + + + + 增 + + + + + + + 更 + + + + + + + 删 + + + + + + + 增 + + + + + + + 更 + + + + + + + 删 + + + + + + + 增 + + + + 查 @@ -31,6 +122,12 @@ + + + 通过上下文对象获取user(注意,_user下只有userId),返回值为该用户下所有的menu,(注意子类递归)并且需要关联mould + + + 必须实现IHostingStartup接口 diff --git a/Yi.Framework/Yi.Framework.DTOModel/Class1.cs b/Yi.Framework/Yi.Framework.DTOModel/Class1.cs deleted file mode 100644 index e25dec52..00000000 --- a/Yi.Framework/Yi.Framework.DTOModel/Class1.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Yi.Framework.DTOModel -{ - public class Class1 - { - } -} diff --git a/Yi.Framework/Yi.Framework.DTOModel/IdsDto.cs b/Yi.Framework/Yi.Framework.DTOModel/IdsDto.cs new file mode 100644 index 00000000..94a2ab1d --- /dev/null +++ b/Yi.Framework/Yi.Framework.DTOModel/IdsDto.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; + +namespace Yi.Framework.DTOModel +{ + public class IdDto + { + public T id1 { get; set; } + public T id2 { get; set; } + } + + public class IdsDto + { + public T id{ get; set; } + public List ids { get; set; } + } + + public class IdsListDto + { + public List ids1 { get; set; } + public List ids2 { get; set; } + } +} diff --git a/Yi.Vue/src/components/Table.vue b/Yi.Vue/src/components/Table.vue index 6f9f1942..e31d4f1a 100644 --- a/Yi.Vue/src/components/Table.vue +++ b/Yi.Vue/src/components/Table.vue @@ -10,6 +10,7 @@ v-model="selected" :search="search" > + @@ -100,9 +111,9 @@ \ No newline at end of file diff --git a/Yi.Vue/src/views/AdmUser.vue b/Yi.Vue/src/views/AdmUser.vue index ac8f9424..e71de9d2 100644 --- a/Yi.Vue/src/views/AdmUser.vue +++ b/Yi.Vue/src/views/AdmUser.vue @@ -1,7 +1,6 @@