Lius
2024-04-18 1b1233fae35e9e28dbec5934858bf438ee519951
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcHomeMapper.xml
@@ -47,6 +47,7 @@
    <select id="getUtilizationByMonth" resultType="java.util.Map">
        SELECT
            SUM(process_long) processLong,
            SUM(open_long) openLong,
            COUNT(*) processDay
        FROM
            mdc_equipment_statistical_info
@@ -61,4 +62,99 @@
        </where>
    </select>
    <select id="getEquipmentDayUtilizationStatistics" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
        SELECT
            the_date,
            SUM ( process_long ) processLong,
            SUM ( open_long ) openLong
        FROM
            mdc_equipment_statistical_info
        <where>
            <if test="equipmentIdList != null and equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
            <if test="dateList != null and dateList.size() > 0 ">
                AND the_date IN
                <foreach collection="dateList" index="index" item="date" open="(" separator="," close=")">
                    #{date}
                </foreach>
            </if>
        </where>
        GROUP BY
            the_date
    </select>
    <select id="getEquipmentOEEMonthStatistics" resultType="org.jeecg.modules.mdc.entity.MdcOverallEquipmentEfficiency">
        SELECT
            *
        FROM
            mdc_overall_equipment_efficiency
        <where>
            AND valid_date = #{validDate}
            <if test="equipmentIdList != null and equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
        </where>
    </select>
    <select id="getUtilizationByDay" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
        SELECT
            the_date,
            SUM ( process_long ) processLong,
            SUM ( open_long ) openLong
        FROM
            mdc_equipment_statistical_info
        <where>
            AND the_date = #{date}
            <if test="equipmentIdList != null and equipmentIdList.size() > 0 ">
                AND equipment_id IN
                <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
        </where>
        GROUP BY
            the_date
    </select>
    <select id="getEquipmentSevenUtilizationStatistics" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalInfoDto">
        SELECT
            t1.equipment_id,
            t2.equipment_name,
            SUM ( t1.process_long ) processLong,
            SUM ( t1.open_long ) openLong
        FROM
            mdc_equipment_statistical_info t1
            LEFT JOIN mdc_equipment t2 ON t1.equipment_id = t2.equipment_id
        <where>
            AND t1.the_date BETWEEN #{start} AND #{end}
            <if test="equipmentIdList != null and equipmentIdList.size() > 0 ">
                AND t1.equipment_id IN
                <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
                    #{id}
                </foreach>
            </if>
        </where>
        GROUP BY
            t1.equipment_id,t2.equipment_name
    </select>
    <select id="getEquipmentList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
        SELECT
            t1.*
        FROM
            mdc_equipment t1
                LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
        WHERE
            t2.production_id = #{productionId}
    </select>
</mapper>