|
@@ -865,7 +865,7 @@
|
|
|
|
|
|
<!--工单完成情况统计-->
|
|
<!--工单完成情况统计-->
|
|
<select id="workOrderStatistics" resultType="map">
|
|
<select id="workOrderStatistics" resultType="map">
|
|
- select total '工单总数', finished '工单完成数', finished/total '工单完成率' from
|
|
|
|
|
|
+ select total 工单总数, finished 工单完成数, finished/total 工单完成率 from
|
|
(
|
|
(
|
|
select count(1) total,sum(case when order_status=2 then 1 when order_status =3 then 1 else 0 end) finished
|
|
select count(1) total,sum(case when order_status=2 then 1 when order_status =3 then 1 else 0 end) finished
|
|
from sc_work_order_manage t1
|
|
from sc_work_order_manage t1
|
|
@@ -915,9 +915,9 @@
|
|
|
|
|
|
<!--事件数据月统计-->
|
|
<!--事件数据月统计-->
|
|
<select id="eventMonthStatistics" resultType="map">
|
|
<select id="eventMonthStatistics" resultType="map">
|
|
- select '数量','日期' from
|
|
|
|
|
|
+ select 数量,日期 from
|
|
(
|
|
(
|
|
- select count(1) '数量',date_format(date_create,'%Y-%c-%d') '日期'
|
|
|
|
|
|
+ select count(1) 数量,date_format(date_create,'%Y-%c-%d') 日期
|
|
from sc_work_order_manage t1
|
|
from sc_work_order_manage t1
|
|
<where>
|
|
<where>
|
|
<if test="order.statsType == 0">
|
|
<if test="order.statsType == 0">
|
|
@@ -961,14 +961,14 @@
|
|
</where>
|
|
</where>
|
|
group by date_format(date_create,'%Y-%c-%d')
|
|
group by date_format(date_create,'%Y-%c-%d')
|
|
) a
|
|
) a
|
|
- order by '日期'
|
|
|
|
|
|
+ order by 日期
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<!--事件数据年统计-->
|
|
<!--事件数据年统计-->
|
|
<select id="eventYearStatistics" resultType="map">
|
|
<select id="eventYearStatistics" resultType="map">
|
|
- select '数量','日期' from
|
|
|
|
|
|
+ select 数量,日期 from
|
|
(
|
|
(
|
|
- select count(1) '数量',date_format(date_create,'%Y-%c') '日期'
|
|
|
|
|
|
+ select count(1) 数量,date_format(date_create,'%Y-%c') 日期
|
|
from sc_work_order_manage t1
|
|
from sc_work_order_manage t1
|
|
<where>
|
|
<where>
|
|
<if test="order.statsType == 0">
|
|
<if test="order.statsType == 0">
|
|
@@ -1012,8 +1012,154 @@
|
|
</where>
|
|
</where>
|
|
group by date_format(date_create,'%Y-%c')
|
|
group by date_format(date_create,'%Y-%c')
|
|
) a
|
|
) a
|
|
- order by '日期'
|
|
|
|
|
|
+ order by 日期
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
+ <!--上报类型统计-->
|
|
|
|
+ <select id="reportStatistics" resultType="map">
|
|
|
|
+ select case when t1.event_type=1 then '运维上报' when t1.event_type=2 then '用户上报' when t1.event_type=3 then '设备告警' end 上报类型,
|
|
|
|
+ count(*) 数量
|
|
|
|
+ from sc_work_order_manage t1
|
|
|
|
+ <where>
|
|
|
|
+ <if test="order.statsType == 0">
|
|
|
|
+ and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
|
|
|
|
+ and t1.date_create < DATE_ADD(date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 MONTH)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.statsType == 1">
|
|
|
|
+ and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
|
|
|
|
+ and t1.date_create < DATE_ADD(date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 YEAR)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.tenantId != null and order.tenantId != ''">
|
|
|
|
+ and t1.tenant_id = #{order.tenantId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
|
|
|
|
+ <if test="order.permissonType == 5 or order.permissonType == 2">
|
|
|
|
+ and ( t1.department_org_id in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ or
|
|
|
|
+ t1.COMPANY_ORG_ID in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.permissonType == 4 or order.permissonType == 3">
|
|
|
|
+ and t1.department_org_id in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.permissonType == 1">
|
|
|
|
+ and t1.COMPANY_ORG_ID in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ and (t1.department_org_id is null or t1.department_org_id =0)
|
|
|
|
+ </if>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ group by t1.event_type
|
|
|
|
+ </select>
|
|
|
|
|
|
|
|
+ <!--工单状态统计-->
|
|
|
|
+ <select id="orderStatusStatistics" resultType="map">
|
|
|
|
+ select 工单状态,sum(数量) 数量 from
|
|
|
|
+ (
|
|
|
|
+ select case when t1.order_status=0 then '未派单' when t1.order_status=1 or t1.order_status=4 then '处理中'
|
|
|
|
+ when t1.order_status=2 then '已完成' when t1.order_status=3 then '终止' end 工单状态,count(*) 数量
|
|
|
|
+ from sc_work_order_manage t1
|
|
|
|
+ <where>
|
|
|
|
+ <if test="order.statsType == 0">
|
|
|
|
+ and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
|
|
|
|
+ and t1.date_create < DATE_ADD(date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 MONTH)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.statsType == 1">
|
|
|
|
+ and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
|
|
|
|
+ and t1.date_create < DATE_ADD(date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 YEAR)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.tenantId != null and order.tenantId != ''">
|
|
|
|
+ and t1.tenant_id = #{order.tenantId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
|
|
|
|
+ <if test="order.permissonType == 5 or order.permissonType == 2">
|
|
|
|
+ and ( t1.department_org_id in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ or
|
|
|
|
+ t1.COMPANY_ORG_ID in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.permissonType == 4 or order.permissonType == 3">
|
|
|
|
+ and t1.department_org_id in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.permissonType == 1">
|
|
|
|
+ and t1.COMPANY_ORG_ID in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ and (t1.department_org_id is null or t1.department_org_id =0)
|
|
|
|
+ </if>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ group by t1.order_status
|
|
|
|
+ ) a
|
|
|
|
+ group by 工单状态
|
|
|
|
+ </select>
|
|
|
|
+
|
|
|
|
+ <!--工单类型统计-->
|
|
|
|
+ <select id="orderTypeStatistics" resultType="map">
|
|
|
|
+ select t1.order_type_id,count(*) 数量
|
|
|
|
+ from sc_work_order_manage t1
|
|
|
|
+ <where>
|
|
|
|
+ t1.order_type_id>=1
|
|
|
|
+ <if test="order.statsType == 0">
|
|
|
|
+ and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
|
|
|
|
+ and t1.date_create < DATE_ADD(date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 MONTH)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.statsType == 1">
|
|
|
|
+ and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
|
|
|
|
+ and t1.date_create < DATE_ADD(date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d'),INTERVAL 1 YEAR)
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.tenantId != null and order.tenantId != ''">
|
|
|
|
+ and t1.tenant_id = #{order.tenantId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.userType!=null and order.userType!=-999 and order.userType!=-9999 and order.programItems != null and order.programItems.size() > 0">
|
|
|
|
+ <if test="order.permissonType == 5 or order.permissonType == 2">
|
|
|
|
+ and ( t1.department_org_id in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ or
|
|
|
|
+ t1.COMPANY_ORG_ID in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.permissonType == 4 or order.permissonType == 3">
|
|
|
|
+ and t1.department_org_id in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ </if>
|
|
|
|
+ <if test="order.permissonType == 1">
|
|
|
|
+ and t1.COMPANY_ORG_ID in
|
|
|
|
+ <foreach collection="order.programItems" item="item" open="(" close=")" separator=",">
|
|
|
|
+ #{item.orgId}
|
|
|
|
+ </foreach>
|
|
|
|
+ and (t1.department_org_id is null or t1.department_org_id =0)
|
|
|
|
+ </if>
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ group by t1.order_type_id
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|