控制器添加复杂接口

This commit is contained in:
橙子
2021-10-14 13:15:00 +08:00
parent 93b8434857
commit 395a0350d6
16 changed files with 390 additions and 62 deletions

View File

@@ -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();
}
/// <summary>
/// 给一个菜单设置一个接口,Id1为菜单id,Id2为接口id
/// </summary>
/// <param name="idDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> SetMouldByMenu(IdDto<int> idDto)
{
}
}
}

View File

@@ -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
{

View File

@@ -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<Result> GetURole()
public async Task<Result> GetRole()
{
return Result.Success().SetData(await _roleService.GetAllEntitiesTrueAsync());
}
@@ -61,5 +62,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers
await _roleService.AddAsync(_role);
return Result.Success();
}
/// <summary>
/// 给角色设置菜单多个角色与多个菜单让每一个角色都设置ids1为角色ids2为菜单
/// </summary>
/// <param name="idsListDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> SetMenuByRole(IdsListDto<int> idsListDto)
{
}
}
}

View File

@@ -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);
}
/// <summary>
/// 给单个用户设置多个角色ids有用户id与 角列表色ids1对多
/// </summary>
/// <param name="idsDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<Result> SetRoleByUser(IdsDto<int> idsDto)
{
}
}
}

View File

@@ -4,6 +4,97 @@
<name>Yi.Framework.ApiMicroservice</name>
</assembly>
<members>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Login(Yi.Framework.Model.Models.user)">
<summary>
登录方法要返回data:{user,token} token先写123456789,不要有导航属性
</summary>
<param name="_user"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Logout">
<summary>
不用写,单纯制作日志
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Register(Yi.Framework.Model.Models.user,System.String)">
<summary>
code为验证码,判断一下,假装验证码都是对的
</summary>
<param name="_user"></param>
<param name="code"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.AccountController.Email(System.String)">
<summary>
传入邮箱需要先到数据库判断该邮箱是否被人注册过到userservice写mail_exist方法还有接口别忘了。这个接口不需要洞只需要完成userservice写mail_exist与接口即可
</summary>
<param name="emailAddress"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.UpdateMenu(Yi.Framework.Model.Models.menu)">
<summary>
</summary>
<param name="_menu"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.DelListMenu(System.Collections.Generic.List{System.Int32})">
<summary>
</summary>
<param name="_ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MenuController.AddMenu(Yi.Framework.Model.Models.menu)">
<summary>
</summary>
<param name="_menu"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MouldController.UpdateMould(Yi.Framework.Model.Models.mould)">
<summary>
</summary>
<param name="_mould"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MouldController.DelListMould(System.Collections.Generic.List{System.Int32})">
<summary>
</summary>
<param name="_ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.MouldController.AddMould(Yi.Framework.Model.Models.mould)">
<summary>
</summary>
<param name="_mould"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.UpdateRole(Yi.Framework.Model.Models.role)">
<summary>
</summary>
<param name="_role"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.DelListRole(System.Collections.Generic.List{System.Int32})">
<summary>
</summary>
<param name="_ids"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.RoleController.AddRole(Yi.Framework.Model.Models.role)">
<summary>
</summary>
<param name="_role"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetUser">
<summary>
@@ -31,6 +122,12 @@
<param name="_user"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.ApiMicroservice.Controllers.UserController.GetMenuMould">
<summary>
通过上下文对象获取user注意_user下只有userId返回值为该用户下所有的menu(注意子类递归)并且需要关联mould
</summary>
<returns></returns>
</member>
<member name="T:Yi.Framework.ApiMicroservice.Utility.CustomHostingStartup">
<summary>
必须实现IHostingStartup接口

View File

@@ -1,8 +0,0 @@
using System;
namespace Yi.Framework.DTOModel
{
public class Class1
{
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
namespace Yi.Framework.DTOModel
{
public class IdDto<T>
{
public T id1 { get; set; }
public T id2 { get; set; }
}
public class IdsDto<T>
{
public T id{ get; set; }
public List<T> ids { get; set; }
}
public class IdsListDto<T>
{
public List<T> ids1 { get; set; }
public List<T> ids2 { get; set; }
}
}