Exemplo n.º 1
0
 def GetUserIllegal(self, obj):
     # 拼接
     Seq = []
     Val = []
     if obj.get_illegalid() != '':
         Seq.append('illegalid')
         Val.append(obj.get_illegalid())
     if obj.get_userid() != '':
         Seq.append('userid')
         Val.append(obj.get_userid())
     if obj.get_bookid() != '':
         Seq.append('bookid')
         Val.append(obj.get_bookid())
     if obj.get_amount() != '':
         Seq.append('amount')
         Val.append(obj.get_amount())
     if obj.get_isprocessed() != '':
         Seq.append('isprocessed')
         Val.append(obj.get_isprocessed())
     if obj.get_illegaldate() != '':
         Seq.append('illegaldate')
         Val.append(obj.get_illegaldate())
     if obj.get_illegaltype() != '':
         Seq.append('illegaltype')
         Val.append(obj.get_illegaltype())
     Ile = dict(zip(Seq, Val))
     mysql = Mysql()
     sql = "select * from illegal where "
     keys = tuple(Ile.keys())
     vals = tuple(Ile.values())
     Len = len(Ile)
     for i in range(Len):
         if (i != Len - 1):
             sql = sql + keys[i] + "='" + str(vals[i]) + "' and "
         else:
             sql = sql + keys[i] + "='" + str(vals[i]) + "'"
     Ilegal = mysql.getAll(sql)
     if Ilegal == False:
         print("No Illegal record!")
     else:
         print("Illegal records:")
         if Ilegal:
             for row in Ilegal:
                 print("%s\t%s\t%s\t%s\t%s\t%s\t%s" %
                       (row[0], row[1], row[2], row[3], row[4], row[5],
                        row[6]))
     mysql.dispose()
     show = MiddleLayer()
     tums = show.ShowIllegal(Ilegal)
     return tums
Exemplo n.º 2
0
 def GetAllIlegal(self, num):
     mysql = Mysql()
     if (str(num) == '0'):
         sqlAll = "select * from Illegal"
     else:
         sqlAll = "select * from Illegal limit " + str(num)
     result = mysql.getAll(sqlAll)
     # if result :
     #     for row in result :
     # print("%s\t%s\t%s\t%s\t%s\t%s\t%s" %(row[0],row[1],row[2],row[3],row[4],row[5],row[6]))
     mysql.dispose()
     show = MiddleLayer()
     tums = show.ShowIllegal(result)
     return tums