From 309d1f9d649daa08bb9b068af014749f6d4a5bce Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 06 Jul 2018 14:00:45 +0800
Subject: [PATCH] 设备和监控点父页面 筛选条件不予 编辑页面联动

---
 src/app/business/services/util/example.service.ts |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/app/business/services/util/example.service.ts b/src/app/business/services/util/example.service.ts
index 032634a..fdcb472 100644
--- a/src/app/business/services/util/example.service.ts
+++ b/src/app/business/services/util/example.service.ts
@@ -8,9 +8,16 @@
        return this.conditions;
      }
 
-     public addCondition(condition: string, colName: string, ...values: any[]) {
+     private addCondition(condition: string, colName: string, ...values: any[]) {
         const split = Criteria.CONDITION_SPLIT; // '||'
-        this.conditions.push(condition + split + colName + split + values.join(split));
+        let conditionStr = condition + split + colName;
+        if (!!values && values.length > 0) {
+            conditionStr += split + values.join(split);
+        }
+        this.conditions.push(conditionStr);
+     }
+     public andCondition(condition: string) {
+        this.addCondition('andCondition', condition);
      }
      public andLike(col: { name: string, value: any}): Criteria {
          this.addCondition('andLike', col.name, col.value);
@@ -20,6 +27,14 @@
         this.addCondition('andEqualTo', col.name, col.value);
         return this;
      }
+     public andNotEqualTo(col: { name: string, value: any}): Criteria {
+        this.addCondition('andNotEqualTo', col.name, col.value);
+        return this;
+     }
+     public andGreaterThanOrEqualTo(col: { name: string, value: any}): Criteria {
+        this.addCondition('andGreaterThanOrEqualTo', col.name, col.value);
+        return this;
+     }
 }
 
 @Injectable()
@@ -27,7 +42,9 @@
   private static OR_SPLIT = 'or|';
   private static  CRITERIA_SPLIT = '|||';
   private criterion: Criteria[] = [];
-  
+  public clear(): void {
+      this.criterion = [];
+  }
   public getSqlParam(): string {
       let whereSql = '';
      for (const cri of this.criterion) {
@@ -37,7 +54,7 @@
      return encodeURI(whereSql);
   }
   constructor() { }
-    public or() {
+    public or(): Criteria {
         const cri = new Criteria();
         this.criterion.push(cri);
         return cri;

--
Gitblit v1.8.0