19 lines
1020 B
Python
19 lines
1020 B
Python
# -*- coding: utf-8 -*-
|
|
import io, sys, pymysql
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
conn = pymysql.connect(host='192.168.1.161', user='devgps', password='dev@2021GPS',
|
|
database='zentao_dev', charset='utf8mb4')
|
|
cur = conn.cursor()
|
|
def q(sql):
|
|
cur.execute(sql); return cur.fetchall()
|
|
|
|
print("zt_story releaseddate 分布:")
|
|
for r in q("SELECT DATE_FORMAT(releaseddate,'%Y-%m') m, COUNT(*) c FROM zt_story WHERE deleted='0' AND releaseddate>'2000-01-01' GROUP BY m ORDER BY m DESC LIMIT 8"):
|
|
print(r)
|
|
print("\nzt_bug openeddate 分布:")
|
|
for r in q("SELECT DATE_FORMAT(openeddate,'%Y-%m') m, COUNT(*) c FROM zt_bug WHERE deleted='0' AND openeddate>'2000-01-01' GROUP BY m ORDER BY m DESC LIMIT 8"):
|
|
print(r)
|
|
print("\nzt_task finishedDate(done) 分布:")
|
|
for r in q("SELECT DATE_FORMAT(finishedDate,'%Y-%m') m, COUNT(*) c FROM zt_task WHERE deleted='0' AND status='done' AND finishedDate>'2000-01-01' GROUP BY m ORDER BY m DESC LIMIT 8"):
|
|
print(r)
|