配置统计增加一列Effective 有效配置数

This commit is contained in:
段冬梅
2019-03-28 14:32:22 +08:00
parent 09405e06e1
commit bea5312e9f
6 changed files with 16 additions and 9 deletions

View File

@@ -4,11 +4,12 @@
<!-- -->
<select id="getConfigStateStatistics" resultType="map">
select c.function_id functionId,
sum(case when c.cfg_state =1 then 1 else 0 end) as approved,
sum(case when c.cfg_state =1 then 1 else 0 end) as effective,
sum(case when c.cfg_state =2 then 1 else 0 end) as unapproved,
sum(case when c.cfg_state =3 then 1 else 0 end) as cancle_approved,
sum(case when c.cfg_state =0 then 1 else 0 end) as created,
sum(case when c.cfg_state =-1 then 1 else 0 end) as deleted
sum(case when c.cfg_state =-1 then 1 else 0 end) as deleted,
sum(case when c.cfg_state =4 or c.cfg_state=1 then 1 else 0 end) as approved
from cfg_num_statistics c where c.statistic_time = #{statisticTime}
group by c.function_id;
</select>

View File

@@ -1502,4 +1502,5 @@ schedule=Scheduler
cancel_all=Cancel all configurations!
pre_version=Previous Version
approved_all=Approve all configurations!
protection_list_manage=Protection List Manage
protection_list_manage=Protection List Manage
effective=Effective

View File

@@ -1507,4 +1507,5 @@ schedule=Scheduler
cancel_all=Cancel all configurations!
pre_version=Previous Version
approved_all=Approve all configurations!
protection_list_manage=Protection List Manage
protection_list_manage=Protection List Manage
effective=Effective

View File

@@ -1500,4 +1500,5 @@ cancel_all=\u53D6\u6D88\u6240\u6709\u914D\u7F6E!
pre_version=\u4e0a\u4e00\u7248
is_schduler=\u5b9a\u65f6\u5668
approved_all=\u5BA1\u6838\u901A\u8FC7\u6240\u6709\u914D\u7F6E!
protection_list_manage=\u5185\u7F6E\u4FDD\u62A4\u540D\u5355\u7BA1\u7406
protection_list_manage=\u5185\u7F6E\u4FDD\u62A4\u540D\u5355\u7BA1\u7406
effective=\u6709\u6548

View File

@@ -1,3 +1,4 @@
drop PROCEDURE proc_statistics_config;
CREATE DEFINER=`root`@`%` PROCEDURE `proc_statistics_config`()
BEGIN
@@ -64,10 +65,8 @@ BEGIN
COMMIT;
#没有定时任务前的统计:is_audit=1 && is_valid=1为approved
#set @insert_statistics_sql := concat('insert into cfg_num_statistics(statistic_time,audit_time,function_id,service_id,action,compile_id,cfg_state) select ','''',ntime,'''',',','audit_time,function_id,service_id,action,compile_id,if(is_audit=3,3,if(is_audit=2,2,if(is_audit=1,1,if(is_valid=0,0,if(is_valid,-1,-1))))) cfg_state from ',tabName);
#20190328 增加定时任务后is_audit=1 && (is_valid=1 || is_valid=0) 即为approved 为与界面显示保持一致更改统计条件此时的结果中approved并不代表所有有效的配置总数
set @insert_statistics_sql := concat('insert into cfg_num_statistics(statistic_time,function_id,service_id,action,compile_id,cfg_state) select ','''',ntime,'''',',','function_id,service_id,action,compile_id,if(is_valid=-1,-1,if(is_valid=1,1,if(is_valid=0 && is_audit=0,0,if(is_valid=0 && is_audit=1,1,if(is_valid=0 && is_audit=2,2,if(is_valid=0 && is_audit=3,3,0)))))) cfg_state from ',tabName);
#20190328 增加定时任务后is_audit=1 && (is_valid=1 || is_valid=0) 即为approved 增加cfg_state=4[is_valid=0 && is_audit=1],代表定时任务审核过的而cfg_state=1仅仅代表审核通过且有效的界面展示的approved值实际包含cfg_state=4和cfg_state=1
set @insert_statistics_sql := concat('insert into cfg_num_statistics(statistic_time,function_id,service_id,action,compile_id,cfg_state) select ','''',ntime,'''',',','function_id,service_id,action,compile_id,if(is_valid=-1,-1,if(is_valid=1,1,if(is_audit=0,0,if(is_audit=1,4,if(is_audit=2,2,if(is_audit=3,3,0)))))) cfg_state from ',tabName);
PREPARE execs FROM @insert_statistics_sql;

View File

@@ -472,6 +472,7 @@
<thead>
<tr>
<th><spring:message code="service_name"/></th>
<th><spring:message code="effective"/></th>
<th><spring:message code="approved"/></th>
<th><spring:message code="unapproved"/></th>
<th><spring:message code="cancel_approved"/></th>
@@ -510,6 +511,9 @@
<%-- <spring:message code="${serviceName }"/>${serviceName } --%>
<spring:message code="${functionName }"/>
</td>
<td>
${statistics.effective }
</td>
<td>
${statistics.approved }
</td>