ConditionTree.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace wispro.sp.entity.workflowDefine
  8. {
  9. public class ConditionExpress
  10. {
  11. public ConditionTreeNode Root { get; set; }
  12. public void AddCondition(ConditionExpress express ,LogicSymbols logic)
  13. {
  14. if(express.Root != null)
  15. {
  16. if (Root != null)
  17. {
  18. ConditionTreeNode node = new LogicNode() { operate = logic };
  19. node.Left = Root;
  20. node.Right = express.Root;
  21. Root = node;
  22. }
  23. else
  24. {
  25. Root = express.Root;
  26. }
  27. }
  28. }
  29. }
  30. public class ConditionTreeNode
  31. {
  32. public ConditionTreeNode Right { get; set; }
  33. public ConditionTreeNode Left { get; set; }
  34. }
  35. #region 枚举类型
  36. public enum LogicSymbols
  37. {
  38. AND,
  39. OR,
  40. NOT
  41. }
  42. public enum ComparisonSymbol
  43. {
  44. [Description("包含")]
  45. Contains,
  46. [Description("等于")]
  47. Equal,
  48. [Description("大于")]
  49. Greater,
  50. [Description("大于等于")]
  51. GreaterEqual,
  52. [Description("小于")]
  53. Less,
  54. [Description("小于等于")]
  55. LessEqual,
  56. [Description("不等于")]
  57. NotEqual,
  58. //[Description("不等于")]
  59. //In,
  60. //[Description("不等于")]
  61. //Between,
  62. [Description("开头为")]
  63. StartsWith,
  64. [Description("结尾为")]
  65. EndWith,
  66. [Description("不包含")]
  67. NotContains
  68. }
  69. public enum FieldType
  70. {
  71. [Description("用户输入值")]
  72. ActionInputValue,
  73. [Description("用户操作")]
  74. DoAction,
  75. [Description("绑定对象属性值")]
  76. BindObjectProperty,
  77. [Description("操作用户")]
  78. DoActionUser
  79. }
  80. public enum UserType
  81. {
  82. [Description("指定用户")]
  83. Staff,
  84. [Description("指定部门")]
  85. Department,
  86. [Description("指定部门职位")]
  87. DepartmentPosition,
  88. [Description("指定操作处理人")]
  89. DoActionUser,
  90. [Description("绑定对象包含人员")]
  91. BindObjectProperty
  92. }
  93. #endregion
  94. public class LogicNode : ConditionTreeNode
  95. {
  96. public LogicSymbols operate { get; set; }
  97. }
  98. public class FieldNode : ConditionTreeNode
  99. {
  100. /// <summary>
  101. /// 字段名称
  102. /// </summary>
  103. public string FieldName { get; set; }
  104. /// <summary>
  105. /// 值
  106. /// </summary>
  107. public string Value { get; set; }
  108. /// <summary>
  109. /// 值类型
  110. /// </summary>
  111. public string ValueType { get; set; }
  112. /// <summary>
  113. /// 比较符号
  114. /// </summary>
  115. public ComparisonSymbol Operator { get; set; }
  116. /// <summary>
  117. /// 类型
  118. /// </summary>
  119. public FieldType FieldType { get; set; }
  120. }
  121. public class UserCondition
  122. {
  123. public UserType UserType { get; set; }
  124. public string Value { get; set; }
  125. }
  126. }