<?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') >= #{db.startTime}
|
</if>
|
<if test="db.endTime !=null and db.endTime !=''">
|
AND DATE_FORMAT(sdr.record_time,'%Y-%m-%d') <= #{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') >= #{db.startTime}
|
</if>
|
<if test="db.endTime !=null and db.endTime !=''">
|
AND DATE_FORMAT(sdr.record_time,'%Y-%m-%d') <= #{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>
|