DYL0109
2025-04-16 75f043dfa6660716364e66ee0b3cf99f44255686
zhitan-system/src/main/resources/mapper/peakvalley/ElectricityDataItemMapper.xml
@@ -27,5 +27,52 @@
        AND (data_time BETWEEN #{startTime} AND #{endTime})
        AND time_type = #{timeType}
    </select>
    <select id="getDataStatisticsDeviationAnalysis"
            resultType="com.zhitan.peakvalley.domain.ElectricityDataItem">
        SELECT
        index_code indexCode,
        time_code timeCode,
        electricity_type electricityType,
        data_time dataTime,
        electricity,
        "cost",
        time_type timeType,
        price,
        remark
        FROM
        "electricity_data_item"
        WHERE
        index_id IN
        <foreach collection="indexIdSet" item="indexId" open="(" separator="," close=")">
            #{indexId}
        </foreach>
        AND time_type = #{timeType}
    </select>
    <select id="getCostTrends"
            resultType="com.zhitan.peakvalley.domain.ElectricityDataItem">
        SELECT
        di.index_code,
        di.time_code,
        di.electricity_type,
        di.data_time,
        di.electricity,
        di.cost,
        di.time_type,
        di.price,
        di.remark
        FROM
        "electricity_data_item" di
        JOIN energy_index ei  ON di.index_id = ei.index_id
        WHERE
        di.index_id IN ( SELECT index_id FROM node_index WHERE node_id = #{nodeId})
        <if test="energyType !='' and energyType !=null  and energyType =='allType'">
            AND ei.energy_id != ''
        </if>
        <if test="energyType !='' and energyType !=null  and energyType !='allType'">
            AND  ei.energy_id = #{energyType}
        </if>
        AND (di.data_time BETWEEN #{beginTime} AND #{endTime})
        AND di.time_type = #{timeType}
    </select>
</mapper>