def special_job_validate_and_verify(special_job_dict):
    select_sql = '''select account, special_job, special_job_code from employ'''
    update_sql = '''update employ set special_job_code = %s where account = %s and special_job = %s'''
    cursor = employ_conn.cursor()
    cursor.execute(select_sql)
    results = cursor.fetchall()

    with open("../log/special_job", "a") as w:
        for res in results:
            account = res[0]
            special_job = res[1]
            special_job_code = res[2]
            if special_job is not None and special_job != '':
                if special_job in special_job_dict and str(special_job_code) == special_job_dict[special_job]:
                    print(account + '--校验通过!')
                elif special_job in special_job_dict and str(special_job_code) != special_job_dict[special_job]:
                    print(account + '--代码不匹配!')
                    cursor.execute(update_sql, (special_job_dict[special_job], account, special_job))
                    employ_conn.commit()
                    w.write(account + '修改成功!\n')
Пример #2
0
def ethnicity_validate_and_verify(ethnicity_dict):
    select_sql = '''select username, ethnicity, ethnicity_code from student'''
    update_sql = '''update student set ethnicity_code = %s where username = %s and ethnicity = %s'''
    cursor = employ_conn.cursor()
    cursor.execute(select_sql)
    results = cursor.fetchall()
    # output_file = r"G:\ethnicity.txt"
    with open("../log/ethnicity", "a") as w:
        for res in results:
            username = res[0]
            ethnicity = res[1]
            ethnicity_code = res[2]
            if ethnicity is not None and ethnicity != '':
                if ethnicity in ethnicity_dict and str(ethnicity_code) == ethnicity_dict[ethnicity]:
                    print(username + '--校验通过!')
                    w.write(username + '--校验通过!\n')
                elif ethnicity in ethnicity_dict and str(ethnicity_code) != ethnicity_dict[ethnicity]:
                    print(username + '--代码不匹配!')
                    cursor.execute(update_sql, (ethnicity_dict[ethnicity], username, ethnicity))
                    employ_conn.commit()
                    w.write(username + '修改成功!\n')
def industry_validate_and_verify(industry_dict):
    select_sql = '''select account, industry, industry_code from employ'''
    update_sql = '''update employ set industry_code = %s where account = %s and industry = %s'''
    cursor = employ_conn.cursor()
    cursor.execute(select_sql)
    results = cursor.fetchall()

    with open("../log/industry", "a") as w:
        for res in results:
            account = res[0]
            industry = res[1]
            industry_code = res[2]
            if industry is not None and industry != '':
                if industry in industry_dict and str(
                        industry_code) == industry_dict[industry]:
                    print(account + '--校验通过!')
                elif industry in industry_dict and str(
                        industry_code) != industry_dict[industry]:
                    print(account + '--代码不匹配!')
                    cursor.execute(
                        update_sql,
                        (industry_dict[industry], account, industry))
                    employ_conn.commit()
                    w.write(account + '修改成功!\n')
def property_validate_and_verify(property_dict):
    select_sql = '''select account, property, property_code from employ'''
    update_sql = '''update employ set property_code = %s where account = %s and property = %s'''
    cursor = employ_conn.cursor()
    cursor.execute(select_sql)
    results = cursor.fetchall()

    with open("../log/property", "a") as w:
        for res in results:
            account = res[0]
            property = res[1]
            property_code = res[2]
            if property is not None and property != '':
                if property in property_dict and str(
                        property_code) == property_dict[property]:
                    print(account + '--校验通过!')
                elif property in property_dict and str(
                        property_code) != property_dict[property]:
                    print(account + '--代码不匹配!')
                    cursor.execute(
                        update_sql,
                        (property_dict[property], account, property))
                    employ_conn.commit()
                    w.write(account + '修改成功!\n')
def political_validate_and_verify(political_dict):
    select_sql = '''select username, political, political_code from student'''
    update_sql = '''update student set political_code = %s where username = %s and political = %s'''
    cursor = employ_conn.cursor()
    cursor.execute(select_sql)
    results = cursor.fetchall()

    with open("../log/political", "a") as w:
        for res in results:
            username = res[0]
            political = res[1]
            political_code = res[2]
            if political is not None and political != '':
                if political in political_dict and str(
                        political_code) == political_dict[political]:
                    print(username + '--校验通过!')
                elif political in political_dict and str(
                        political_code) != political_dict[political]:
                    print(username + '--代码不匹配!')
                    cursor.execute(
                        update_sql,
                        (political_dict[political], username, political))
                    employ_conn.commit()
                    w.write(username + '修改成功!\n')
Пример #6
0
def addr_update(addr_type, student_code, addr, addr_code):
    cursor = employ_conn.cursor()
    if addr_type == 'enrollment_addr':
        update_sql = '''update student set enrollment_addr = %s, enrollment_code = %s where username = %s'''
        cursor.execute(update_sql, (addr, addr_code, student_code))
        employ_conn.commit()
    # '''select account, implement_comp_addr, implement_comp_code from record'''
    elif addr_type == 'implement_comp_addr':
        update_sql = '''update record set implement_comp_code = %s where account = %s and implement_comp_addr = %s'''
        cursor.execute(update_sql, (addr_code, student_code, addr))
        employ_conn.commit()
    # company_addr, company_addr_code
    elif addr_type == 'company_addr':
        update_sql = '''update employ set company_addr_code = %s where account = %s and company_addr = %s'''
        cursor.execute(update_sql, (addr_code, student_code, addr))
        employ_conn.commit()