usr_data.py 465 B

1234567891011121314
  1. from django.db import connection
  2. def usr_data(USR,USR_NAME,DATE):
  3. """
  4. :param USR: 用户代号
  5. :param USR_NAME: 用户名
  6. :return:
  7. """
  8. with connection.cursor() as cursor:
  9. row_usr = cursor.execute("SELECT COUNT(*) FROM SALM WHERE SAL_NO=%s", [USR]).fetchall()[0][0]
  10. if row_usr == 0:
  11. cursor.execute("INSERT INTO SALM(SAL_NO,[NAME],USR,SYS_DATE)VALUES (%s,%s,%s,%s)", [USR, USR_NAME,USR_NAME,DATE])
  12. return "ok"