Browse Source

Merge branch 'dev' of http://git.fast-fun.cn:92/lmstack/data_analyze_platform into dev

qingfeng 2 years ago
parent
commit
fd646025b0
1 changed files with 6 additions and 1 deletions
  1. 6 1
      LIB/MIDDLE/SaftyCenter/Common/DBDownload.py

+ 6 - 1
LIB/MIDDLE/SaftyCenter/Common/DBDownload.py

@@ -46,13 +46,18 @@ class DBDownload:
         if self.mode==1:
             self.cursor.execute("select %s from %s where sn='%s' order by id desc limit 1" %(str,tablename,sn))
         elif self.mode==0:
-            self.cursor.execute("select %s from %s where sn='%s' and %s between '%s' and '%s'" %(str,tablename,sn,timename,st,sp))
+            if len(sn)>1:
+                self.cursor.execute("select %s from %s where sn='%s' and %s between '%s' and '%s'" %(str,tablename,sn,timename,st,sp))
+            else:
+                self.cursor.execute("select %s from %s where %s between '%s' and '%s'" %(str,tablename,timename,st,sp))
         elif self.mode==2:
             self.cursor.execute("select %s from %s where factory='%s'" %(str,tablename,factory))
         elif self.mode==3:
             self.cursor.execute("select %s from %s" %(str,tablename))
         elif self.mode==4:
             self.cursor.execute("select %s from %s where qrcode='%s' order by id desc limit 1" %(str,tablename,sn))
+        elif self.mode==5:
+            self.cursor.execute("select %s from %s where info='%s'" %(str,tablename,timename))
         res = self.cursor.fetchall()
         df_res = pd.DataFrame(res, columns=param)
         df_res = df_res.reset_index(drop=True)