zhangherong
2025-05-06 665ffec07abac9fa14e7613fe1c73922a537ff77
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/EamReportRepairMapper.xml
@@ -46,6 +46,25 @@
                AND t1.fault_start_time BETWEEN #{ eamReportRepair.startTime } AND #{ eamReportRepair.endTime }
            </if>
        </where>
        ORDER BY t1.fault_start_time DESC
        ORDER BY t1.create_time DESC
    </select>
    <select id="equipmentRepairStatistics" resultType="org.jeecg.modules.eam.vo.EquipmentRepairStatistics">
        select FORMAT(err.create_time, 'yyyy-MM') as monthStr,
               COUNT(1) as reportNumber,
               SUM(CASE WHEN err.report_status = 'COMPLETE' THEN 1 ELSE 0 END) as repairedNumber
        from eam_report_repair err
        inner join eam_equipment e
        on err.equipment_id = e.id
        where err.report_status != 'ABOLISH' and err.del_flag = 0 and e.del_flag = 0
        <if test="productionIds != null">
            AND e.org_id IN
            <foreach collection="productionIds" item="productionId" index="index" open="(" close=")" separator=",">
                #{productionId}
            </foreach>
        </if>
        and err.create_time &gt;= #{start}
        and err.create_time &lt; #{end}
        group by FORMAT(err.create_time, 'yyyy-MM')
    </select>
</mapper>