From 75f043dfa6660716364e66ee0b3cf99f44255686 Mon Sep 17 00:00:00 2001 From: DYL0109 <dn18191638832@163.com> Date: 星期三, 16 四月 2025 19:20:36 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/develop1.0' into dyl_dev --- zhitan-system/src/main/resources/mapper/comprehensivestatistics/YearComprehensiveMapper.xml | 83 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 83 insertions(+), 0 deletions(-) diff --git a/zhitan-system/src/main/resources/mapper/comprehensivestatistics/YearComprehensiveMapper.xml b/zhitan-system/src/main/resources/mapper/comprehensivestatistics/YearComprehensiveMapper.xml new file mode 100644 index 0000000..7aabc8e --- /dev/null +++ b/zhitan-system/src/main/resources/mapper/comprehensivestatistics/YearComprehensiveMapper.xml @@ -0,0 +1,83 @@ +<?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.zhitan.comprehensivestatistics.mapper.YearComprehensiveMapper"> + <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.YearComperhensive"> + <result column="index_id" property="indexId"/> + <result column="index_name" property="indexName"/> + <result column="time_type" property="timeType"/> + <result column="time_code" property="timeCode"/> + <result column="unit_id" property="unitId"/> + <result column="value1" property="value1"/> + <result column="value2" property="value2"/> + <result column="value3" property="value3"/> + <result column="value4" property="value4"/> + <result column="value5" property="value5"/> + <result column="value6" property="value6"/> + <result column="value7" property="value7"/> + <result column="value8" property="value8"/> + <result column="value9" property="value9"/> + <result column="value10" property="value10"/> + <result column="value11" property="value11"/> + <result column="value12" property="value12"/> + </resultMap> + <!--鍏ㄥ巶鑳借�楃粺璁�--> + <select id="getYearComprehensiveList" resultMap="dataItemMap"> + SELECT + aa.index_id, + aa.index_name, + aa.unit_id, + <foreach item="item" index="index" collection="dataList"> + COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value}, + </foreach> + aa.time_type, + aa.order_num orderNum + FROM + ( + SELECT + ni.index_id, + ei."name" AS "index_name", + ei.unit_id, + di."value", + di.data_time, + di.time_type, + mn.order_num + FROM + model_node mn + LEFT JOIN node_index ni ON ni.node_id = mn.node_id + LEFT JOIN energy_index ei ON ei.index_id = ni.index_id + LEFT JOIN data_item di ON ni.index_id = di.index_id + WHERE + mn.parent_id = #{nodeId} + AND di.data_time >= #{beginTime} + AND di.data_time <= #{endTime} + AND di.time_type = #{timeType} + <if test="indexStorageId !='' and indexStorageId !=null"> + and ei.energy_id=#{indexStorageId} + </if> + ) aa + GROUP BY aa.index_id, aa.index_name, aa.unit_id, aa.time_type, aa.order_num + ORDER BY aa.order_num ASC + </select> + + <select id="getListChart" resultMap="dataItemMap"> + SELECT + di.index_id, + ci.name AS "index_name", + ci.unit_id, + di."value", + di.data_time, + di.time_type, + di.time_code + FROM + data_item di LEFT JOIN energy_index ci ON di.index_id = ci.index_id + WHERE + di.index_id =#{indexId} + AND di.data_time < #{endTime} + AND di.data_time >= #{beginTime} + AND di.time_type = #{timeType} + ORDER BY + di.time_code; + </select> +</mapper> -- Gitblit v1.9.3