guoshilong
2023-11-04 474ba1ebf60b9ffc28274437e75cab8a6c4663e9
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
56
57
58
59
60
61
62
63
64
65
<?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="cn.gistack.sm.jcsb.mapper.DbReportMapper">
 
 
    <select id="getPage" resultType="cn.gistack.sm.jcsb.vo.DbReportVO">
        SELECT sdr.*,acb."cd_nm" as stationName FROM SM_DB_REPORT sdr
        LEFT JOIN SJZT_MD."att_cd_base" acb ON sdr.reservoir_id =  acb."res_cd" and sdr.station_id = acb."cd"
        WHERE 1=1
        <if test="db.reservoirName != null and db.reservoirName !='' ">
            AND sdr.reservoir_name LIKE CONCAT('%',#{db.reservoirName},'%')
        </if>
        <if test="db.reservoirId != null and db.reservoirId !='' ">
            AND sdr.reservoir_id = #{db.reservoirId}
        </if>
        <if test="db.stationId != null and db.station !='' ">
            AND sdr.station_id = #{db.stationId}
        </if>
        <if test="db.startTime !=null and db.startTime !=''">
            AND DATE_FORMAT(sdr.record_time,'%Y-%m-%d') &gt;= #{db.startTime}
        </if>
        <if test="db.endTime !=null and db.endTime !=''">
            AND DATE_FORMAT(sdr.record_time,'%Y-%m-%d') &lt;= #{db.endTime}
        </if>
        ORDER BY sdr.create_time DESC
    </select>
    <select id="getDayList" resultType="cn.gistack.sm.jcsb.vo.DbReportVO">
 
    SELECT
        SDR.ID,SDR.RESERVOIR_NAME,
        SDR.RESERVOIR_ID,
        SDR.TYPE,
        SDR.STATION_ID,acb.stationName,
        DATE_FORMAT(sdr.record_time,'%Y-%m-%d') AS record_time,
        SDR.VAL,SDR.DE_VAL,SDR.DN_VAL,SDR.DU_VAL
    FROM SM_DB_REPORT SDR
        LEFT JOIN SJZT_MD."att_cd_base" acb    ON acb."res_cd" = sdr.reservoir_id and acb."cd" = SDR.station_id
        WHERE SDR.IS_DELETED = 0
    <if test="vo.type != null and vo.type != ''">
        AND SDR.TYPE = #{vo.type}
    </if>
    <if test="db.startTime !=null and db.startTime !=''">
        AND DATE_FORMAT(sdr.record_time,'%Y-%m-%d') &gt;= #{db.startTime}
    </if>
    <if test="db.endTime !=null and db.endTime !=''">
        AND DATE_FORMAT(sdr.record_time,'%Y-%m-%d') &lt;= #{db.endTime}
    </if>
        <if test="vo.ch != null and vo.ch != ''">
            AND acb."ch" = #{vo.ch}
        </if>
 
 
    </select>
    <select id="getRecordTimeData" resultType="cn.gistack.sm.jcsb.entity.DbReport">
 
        SELECT * FROM SM_DB_REPORT
        WHERE
            is_deleted = 0
            AND RESERVOIR_ID = #{entity.reservoirId}
            AND type = #{entity.type}
            AND station_id = #{entity.stationId}
            AND DATE_FORMAT(record_time,'%Y-%m-%d') = DATE_FORMAT(#{entity.recordTime},'%Y-%m-%d')
 
    </select>
</mapper>