yangbin
2025-02-20 ec077979f2d55b2a54e893085f4b845b729e69c3
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentStatisticalInfoMapper.xml
@@ -1,5 +1,73 @@
<?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="org.jeecg.modules.mdc.mapper.EquipmentStatisticalInfoMapper">
    <select id="findDataRankingForBigScreen" resultType="org.jeecg.modules.mdc.subcontrol.vo.LastWeekDataVo">
        SELECT
        equipment_id equipment,
        SUM( open_long ) openingLong,
        SUM( close_long ) closelong,
        SUM( wait_long ) waitlong,
        SUM( process_long ) processingLong,
        SUM( error_long ) errorlong
        FROM
        mdc_equipment_statistical_info
        <where>
            <if test="equipmentIdList != null and equipmentIdList.size() > 0">
                AND equipment_id IN
                <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            AND the_date &gt;= #{ monday }
            AND the_date &lt;= #{ saturday }
        </where>
        GROUP BY
        equipment_id;
    </select>
    <select id="findDataForBigScreen" resultType="org.jeecg.modules.mdc.subcontrol.vo.LastWeekDataVo">
        SELECT
        the_date thedate,
        SUM( open_long ) openingLong,
        SUM( close_long ) closelong,
        SUM( wait_long ) waitlong,
        SUM( process_long ) processingLong,
        SUM( error_long ) errorlong
        FROM
        mdc_equipment_statistical_info
        <where>
            <if test="equipmentIdList != null and equipmentIdList.size() > 0">
                AND equipment_id IN
                <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            AND the_date &gt;= #{ monday }
            AND the_date &lt;= #{ saturday }
        </where>
        GROUP BY
        the_date
        ORDER BY
        the_date ASC;
    </select>
    <select id="findEquipmentId" resultType="java.lang.String">
        SELECT DISTINCT
        equipment_id equipment
        FROM
        mdc_equipment_statistical_info
        <where>
            <if test="equipmentIdList != null and equipmentIdList.size() > 0">
                AND equipment_id IN
                <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                    #{ id }
                </foreach>
            </if>
            <if test="date != null and date != ''">
                AND the_date = #{ date }
            </if>
        </where>
    </select>
</mapper>