from django.db import connection

def usr_data(USR,USR_NAME,DATE):
    """

    :param USR: 用户代号
    :param USR_NAME: 用户名
    :return:
    """
    with connection.cursor() as cursor:
        row_usr = cursor.execute("SELECT COUNT(*) FROM SALM WHERE SAL_NO=%s", [USR]).fetchall()[0][0]
        if row_usr == 0:
            cursor.execute("INSERT INTO SALM(SAL_NO,[NAME],USR,SYS_DATE)VALUES (%s,%s,%s,%s)", [USR, USR_NAME,USR_NAME,DATE])
    return "ok"