liulingling.177216
2024-08-26 349f1cfc5fa77fbc636d542df0d8050fddec48c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?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.dingzhuo.energy.project.benchmarking.mapper.PhaseBenchmarkingMapper">
    
    <resultMap type="com.dingzhuo.energy.project.benchmarking.domain.BenchmarkingManagement" id="PhaseBenchmarkingResult">
        <result property="indexId"    column="index_id"    />
        <result property="indexName"    column="index_name"    />
        <result property="indexCode"    column="index_code"    />
        <result property="unitId"    column="unit_id"    />
        <result property="timeType"    column="time_type"    />
        <result property="dateTime"    column="date_time"    />
        <result property="value"    column="value"    />
        <result property="timeCode"    column="time_code"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="actualValue"    column="actual_value"    />
        <result column="begin_time" property="beginTime"/>
        <result column="end_time" property="endTime"/>
    </resultMap>
 
    <sql id="selectPhaseBenchmarkingVo">
        SELECT
            e.index_id,
            e.name as index_name,
            e.code as index_code,
            e.unit_id,
            bm.time_type,
            bm.date_time,
            bm."value",
            bm.time_code,
            bm.actual_value
        FROM
            energy_index e
            LEFT JOIN benchmarking_management bm ON bm.index_id = e.index_id
    </sql>
 
    <select id="selectPhaseBenchmarkingList" parameterType="com.dingzhuo.energy.project.benchmarking.domain.BenchmarkingManagement" resultMap="PhaseBenchmarkingResult">
        <include refid="selectPhaseBenchmarkingVo"/>
        <where>
            e.index_id =#{indexId}
            AND bm.time_type = #{timeType}
            AND bm.date_time &gt;= #{beginTime}
            AND bm.date_time &lt;= #{endTime}
        </where>
    </select>
    <select id="selectRealTimeListrealTime" parameterType="com.dingzhuo.energy.project.benchmarking.domain.BenchmarkingManagement" resultMap="PhaseBenchmarkingResult">
        <include refid="selectPhaseBenchmarkingVo"/>
        <where>
            e.index_id in <foreach item="indexId" index="index" collection="indexIds"  open="(" separator="," close=")">#{indexId} </foreach>
            <if test="timeCode != null  and timeCode !=''"> AND bm.time_code = #{timeCode}</if>
        </where>
    </select>
</mapper>