SwaggerGroupAttribute.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Microsoft.AspNetCore.Mvc.ApiExplorer;
  2. namespace EasyTemplate.Service.Common;
  3. /// <summary>
  4. /// 系统分组特性
  5. /// </summary>
  6. public class ApiGroupAttribute : Attribute, IApiDescriptionGroupNameProvider
  7. {
  8. public ApiGroupAttribute(ApiGroupNames name)
  9. {
  10. GroupName = name.ToString();
  11. }
  12. public string GroupName { get; set; }
  13. }
  14. /// <summary>
  15. /// 系统分组枚举值
  16. /// </summary>
  17. public enum ApiGroupNames
  18. {
  19. [GroupInfo(Title = "登录认证", Description = "登录认证相关接口", Version = "v1")]
  20. Auth,
  21. [GroupInfo(Title = "业务", Description = "业务相关接口")]
  22. Bussiness,
  23. [GroupInfo(Title = "系统", Description = "系统相关接口")]
  24. System,
  25. [GroupInfo(Title = "统计", Description = "统计相关接口")]
  26. Statistics,
  27. [GroupInfo(Title = "测试", Description = "测试相关接口")]
  28. Test
  29. }
  30. /// <summary>
  31. /// 系统模块枚举注释
  32. /// </summary>
  33. public class GroupInfoAttribute : Attribute
  34. {
  35. public string Title { get; set; }
  36. public string Version { get; set; }
  37. public string Description { get; set; }
  38. }