guoshilong
2023-10-25 46ba34b6f3909f6c9b57363adfeb3cca2e5d6fc3
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
<?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>
</mapper>