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.
28 lines
1.3 KiB
28 lines
1.3 KiB
|
7 days ago
|
# -*- coding: utf-8 -*-
|
||
|
|
# t11-diag.py — 票 11 开工诊断:远程共享库现状盘点(只读)
|
||
|
|
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()
|
||
|
|
|
||
|
|
def q(label, sql):
|
||
|
|
cur.execute(sql)
|
||
|
|
rows = cur.fetchall()
|
||
|
|
print('== %s ==' % label)
|
||
|
|
for r in rows:
|
||
|
|
print(' ', r)
|
||
|
|
if not rows:
|
||
|
|
print(' (空)')
|
||
|
|
|
||
|
|
q('opportunity 总数', 'SELECT COUNT(*) FROM opportunity')
|
||
|
|
q('opportunity 名称分布', "SELECT opp_name, opp_status, deleted, owner_dept_id FROM opportunity ORDER BY create_time")
|
||
|
|
q('opportunity_customer', 'SELECT COUNT(*) FROM opportunity_customer')
|
||
|
|
q('opportunity_team', 'SELECT COUNT(*) FROM opportunity_team')
|
||
|
|
q('公海规则(全版本)', "SELECT id, rule_code, rule_name, status, apply_scope, allow_free_claim FROM opportunity_pool_rule ORDER BY rule_code, create_time")
|
||
|
|
q('方案卡模板(发布中)', "SELECT id, template_code, template_name, status FROM opportunity_scheme_template WHERE status=2")
|
||
|
|
q('团队行样例', "SELECT opportunity_id, user_id, project_role, duty, permission, delete_key FROM opportunity_team ORDER BY opportunity_id LIMIT 20")
|
||
|
|
conn.close()
|
||
|
|
print('done')
|