ConditionTree.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace wispro.sp.entity.workflowDefine
  7. {
  8. public class ConditionExpress
  9. {
  10. public ConditionTreeNode Root { get; set; }
  11. public void AddCondition(ConditionExpress express ,LogicSymbols logic)
  12. {
  13. if(express.Root != null)
  14. {
  15. if (Root != null)
  16. {
  17. ConditionTreeNode node = new LogicNode() { operate = logic };
  18. node.Left = Root;
  19. node.Right = express.Root;
  20. Root = node;
  21. }
  22. else
  23. {
  24. Root = express.Root;
  25. }
  26. }
  27. }
  28. }
  29. public class ConditionTreeNode
  30. {
  31. public ConditionTreeNode Right { get; set; }
  32. public ConditionTreeNode Left { get; set; }
  33. }
  34. public enum LogicSymbols
  35. {
  36. AND,
  37. OR,
  38. NOT
  39. }
  40. public enum ComparisonSymbol
  41. {
  42. Contains,
  43. Equal,
  44. Greater,
  45. GreaterEqual,
  46. Less,
  47. LessEqual,
  48. NotEqual,
  49. In,
  50. Between,
  51. StartsWith,
  52. EndWith,
  53. NotContains
  54. }
  55. public class LogicNode : ConditionTreeNode
  56. {
  57. public LogicSymbols operate { get; set; }
  58. }
  59. public class FieldNode : ConditionTreeNode
  60. {
  61. /// <summary>
  62. /// 字段名称
  63. /// </summary>
  64. public string FieldName { get; set; }
  65. /// <summary>
  66. /// 值
  67. /// </summary>
  68. public string Value { get; set; }
  69. /// <summary>
  70. /// 值类型
  71. /// </summary>
  72. public string ValueType { get; set; }
  73. /// <summary>
  74. /// 比较符号
  75. /// </summary>
  76. public ComparisonSymbol Operator { get; set; }
  77. }
  78. }