Example #1
0
def insert_sys_user_info(username, password):
    time_now = get_now()
    sql_text = "INSERT INTO Admin(username, pwd, createdTime) VALUES ('{}','{}','{}')".format(
        username, password, time_now)
    execute(sql_text)
Example #2
0
def update_sys_user_pwd(sys_user_id, new_pwd):
    sql_text = "update Admin set pwd = '{}' where id = {}".format(
        new_pwd, sys_user_id)
    execute(sql_text)
Example #3
0
def insert_staff_info(name, sex, id_card_no):
    time_now = get_now()
    sql_text = '''INSERT INTO Worker(workerName, sex, idcard, createdTime) VALUES ('{}','{}','{}','{}')''' \
        .format(name, sex, id_card_no, time_now)
    execute(sql_text)
Example #4
0
def get_all_user():
    sql_text = 'SELECT id,username FROM Admin WHERE userName!=\'admin\' ORDER BY createdTime DESC '
    data = execute(sql_text)
    return data
Example #5
0
def update_staff_info(name, sex, id_card_no, staff_id):
    sql_text = '''update Worker set workerName='{}', sex='{}', idcard='{}' where id = {}''' \
        .format(name, sex, id_card_no, staff_id)
    execute(sql_text)
Example #6
0
def get_super_user_pwd():
    sql_text = "SELECT pwd FROM Admin WHERE username = '******'"
    pwd = execute(sql_text)[0][0]
    return pwd
Example #7
0
def get_super_user_id():
    sql_text = "SELECT id FROM Admin WHERE username = '******'"
    return execute(sql_text)[0][0]
Example #8
0
def update_buy_state(buy_id, state):
    sql_text = '''update buy_info set state = {} where id = {}''' \
        .format(state, buy_id)
    execute(sql_text)
Example #9
0
def update_left_info(buy_id: int, left_number: int):
    sql_text = '''UPDATE buy_info SET left_number = {} WHERE id = {}'''.format(
        left_number, buy_id)
    return execute(sql_text)