LeftMenuVo.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using Model;
  2. using Newtonsoft.Json;
  3. namespace Vo
  4. {
  5. /// <summary>
  6. /// Treeselect树结构实体类
  7. /// </summary>
  8. public class LeftMenuVo
  9. {
  10. /// <summary>
  11. /// 节点Id
  12. /// </summary>
  13. public long Id { get; set; }
  14. /// <summary>
  15. /// 节点名称
  16. /// </summary>
  17. public string Name { get; set; }
  18. public long ParentId { get; set; }
  19. public string MenuType { get; set; }
  20. public string Path { get; set; }
  21. public int SortOrder { get; set; }
  22. public TreeSelectMeta meta { get; set; }
  23. public List<string> Permission { get; set; }
  24. public LeftMenuVo() { }
  25. public LeftMenuVo(SysMenu menu)
  26. {
  27. Id = menu.menuId;
  28. Name = menu.name;
  29. ParentId = menu.parentId;
  30. MenuType = menu.menuType;
  31. Path = menu.path;
  32. SortOrder = menu.sortOrder;
  33. meta = new TreeSelectMeta();
  34. meta.title = menu.name;
  35. meta.enName = menu.enName;
  36. meta.icon = menu.icon;
  37. Permission = new List<string>();
  38. List<LeftMenuVo> child = new List<LeftMenuVo>();
  39. foreach (var item in menu.children)
  40. {
  41. if(item.menuType == "0")
  42. {
  43. child.Add(new LeftMenuVo(item));
  44. }
  45. else
  46. {
  47. Permission.Add(item.permission);
  48. }
  49. }
  50. Children = child;
  51. }
  52. public LeftMenuVo(SysDept dept)
  53. {
  54. Id = dept.deptId;
  55. Name = dept.name;
  56. List<LeftMenuVo> child = new List<LeftMenuVo>();
  57. foreach (var item in dept.children)
  58. {
  59. child.Add(new LeftMenuVo(item));
  60. }
  61. Children = child;
  62. }
  63. [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
  64. public List<LeftMenuVo> Children { get; set; }
  65. }
  66. }