/********* 持续收集! **********/
//******** 数据库权限开启、远程登录 ***********************
grant all on pscdb.* to root@localhost identified by '12345';
grant all on pscdb.* to root@'132.96.32.51' identified by '12345';
flush privileges;
//******** 统计‘错误码’(req_code系列)的次数 ***********************
sql.append("select systemname,username,interfacename,'"+starttime+" 至 "+endtime+"' req_period,");
sql.append("sum(if(req_code='1',0,1)) failCount,");
sql.append("sum(1) totalCount,");
sql.append("sum(if(req_code='-1',1,0)) req_code_1,");
sql.append("sum(if(req_code='-2',1,0)) req_code_2,");
sql.append("sum(if(req_code='-3',1,0)) req_code_3,");
sql.append("sum(if(req_code='-4',1,0)) req_code_4,");
sql.append("sum(if(req_code='-5',1,0)) req_code_5,");
sql.append("sum(if(req_code='-6',1,0)) req_code_6,");
sql.append("sum(if(req_code='-7',1,0)) req_code_7 ");
sql.append("from prc_interface_log ");
//********* ifnull(expr1,expr2):expr1非空则返回expr1,否则返回expr2 *****************
//********* 另外还有类似的sql函数:isnull,nullif *****************
select operationcode,operationname,functionid, ifnull((select ROp.operationcode from sys_role_operation ROp where functionid ='4' and roleid='2'),'') auth from sys_operation where functionid = '4';