ConditionTree.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 UserConditionType
  81. {
  82. [Description("指定个人")]
  83. Staff,
  84. [Description("指定部门")]
  85. Department,
  86. [Description("指定部门职位")]
  87. DepartmentPosition,
  88. [Description("指定用户部门")]
  89. UserDepartment,
  90. [Description("指定用户部门职位")]
  91. UserDepartmentPosition
  92. }
  93. public enum UserType
  94. {
  95. [Description("指定用户")]
  96. Staff,
  97. [Description("登录用户")]
  98. LoginUser,
  99. [Description("流程对象人员属性")]
  100. BindObjectProperty,
  101. [Description("操作处理人")]
  102. DoActionUser
  103. }
  104. #endregion
  105. public class LogicNode : ConditionTreeNode
  106. {
  107. public LogicSymbols operate { get; set; }
  108. }
  109. public class FieldNode : ConditionTreeNode
  110. {
  111. /// <summary>
  112. /// 字段名称
  113. /// </summary>
  114. public string FieldName { get; set; }
  115. /// <summary>
  116. /// 值
  117. /// </summary>
  118. public string Value { get; set; }
  119. /// <summary>
  120. /// 值类型
  121. /// </summary>
  122. public string ValueType { get; set; }
  123. /// <summary>
  124. /// 比较符号
  125. /// </summary>
  126. public ComparisonSymbol Operator { get; set; }
  127. /// <summary>
  128. /// 类型
  129. /// </summary>
  130. public FieldType FieldType { get; set; }
  131. }
  132. public class UserFieldNode : ConditionTreeNode
  133. {
  134. public UserField Field { get; set; }
  135. /// <summary>
  136. /// 比较符号
  137. /// </summary>
  138. public ComparisonSymbol Operator { get; set; }
  139. /// <summary>
  140. /// 值
  141. /// </summary>
  142. public string Value { get; set; }
  143. }
  144. public class UserField
  145. {
  146. /// <summary>
  147. /// 用户条件类型
  148. /// </summary>
  149. public UserConditionType UserConditionType { get; set; }
  150. /// <summary>
  151. /// 指定用户类型
  152. /// </summary>
  153. public UserType UserType { get; set; }
  154. /// <summary>
  155. /// 指定用户值
  156. /// </summary>
  157. public string UserValue { get; set; }
  158. /// <summary>
  159. /// 指定部门值
  160. /// </summary>
  161. public string Department { get; set; }
  162. /// <summary>
  163. /// 指定职位值
  164. /// </summary>
  165. public string Positon { get; set; }
  166. }
  167. }