You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

15 lines
767 B

# -*- coding: utf-8 -*-
"""票 05 诊断:AuthUser.dept_id 是否为空(D-13 快照源头)。"""
import io, sys
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
import pymysql
conn = pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456',
database='crm', charset='utf8mb4', autocommit=True)
cur = conn.cursor()
cur.execute("SELECT id, username, dept_id, deleted FROM crm_auth_user "
"WHERE id IN ('739564171091247104','744842565802524672','744842566742048768','744842318024015872')")
for r in cur.fetchall():
print(r)
cur.execute("SELECT COUNT(*), SUM(dept_id IS NULL) FROM crm_auth_user WHERE deleted=0")
print('用户总数/dept_id 为空数 =', cur.fetchone())
conn.close()