ÎļþÃû´Ó zhitan-system/target/classes/mapper/comprehensivestatistics/DailyComprehensiveMapper.xml ÐÞ¸Ä |
| | |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zhitan.comprehensivestatistics.mapper.DailyComprehensiveMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.DailyComprehensive"> |
| | | <mapper namespace="com.zhitan.comprehensivestatistics.mapper.MonthlyComprehensiveMapper"> |
| | | <resultMap id="dataItemMap" type="com.zhitan.comprehensivestatistics.domain.MonthlyComprehensive"> |
| | | <result column="index_id" property="indexId"/> |
| | | <result column="index_name" property="indexName"/> |
| | | <result column="time_type" property="timeType"/> |
| | |
| | | <result column="value21" property="value21"/> |
| | | <result column="value22" property="value22"/> |
| | | <result column="value23" property="value23"/> |
| | | <result column="value0" property="value0"/> |
| | | <result column="value24" property="value24"/> |
| | | <result column="value25" property="value25"/> |
| | | <result column="value26" property="value26"/> |
| | | <result column="value27" property="value27"/> |
| | | <result column="value28" property="value28"/> |
| | | <result column="value29" property="value29"/> |
| | | <result column="value30" property="value30"/> |
| | | <result column="value31" property="value31"/> |
| | | </resultMap> |
| | | <!--å
¨åè½èç»è®¡--> |
| | | <select id="getdailyComprehensiveList" resultMap="dataItemMap"> |
| | | <select id="getMonthlyComprehensiveList" resultMap="dataItemMap"> |
| | | SELECT |
| | | aa.index_id, |
| | | aa.index_name, |
| | | <foreach item="item" index="index" collection="dataList"> |
| | | COALESCE ( MAX ( CASE WHEN data_time = #{item.dataTime} THEN "value" END ), null ) AS ${item.value}, |
| | | </foreach> |
| | | <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", |
| | |
| | | WHERE |
| | | mn.parent_id = #{nodeId} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.data_time < #{endTime} |
| | | AND di.data_time <= #{endTime} |
| | | AND di.time_type = #{timeType} |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | <if test="indexStorageId !='' and indexStorageId !=null"> |
| | | and ei.energy_id=#{indexStorageId} |
| | | </if> |
| | | ) aa |
| | | GROUP BY |
| | | aa.index_id, aa.index_name, aa.time_type, aa.order_num |
| | | aa.index_id, aa.index_name, aa.time_type, aa.order_num |
| | | ORDER BY aa.order_num ASC |
| | | </select> |
| | | |
| | |
| | | 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 <= #{endTime} |
| | | AND di.data_time >= #{beginTime} |
| | | AND di.time_type = #{timeType} |
| | | ORDER BY data_time ASC |
| | | ORDER BY |
| | | di.time_code; |
| | | </select> |
| | | </mapper> |