You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
511 lines
24 KiB
XML
511 lines
24 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<!DOCTYPE mapper
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.op.device.mapper.DeviceInterfaceMapper">
|
|
|
|
<select id="selectEquRepairWorkOrderList" resultType="com.op.device.domain.vo.IRepairWorkOrderVO">
|
|
select be.equipment_name AS "equipmentName",
|
|
wo.equipment_code AS "equipmentCode",
|
|
wo.work_fault_desc AS "workFaultDesc",
|
|
et.team_name AS "teamName",
|
|
wo.work_handle AS "workHandle",
|
|
wo.work_plan_time AS "workPlanTime",
|
|
be.equipment_location AS "equipmentLocation"
|
|
from equ_repair_work_order wo
|
|
left join base_equipment be on wo.equipment_code = be.equipment_code
|
|
left join equ_team et on wo.work_team = et.team_code
|
|
where
|
|
-- wo.work_status = '0' AND
|
|
wo.del_flag = '0'
|
|
</select>
|
|
|
|
<select id="selectEquipmentList" parameterType="EquOperation" resultType="com.op.device.domain.vo.IEquipmentVO">
|
|
select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName',be.equipment_status AS
|
|
'equipmentStatus',be.department AS
|
|
'department',(SELECT ROUND(
|
|
SUM(CAST(fault_time AS FLOAT)) /
|
|
SUM(CAST(actual_operation_time AS FLOAT)),
|
|
2)
|
|
FROM equ_operation
|
|
WHERE equipment_code = be.equipment_code) AS 'failureRate', (
|
|
SELECT ROUND(SUM(mrw.quantity_feedback) / SUM(mrw.quantity), 2)
|
|
FROM mes_report_work mrw
|
|
WHERE mrw.del_flag = '0'
|
|
AND mrw.status = 'PREPARE'
|
|
AND mrw.machine_code = be.equipment_code
|
|
<if test="timeDimension == 'dd' ">AND mrw.feedback_time >= DATEADD(DAY, -1, GETDATE())</if>
|
|
<if test="timeDimension == 'mm' ">AND mrw.feedback_time >= DATEADD(MONTH, -1, GETDATE())</if>
|
|
<if test="timeDimension == 'yyyy' ">AND mrw.feedback_time >= DATEADD(YEAR, -1, GETDATE())</if>
|
|
) AS 'utilizationRatio'
|
|
from base_equipment be
|
|
where be.del_flag = '0'
|
|
and be.equipment_category = '0'
|
|
</select>
|
|
|
|
<select id="selectEquipmentVOList" parameterType="EquOperation" resultType="com.op.device.domain.vo.IEquipmentVO">
|
|
SELECT
|
|
be.equipment_code AS 'equipmentCode',
|
|
be.equipment_name AS 'equipmentName',
|
|
be.equipment_status AS 'equipmentStatus',
|
|
be.department AS 'department',
|
|
ROUND(SUM(CAST(eo.fault_time AS FLOAT)) * 100 / SUM(CAST(eo.operation_time AS FLOAT)),2) AS 'failureRate',
|
|
CAST(SUM(CAST(eo.actual_operation_time AS DECIMAL(10,2)))*100/(COUNT(eo.actual_operation_time)*24) AS DECIMAL(18,2)) AS 'utilizationRatio'
|
|
FROM equ_operation eo
|
|
LEFT JOIN base_equipment be ON eo.equipment_code = be.equipment_code
|
|
<where>
|
|
<if test="timeDimension == 'dd' ">and convert(char(10),eo.create_time,120) = convert(char(10),getdate(),120)</if>
|
|
<if test="timeDimension == 'mm' ">and month(eo.create_time) = month(getdate())</if>
|
|
<if test="timeDimension == 'yyyy' ">and year(eo.create_time) = year(getdate())</if>
|
|
<if test="startTime != null and endTime != null ">and eo.create_time between #{startTime} and #{endTime} </if>
|
|
AND eo.del_flag = '0'
|
|
AND be.del_flag = '0'
|
|
AND be.equipment_category = '0'
|
|
</where>
|
|
GROUP BY be.equipment_code,be.equipment_name,be.equipment_status,be.department
|
|
ORDER BY failureRate DESC
|
|
</select>
|
|
|
|
<select id="selectRepairEquipmentList" resultType="com.op.device.domain.vo.IEquipmentVO">
|
|
select be.equipment_code AS 'equipmentCode', be.equipment_name AS 'equipmentName'
|
|
from base_equipment be
|
|
where be.equipment_code in (select wo.equipment_code
|
|
from equ_repair_work_order wo
|
|
where wo.del_flag = '0'
|
|
and wo.work_status = '1'
|
|
GROUP BY wo.equipment_code)
|
|
</select>
|
|
|
|
<select id="selectReportWorkByEquipmentCode" resultType="com.op.device.domain.MesReportWork">
|
|
select SUM(mrw.quantity) AS "quantity",
|
|
SUM(mrw.quantity_feedback) AS "quantityFeedback"
|
|
from mes_report_work mrw
|
|
where mrw.del_flag = '0'
|
|
and mrw.status = 'PREPARE'
|
|
and mrw.machine_code = #{equipmentCode}
|
|
and mrw.feedback_time >= DATEADD(MONTH, -1, GETDATE())
|
|
</select>
|
|
|
|
<select id="selectRepairRecordByEquipmentCode" resultType="com.op.device.domain.EquRepairWorkOrder">
|
|
select wo.work_start_time AS "workStartTime", wo.work_end_time AS "workEndTime"
|
|
from equ_repair_work_order wo
|
|
where wo.del_flag = '0'
|
|
and wo.equipment_code = #{equipmentCode}
|
|
and wo.work_status = '1'
|
|
</select>
|
|
|
|
<select id="getDeviceRefreshTime" resultType="java.lang.String">
|
|
select dict_value
|
|
from sys_dict_data
|
|
where dict_label = 'device_refresh_time'
|
|
</select>
|
|
|
|
<!--设备稳定性 MTBF 年月日-->
|
|
<select id="getMTBFList" parameterType="EquOperation" resultType="com.op.device.domain.EquOperation">
|
|
select
|
|
row_number() over (order by cast(
|
|
case
|
|
when sum(eo.shutdown_times) > 0 THEN sum(cast(eo.actual_operation_time as decimal(18,2)))/sum(eo.shutdown_times)
|
|
else 0
|
|
end
|
|
as decimal(18,2)) desc) as serialNumber,
|
|
eo.equipment_code as equipmentCode,
|
|
eo.equipment_name as equipmentName,
|
|
cast(
|
|
case
|
|
when sum(eo.shutdown_times) > 0 THEN sum(cast(eo.actual_operation_time as decimal(18,2)))/sum(eo.shutdown_times)
|
|
else 0
|
|
end
|
|
as decimal(18,2))as mtbf
|
|
from equ_operation eo
|
|
<where>
|
|
<if test="timeDimension == 'dd' ">and convert(char(10),eo.create_time,120) = convert(char(10),getdate(),120)</if>
|
|
<if test="timeDimension == 'mm' ">and month(eo.create_time) = month(getdate())</if>
|
|
<if test="timeDimension == 'yyyy' ">and year(eo.create_time) = year(getdate())</if>
|
|
<if test="startTime != null and endTime != null ">and eo.create_time between #{startTime} and #{endTime} </if>
|
|
</where>
|
|
GROUP BY equipment_code,equipment_name
|
|
</select>
|
|
|
|
<!--设备维修质量 MTTR 年月日-->
|
|
<select id="getMTTRList" parameterType="EquOperation" resultType="com.op.device.domain.EquOperation">
|
|
select
|
|
row_number() over (order by cast(
|
|
case
|
|
when sum(eo.shutdown_times) > 0 THEN sum(cast(eo.fault_time as decimal(18,2)))/sum(eo.shutdown_times)
|
|
else 0
|
|
end
|
|
as decimal(18,2)) desc) as serialNumber,
|
|
eo.equipment_code as equipmentCode,
|
|
eo.equipment_name as equipmentName,
|
|
cast(
|
|
case
|
|
when sum(eo.shutdown_times) > 0 THEN sum(cast(eo.fault_time as decimal(18,2)))/sum(eo.shutdown_times)
|
|
else 0
|
|
end
|
|
as decimal(18,2))as mttr
|
|
from equ_operation eo
|
|
<where>
|
|
<if test="timeDimension == 'dd' ">and convert(char(10),eo.create_time,120) = convert(char(10),getdate(),120)</if>
|
|
<if test="timeDimension == 'mm' ">and month(eo.create_time) = month(getdate())</if>
|
|
<if test="timeDimension == 'yyyy' ">and year(eo.create_time) = year(getdate())</if>
|
|
<if test="startTime != null and endTime != null ">and eo.create_time between #{startTime} and #{endTime} </if>
|
|
</where>
|
|
group by equipment_code,equipment_name
|
|
</select>
|
|
|
|
<!--完好设备占比-->
|
|
<select id="getEquipmentIntactRate" parameterType="EquOperation" resultType="com.op.device.domain.EquOperation">
|
|
select
|
|
case when (sum(cast(eo.fault_time as decimal(18,2)))/sum(cast(eo.operation_time as decimal(18,2)))) > 0.04 then 1 else 0 end as faultEquipment
|
|
from equ_operation eo
|
|
<where>
|
|
<if test="timeDimension == 'dd' ">and convert(char(10),eo.create_time,120) = convert(char(10),getdate(),120)</if>
|
|
<if test="timeDimension == 'mm' ">and month(eo.create_time) = month(getdate())</if>
|
|
<if test="timeDimension == 'yyyy' ">and year(eo.create_time) = year(getdate())</if>
|
|
<if test="startTime != null and endTime != null ">and eo.create_time between #{startTime} and #{endTime} </if>
|
|
</where>
|
|
group by eo.equipment_code,eo.equipment_name
|
|
</select>
|
|
|
|
<!--设备总数-->
|
|
<select id="getTotalEquipment" resultType="java.lang.String">
|
|
select count(1)
|
|
from base_equipment be
|
|
where be.del_flag = '0'
|
|
and be.status = '1'
|
|
</select>
|
|
|
|
<select id="selectGroups" resultType="com.op.device.domain.vo.IEquFaultVO">
|
|
select be.equipment_code AS 'code', be.equipment_name AS 'name'
|
|
from base_equipment be
|
|
where be.del_flag = '0'
|
|
and be.equipment_category = '1'
|
|
</select>
|
|
|
|
<select id="selectEquipmentFaultNumForMonth" resultType="java.util.Map">
|
|
SELECT MONTH (eo.create_time) AS 'month', COUNT (eo.create_time) AS 'count'
|
|
FROM equ_operation eo
|
|
WHERE YEAR (eo.create_time) = YEAR (GETDATE())
|
|
and eo.failure_rate != '0%'
|
|
and eo.equipment_code in (
|
|
select bae.auxiliary_equipment_code from equ_bind_auxiliary_equipment bae where bae.equipment_code = #{groupCode}
|
|
)
|
|
GROUP BY MONTH (eo.create_time)
|
|
ORDER BY MONTH (eo.create_time)
|
|
</select>
|
|
|
|
<select id="selectSumEquipmentOperation" resultType="java.util.Map">
|
|
SELECT
|
|
SUM(CAST(actual_operation_time AS FLOAT)) AS actualOperationTime,
|
|
SUM(CAST(fault_time AS FLOAT)) AS faultTime
|
|
FROM equ_operation
|
|
WHERE equipment_code = #{equipmentCode};
|
|
</select>
|
|
|
|
<select id="getCompletionRate" resultType="com.op.device.domain.vo.EquipmentBoardVO">
|
|
SELECT
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type = 'maintenance'
|
|
AND del_flag = '0'
|
|
AND YEAR(create_time) = YEAR(GETDATE())
|
|
AND MONTH(create_time) = MONTH(GETDATE())) as maintenanceTotal,
|
|
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type = 'maintenance'
|
|
AND del_flag = '0'
|
|
AND order_status = '0'
|
|
AND YEAR(create_time) = YEAR(GETDATE())
|
|
AND MONTH(create_time) = MONTH(GETDATE())) as maintenancePendCheck,
|
|
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type = 'inspection'
|
|
AND del_flag = '0'
|
|
AND order_status = '1'
|
|
AND YEAR(create_time) = YEAR(GETDATE())
|
|
AND MONTH(create_time) = MONTH(GETDATE())) as maintenanceFinish,
|
|
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type = 'inspection'
|
|
AND del_flag = '0'
|
|
AND YEAR(create_time) = YEAR(GETDATE())
|
|
AND MONTH(create_time) = MONTH(GETDATE())) as inspectionTotal,
|
|
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type = 'inspection'
|
|
AND del_flag = '0'
|
|
AND order_status = '0'
|
|
AND YEAR(create_time) = YEAR(GETDATE())
|
|
AND MONTH(create_time) = MONTH(GETDATE())) as inspectionPendCheck,
|
|
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type = 'inspection'
|
|
AND del_flag = '0'
|
|
AND order_status = '1'
|
|
AND YEAR(create_time) = YEAR(GETDATE())
|
|
AND MONTH(create_time) = MONTH(GETDATE())) as inspectionFinish,
|
|
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type ='spotInspection'
|
|
AND del_flag = '0'
|
|
AND CAST(create_time AS DATE) = CAST(GETDATE() AS DATE)) as spotInspectionTotal,
|
|
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type ='spotInspection'
|
|
AND del_flag = '0'
|
|
AND order_status = '0'
|
|
AND CAST(create_time AS DATE) = CAST(GETDATE() AS DATE)) as spotInspectionPendCheck,
|
|
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_order
|
|
WHERE plan_type ='spotInspection'
|
|
AND del_flag = '0'
|
|
AND order_status = '1'
|
|
AND CAST(create_time AS DATE) = CAST(GETDATE() AS DATE)) as spotInspectionFinish,
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_repair_work_order
|
|
WHERE
|
|
del_flag = '0'
|
|
AND CAST(create_time AS DATE) = CAST(GETDATE() AS DATE)) as repairTotal,
|
|
(SELECT COUNT(order_id)
|
|
FROM equ_repair_work_order
|
|
WHERE
|
|
del_flag = '0'
|
|
AND work_status = '1'
|
|
AND CAST(create_time AS DATE) = CAST(GETDATE() AS DATE)) as repairFinish
|
|
FROM (SELECT 1 AS DUMMY) AS T;
|
|
</select>
|
|
|
|
<select id="selectEquRepairWorkOrderDetail" resultType="com.op.device.domain.vo.EquRepairWorkOrderDetailVO">
|
|
select
|
|
erwo.work_id as workId,
|
|
erwo.order_id as orderId,
|
|
erwo.order_code as orderCode,
|
|
erwo.work_code as workCode,
|
|
erwo.work_handle as workHandle,
|
|
erwo.work_plan_time as workPlanTime,
|
|
erwo.work_plan_down_time as workPlanDownTime,
|
|
erwo.order_relevance as orderRelevance,
|
|
erwo.work_person as workPerson,
|
|
erwo.work_person_name as workPersonName,
|
|
erwo.work_team as workTeam,
|
|
erwo.work_outsource as workOutsource,
|
|
erwo.work_down_machine as workDownMachine,
|
|
erwo.equipment_code as equipmentCode,
|
|
erwo.work_reason as workReason,
|
|
erwo.work_fault_desc as workFaultDesc,
|
|
erwo.work_start_time as workStartTime,
|
|
erwo.work_end_time as workEndTime,
|
|
erwo.actual_down_start_time as actualDownStartTime,
|
|
erwo.actual_down_end_time as actualDownEndTime,
|
|
erwo.work_connection as workConnection,
|
|
erwo.work_cost_time as workCostTime,
|
|
erwo.work_cost as workCost,
|
|
erwo.work_status as workStatus,
|
|
erwo.out_work_id as outWorkId,
|
|
erwo.out_work_code as outWorkCode,
|
|
erwo.attr1 as attr1,
|
|
erwo.attr2 as attr2,
|
|
erwo.attr3 as attr3,
|
|
erwo.create_by as createBy,
|
|
erwo.create_time as createTime,
|
|
erwo.update_time as updateTime,
|
|
erwo.update_by as updateBy,
|
|
erwo.del_flag as delFlag,
|
|
erwo.factory_code as factoryCode,
|
|
erwo.fault_type as faultType,
|
|
erwo.equipment_status_description as equipmentStatusDescription,
|
|
erwo.repair_measures as repairMeasures,
|
|
erwo.fault_down_time as faultDownTime,
|
|
erwo.fault_start_time as faultStartTime,
|
|
erwo.result_inspect as resultInspect,
|
|
erwo.remark as remark,
|
|
erwo.audit_opinion as auditOpinion,
|
|
be.equipment_name as equipmentName,
|
|
et.team_name as teamName,
|
|
et.team_person as teamPerson
|
|
from equ_repair_work_order erwo
|
|
left join base_equipment be on erwo.equipment_code = be.equipment_code
|
|
left join equ_team et on erwo.work_team = et.team_code
|
|
<where>
|
|
and erwo.del_flag = '0'
|
|
<if test="timeDimension == 'dd' ">and convert(char(10),erwo.create_time,120) = convert(char(10),getdate(),120)</if>
|
|
<if test="timeDimension == 'mm' ">and month(erwo.create_time) = month(getdate())</if>
|
|
<if test="timeDimension == 'yyyy' ">and year(erwo.create_time) = year(getdate())</if>
|
|
<if test="equipmentCode != null and equipmentCode != ''">and erwo.equipment_code like concat('%',#{equipmentCode}, '%')</if>
|
|
<if test="equipmentName != null and equipmentName != ''">and be.equipment_name like concat('%',#{equipmentName}, '%')</if>
|
|
<if test="workStatus != null and workStatus != ''">and erwo.work_status = #{workStatus}</if>
|
|
</where>
|
|
ORDER BY erwo.create_time DESC
|
|
</select>
|
|
|
|
<select id="selectEquOrderList" resultType="com.op.device.domain.vo.EquOrderVO">
|
|
select
|
|
eo.order_id as orderId,
|
|
eo.plan_id as planId,
|
|
eo.plan_code as planCode,
|
|
eo.plan_type as planType,
|
|
eo.order_code as orderCode,
|
|
eo.plan_workshop as planWorkshop,
|
|
eo.plan_prod_line as planProdLine,
|
|
eo.plan_loop as planLoop,
|
|
eo.plan_loop_type as planLoopType,
|
|
eo.plan_loop_start as planLoopStart,
|
|
eo.plan_loop_end as planLoopEnd,
|
|
eo.order_start as orderStart,
|
|
eo.order_end as orderEnd,
|
|
eo.equipment_code as equipmentCode,
|
|
eo.order_status as orderStatus,
|
|
eo.order_cost as orderCost,
|
|
eo.plan_person as planPerson,
|
|
eo.plan_person_name as planPersonName,
|
|
eo.order_cost_time as orderCostTime,
|
|
eo.order_sign_person as orderSignPerson,
|
|
eo.factory_code as factoryCode,
|
|
eo.attr1 as attr1,
|
|
eo.attr2 as attr2,
|
|
eo.attr3 as attr3,
|
|
eo.del_flag as delFlag,
|
|
eo.create_by as createBy,
|
|
eo.create_time as createTime,
|
|
eo.update_by as updateBy,
|
|
eo.update_time as updateTime,
|
|
eo.upkeep as upkeep,
|
|
eo.calculation_rule as calculationRule,
|
|
eo.shut_down,
|
|
eo.order_inspect as orderInspect,
|
|
eo.repair_code as repairCode,
|
|
eo.work_code as workCode,
|
|
eo.outsource_code as outsourceCode,
|
|
eo.compliance_rate as complianceRate,
|
|
be.equipment_name as equipmentName,
|
|
ep.plan_name as planName
|
|
from equ_order eo
|
|
left join base_equipment be on be.equipment_code = eo.equipment_code
|
|
left join equ_plan ep on ep.plan_code = eo.plan_code
|
|
<where>
|
|
and eo.del_flag = '0' and be.del_flag = '0' and ep.del_flag = '0'
|
|
<if test="timeDimension == 'dd' ">and convert(char(10),eo.create_time,120) = convert(char(10),getdate(),120)</if>
|
|
<if test="timeDimension == 'mm' ">and month(eo.create_time) = month(getdate())</if>
|
|
<if test="timeDimension == 'yyyy' ">and year(eo.create_time) = year(getdate())</if>
|
|
<if test="createTime != null and createTime != null ">and convert(char(10),eo.create_time,120) = convert(char(10),#{createTime},120)</if>
|
|
|
|
<if test="planId != null and planId != ''">and eo.plan_id = #{planId}</if>
|
|
<if test="planCode != null and planCode != ''">and eo.plan_code like concat('%', #{planCode}, '%')</if>
|
|
<if test="planType != null and planType != ''">and eo.plan_type = #{planType}</if>
|
|
<if test="orderCode != null and orderCode != ''">and eo.order_code like concat('%', #{orderCode}, '%')</if>
|
|
<if test="planWorkshop != null and planWorkshop != ''">and eo.plan_workshop = #{planWorkshop}</if>
|
|
<if test="planProdLine != null and planProdLine != ''">and eo.plan_prod_line like concat('%', #{planProdLine}, '%')</if>
|
|
<if test="planLoop != null and planLoop != ''">and eo.plan_loop = #{planLoop}</if>
|
|
<if test="planLoopType != null and planLoopType != ''">and eo.plan_loop_type = #{planLoopType}</if>
|
|
<if test="equipmentCode != null and equipmentCode != ''">and eo.equipment_code like concat('%',#{equipmentCode}, '%')</if>
|
|
<if test="equipmentName != null and equipmentName != ''">and be.equipment_name like concat('%',#{equipmentName}, '%')</if>
|
|
<if test="planLoopStart != null ">and eo.plan_loop_start = #{planLoopStart}</if>
|
|
<if test="planLoopEnd != null ">and eo.plan_loop_end = #{planLoopEnd}</if>
|
|
<if test="orderStart != null ">and CONVERT(date,eo.order_start) = #{orderStart}</if>
|
|
<if test="orderEnd != null ">and eo.order_end = #{ord5erEnd}</if>
|
|
<if test="orderStatus != null and orderStatus != ''">and eo.order_status = #{orderStatus}</if>
|
|
<if test="orderCost != null ">and eo.order_cost = #{orderCost}</if>
|
|
<if test="planPerson != null and planPerson != ''">and eo.plan_person like concat('%', #{planPerson}, '%')</if>
|
|
<if test="planPersonName != null and planPersonName != ''">and eo.plan_person_name like concat('%', #{planPersonName}, '%')</if>
|
|
<if test="orderCostTime != null and orderCostTime != ''">and eo.order_cost_time = #{orderCostTime}</if>
|
|
<if test="orderSignPerson != null and orderSignPerson != ''">and eo.order_sign_person = #{orderSignPerson}</if>
|
|
<if test="factoryCode != null and factoryCode != ''">and eo.factory_code = #{factoryCode}</if>
|
|
<if test="attr1 != null and attr1 != ''">and eo.attr1 = #{attr1}</if>
|
|
<if test="attr2 != null and attr2 != ''">and eo.attr2 = #{attr2}</if>
|
|
<if test="attr3 != null and attr3 != ''">and eo.attr3 = #{attr3}</if>
|
|
<if test="delFlag != null and delFlag != ''">and eo.del_flag = #{delFlag}</if>
|
|
<if test="createBy != null and createBy != ''">and eo.create_by like concat('%', #{createBy}, '%')</if>
|
|
<if test="createTimeStart != null ">and CONVERT(date,eo.create_time) >= #{createTimeStart}</if>
|
|
<if test="createTimeEnd != null ">and #{createTimeEnd} >= CONVERT(date,eo.create_time)</if>
|
|
<if test="updateBy != null and updateBy != ''">and eo.update_by like concat('%', #{updateBy}, '%')</if>
|
|
<if test="updateTime != null ">and CONVERT(date,eo.update_time) = #{updateTime}</if>
|
|
<if test="upkeep != null ">and eo.upkeep = #{upkeep}</if>
|
|
<if test="calculationRule != null ">and eo.calculation_rule = #{calculationRule}</if>
|
|
<if test="shutDown != null ">and eo.shut_down = #{shutDown}</if>
|
|
<if test="orderInspect != null ">and eo.order_inspect = #{orderInspect}</if>
|
|
<if test="repairCode != null ">and eo.repair_code = #{repairCode}</if>
|
|
<if test="outsourceCode != null ">and eo.outsource_code = #{outsourceCode}</if>
|
|
<if test="workCode != null ">and eo.work_code = #{workCode}</if>
|
|
<if test="loopStart != null ">and CONVERT(date,eo.plan_loop_start) >= #{loopStart}</if>
|
|
<if test="loopEnd != null ">and #{loopEnd} >= CONVERT(date,eo.plan_loop_start)</if>
|
|
<if test="loopEndArrayStart != null ">and CONVERT(date,eo.plan_loop_end) >= #{loopEndArrayStart}</if>
|
|
<if test="getLoopEndArrayEnd != null ">and #{getLoopEndArrayEnd} >= CONVERT(date,eo.plan_loop_end)</if>
|
|
<if test="orderStartArrayStart != null ">and CONVERT(date,eo.order_start) >= #{orderStartArrayStart}</if>
|
|
<if test="orderStartArrayEnd != null ">and #{orderStartArrayEnd} >= CONVERT(date,eo.order_start)</if>
|
|
<if test="orderEndArrayStart != null ">and CONVERT(date,eo.order_end) >= #{orderEndArrayStart}</if>
|
|
<if test="orderEndArrayEnd != null ">and #{orderEndArrayEnd} >= CONVERT(date,eo.order_end)</if>
|
|
<if test="planName != null and planName != ''">and ep.plan_name like concat('%', #{planName}, '%')</if>
|
|
<if test="equipmentTypeCode != null and equipmentTypeCode != ''">and be.equipment_type_code like concat('%',#{equipmentTypeCode}, '%')</if>
|
|
</where>
|
|
order by eo.create_time desc
|
|
</select>
|
|
<select id="getworkFaultReason" resultType="java.util.Map">
|
|
SELECT
|
|
CASE
|
|
WHEN work_reason IN ('', '无') THEN '空' -- 处理空字符串和'无'
|
|
ELSE work_reason
|
|
END AS name,
|
|
CAST(COUNT(*) * 100.0 / SUM(COUNT(*)) OVER() AS DECIMAL(5,2)) AS value
|
|
FROM equ_repair_work_order
|
|
WHERE
|
|
work_reason IS NOT NULL -- 排除 NULL 值
|
|
AND work_reason != '无' -- 排除'无'的描述
|
|
AND del_flag = '0'
|
|
GROUP BY
|
|
CASE
|
|
WHEN work_reason IN ('', '无') THEN '空'
|
|
ELSE work_reason
|
|
END
|
|
ORDER BY value DESC;
|
|
|
|
|
|
</select>
|
|
<select id="getworkFaultDesc" resultType="java.util.Map">
|
|
SELECT TOP(8)
|
|
CASE
|
|
WHEN work_fault_desc IN ('', '无') THEN '空' -- 处理空字符串和'无'
|
|
ELSE work_fault_desc
|
|
END AS name,
|
|
|
|
COUNT(*) AS value
|
|
FROM equ_repair_work_order
|
|
WHERE
|
|
work_fault_desc IS NOT NULL -- 排除 NULL 值
|
|
AND work_fault_desc != '无' -- 排除'无'的描述
|
|
AND del_flag = '0'
|
|
GROUP BY
|
|
CASE
|
|
WHEN work_fault_desc IN ('', '无') THEN '空'
|
|
ELSE work_fault_desc
|
|
END
|
|
ORDER BY value DESC;
|
|
</select>
|
|
<select id="getWave" resultType="java.util.Map">
|
|
SELECT
|
|
COUNT(*) AS total,
|
|
SUM(CASE WHEN work_status = '1' THEN 1 ELSE 0 END) AS number,
|
|
|
|
COALESCE(
|
|
CAST( -- 显式转换浮点类型
|
|
ROUND(
|
|
(SUM(CASE WHEN work_status = '1' THEN 1.0 ELSE 0 END) * 100)
|
|
/ NULLIF(COUNT(*), 0),
|
|
0)
|
|
AS INT), -- 强制保留整数
|
|
0)
|
|
AS ratio
|
|
FROM equ_repair_work_order
|
|
WHERE del_flag = '0';
|
|
</select>
|
|
|
|
</mapper>
|