def add_customer(self, userId, insurename, insuregender, insureidcard, byinsurename, byinsuregender, byidcard, relationship, phone, address, bankcard, issuename, safecard, paymentperiod, safeguardperiod, effectiveandexpirationdate, ordertime, notdealreason, notorderreason, shareperson, detail, status): sql = "insert into customers" \ "(user_id,insurename,insuregender,insureidcard,byinsurename,byinsuregender,byidcard,relationship,phone,address,bankcard,issuename,safecard,paymentperiod,safeguardperiod,effectiveandexpirationdate,ordertime,notdealreason,notorderreason,shareperson,detail,status) " \ "values('{userId}','{insurename}','{insuregender}','{insureidcard}','{byinsurename}','{byinsuregender}','{byidcard}','{relationship}','{phone}','{address}','{bankcard}','{issuename}','{safecard}','{paymentperiod}','{safeguardperiod}','{effectiveandexpirationdate}','{ordertime}','{notdealreason}','{notorderreason}','{shareperson}','{detail}','{status}')"\ .format(userId=userId,insurename=insurename,insuregender=insuregender,insureidcard=insureidcard,byinsurename=byinsurename,byinsuregender=byinsuregender,byidcard=byidcard,relationship=relationship,phone=phone,address=address,bankcard=bankcard,issuename=issuename,safecard=safecard,paymentperiod=paymentperiod,safeguardperiod=safeguardperiod,effectiveandexpirationdate=effectiveandexpirationdate,ordertime=ordertime,notdealreason=notdealreason,notorderreason=notorderreason,shareperson=shareperson,detail=detail,status=status) return cursor.execute(sql) == 1
def get_customers_has_order(self, userId): sql = "select insurename,insuregender,phone,ordertime,customer_id from customers where status = 1 and user_id = '{user_id}'"\ .format(user_id=userId) cursor.execute(sql) return cursor.fetchall()
def get_customers_deal(self, userId): sql = "select insurename,insuregender,insureidcard,byinsurename,byinsuregender,byidcard,phone,bankcard,address,issuename,safecard,paymentperiod,safeguardperiod,effectiveandexpirationdate,shareperson,customer_id from customers where status = 5 and user_id = '{user_id}'"\ .format(user_id=userId) cursor.execute(sql) return cursor.fetchall()
def get_customers_visit(self, userId): sql = "select insurename,insuregender,phone,address,customer_id from customers where status = 4 and user_id = '{user_id}'" \ .format(user_id=userId) cursor.execute(sql) return cursor.fetchall()
def get_customers_delayordertime(self, userId): sql = "select insurename,insuregender,phone,notorderreason,customer_id from customers where status = 3 and user_id = '{user_id}'"\ .format(user_id=userId) cursor.execute(sql) return cursor.fetchall()
def get_customers_impressive(self, userId): sql = "select insurename,insuregender,phone,notdealreason,customer_id from customers where status = 2 and user_id = '{user_id}'"\ .format(user_id=userId) cursor.execute(sql) return cursor.fetchall()
def login_get_password_by_username(self, username): sql = "select user_password from users where user_name = '{user_name}'"\ .format(user_name=username) cursor.execute(sql) password = cursor.fetchone()[0] return password
def is_exist_username(self, username): sql = "select * from users where user_name = '{user_name}'".format( user_name=username) cursor.execute(sql) return cursor.rowcount == 1
def regist_in_db(self, username, password): sql = "insert into users(user_name,user_password) values('{username}','{password}')"\ .format(username=username,password=password) return cursor.execute(sql) == 1
def delete_customer(self, customer_id): sql = "delete from customers where customer_id = '{customer_id}'".format( customer_id=customer_id) cursor.execute(sql)