|
@@ -862,4 +862,49 @@
|
|
|
order by t1.date_create desc
|
|
|
</where>
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <!--工单完成情况统计-->
|
|
|
+ <select id="workOrderStatistics" resultType="map">
|
|
|
+ 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
|
|
|
+ from sc_work_order_manage t1
|
|
|
+ <where>
|
|
|
+ t1.order_status != 0
|
|
|
+ and t1.date_create >= date_format(#{order.startDate,jdbcType=VARCHAR},'%Y-%c-%d')
|
|
|
+ and t1.date_create < date_format(#{order.endDate,jdbcType=VARCHAR},'%Y-%c-%d')
|
|
|
+ <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>
|
|
|
+ ) a
|
|
|
+ </select>
|
|
|
</mapper>
|