Commit 3939948c authored by ZWT's avatar ZWT

得到的

parent c3f7c927
......@@ -188,7 +188,7 @@
is_external,
create_by_id,
create_by_name,
create_time,
CREATE_TIME,
modify_by_id,
modify_by_name,
modify_time,
......
......@@ -2,67 +2,69 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.BaseDataViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.BaseDataView">
<id column="ID" property="id" />
<result column="OU_ID" property="ouId" />
<result column="LINE_ID" property="lineId" />
<result column="DATA_DATE" property="dataDate" />
<result column="WIND_SPEED" property="windSpeed" />
<result column="WIND_DIRECTION" property="windDirection" />
<result column="TEMPERATURE" property="temperature" />
<result column="PRESSURE" property="pressure" />
<result column="HUMIDITY" property="humidity" />
<result column="PLANE_IRRADIANCE" property="planeIrradiance" />
<result column="HORIZONTAL_IRRADIANCE" property="horizontalIrradiance" />
<result column="POWER" property="power" />
<result column="PREDICTED_POWER" property="predictedPower" />
<id column="ID" property="id"/>
<result column="OU_ID" property="ouId"/>
<result column="LINE_ID" property="lineId"/>
<result column="DATA_DATE" property="dataDate"/>
<result column="WIND_SPEED" property="windSpeed"/>
<result column="WIND_DIRECTION" property="windDirection"/>
<result column="TEMPERATURE" property="temperature"/>
<result column="PRESSURE" property="pressure"/>
<result column="HUMIDITY" property="humidity"/>
<result column="PLANE_IRRADIANCE" property="planeIrradiance"/>
<result column="HORIZONTAL_IRRADIANCE" property="horizontalIrradiance"/>
<result column="POWER" property="power"/>
<result column="PREDICTED_POWER" property="predictedPower"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
ou_id,
line_id,
data_date,
wind_speed,
wind_direction,
temperature,
pressure,
humidity,
plane_Irradiance,
horizontal_Irradiance,
power,
predicted_power
OU_ID,
LINE_ID,
DATA_DATE,
WIND_SPEED,
WIND_DIRECTION,
TEMPERATURE,
PRESSURE,
HUMIDITY,
PLANE_IRRADIANCE,
HORIZONTAL_IRRADIANCE,
POWER,
PREDICTED_POWER
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.BaseDataView" resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from BASE_DATA
where
id=#{id}
FROM BASE_DATA
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.BaseDataView" resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from BASE_DATA
where
id=#{id}
FROM BASE_DATA
WHERE
ID=#{id}
</select>
<insert id="batchInsert">
insert into BASE_DATA(
ou_id,
line_id,
data_date,
wind_speed,
wind_direction,
temperature,
pressure,
humidity,
plane_Irradiance,
horizontal_Irradiance,
power,
predicted_power,
weather
INSERT INTO BASE_DATA(
OU_ID,
LINE_ID,
DATA_DATE,
WIND_SPEED,
WIND_DIRECTION,
TEMPERATURE,
PRESSURE,
HUMIDITY,
PLANE_IRRADIANCE,
HORIZONTAL_IRRADIANCE,
POWER,
PREDICTED_POWER,
WEATHER
) VALUES
<foreach collection="list" item="item" separator=",">
(
......
......@@ -5,41 +5,44 @@
<id column="ID" property="id" />
<result column="STATION_NAME" property="stationName" />
<result column="LINE_ID" property="lineId" />
<result column="power_generation" property="powerGeneration" />
<result column="power_consumption" property="powerConsumption" />
<result column="POWER_GENERATION" property="powerGeneration" />
<result column="POWER_CONSUMPTION" property="powerConsumption" />
<result column="DATA_DATE" property="dataDate" />
<result column="SYSTEM_SOURCE" property="systemSource" />
</resultMap>
<sql id="Base_Column_List">
id
ID
,
STATION_NAME,
line_id,
power_generation,
power_consumption,
data_date,
LINE_ID,
POWER_GENERATION,
POWER_CONSUMPTION,
DATA_DATE,
SYSTEM_SOURCE
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.EnergyConsumptionAnalysisView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from ENERGY_CONSUMPTION_ANALYSIS
where
id=#{id}
FROM ENERGY_CONSUMPTION_ANALYSIS
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.EnergyConsumptionAnalysisView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from ENERGY_CONSUMPTION_ANALYSIS
where
id=#{id}
FROM ENERGY_CONSUMPTION_ANALYSIS
WHERE
ID=#{id}
</select>
<insert id="batchInsertList" parameterType="list">
INSERT INTO ENERGY_CONSUMPTION_ANALYSIS ( line_id, STATION_NAME, power_generation, power_consumption,
data_date, SYSTEM_SOURCE )
INSERT INTO ENERGY_CONSUMPTION_ANALYSIS ( LINE_ID, STATION_NAME, POWER_GENERATION, POWER_CONSUMPTION,
DATA_DATE, SYSTEM_SOURCE )
VALUES
<foreach collection="list" item="item" separator=",">
(
......
......@@ -2,42 +2,45 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.PhotovoltaicElectricityConsumptionViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.PhotovoltaicElectricityConsumptionView">
<id column="ID" property="id" />
<result column="OU_ID" property="ouId" />
<result column="OU_NAME" property="ouName" />
<result column="total_electricity" property="totalElectricity" />
<result column="city_electricity" property="cityElectricity" />
<result column="city_electricity_scale" property="cityElectricityScale" />
<result column="green_electricity" property="greenElectricity" />
<result column="green_electricity_scale" property="greenElectricityScale" />
<result column="DATA_DATE" property="dataDate" />
<id column="ID" property="id"/>
<result column="OU_ID" property="ouId"/>
<result column="OU_NAME" property="ouName"/>
<result column="TOTAL_ELECTRICITY" property="totalElectricity"/>
<result column="CITY_ELECTRICITY" property="cityElectricity"/>
<result column="CITY_ELECTRICITY_SCALE" property="cityElectricityScale"/>
<result column="GREEN_ELECTRICITY" property="greenElectricity"/>
<result column="GREEN_ELECTRICITY_SCALE" property="greenElectricityScale"/>
<result column="DATA_DATE" property="dataDate"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
ou_id,
ou_name,
total_electricity,
city_electricity,
city_electricity_scale,
green_electricity,
green_electricity_scale,
data_date
OU_ID,
OU_NAME,
TOTAL_ELECTRICITY,
CITY_ELECTRICITY,
CITY_ELECTRICITY_SCALE,
GREEN_ELECTRICITY,
GREEN_ELECTRICITY_SCALE,
DATA_DATE
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.PhotovoltaicElectricityConsumptionView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from PHOTOVOLTAIC_ELECTRICITY_CONSUMPTION
where
id=#{id}
FROM PHOTOVOLTAIC_ELECTRICITY_CONSUMPTION
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.PhotovoltaicElectricityConsumptionView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from PHOTOVOLTAIC_ELECTRICITY_CONSUMPTION
where
id=#{id}
FROM PHOTOVOLTAIC_ELECTRICITY_CONSUMPTION
WHERE
ID=#{id}
</select>
</mapper>
\ No newline at end of file
......@@ -4,15 +4,15 @@
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO PLANT_POWER_DATA
(PLANT_ID,
data_date,
temperature,
humidity,
wind_speed,
wind_direction,
pressure,
plane_irradiance,
horizontal_irradiance,
power) VALUES
DATA_DATE,
TEMPERATURE,
HUMIDITY,
WIND_SPEED,
WIND_DIRECTION,
PRESSURE,
PLANE_IRRADIANCE,
HORIZONTAL_IRRADIANCE,
POWER) VALUES
<foreach collection="list" separator="," item="item">
(#{item.plantId},
#{item.dataDate},
......
......@@ -4,21 +4,21 @@
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO PLANT_PREDICTED_POWER_LONG_TERM_DATA
(PLANT_ID,
data_date,
year_time,
month_time,
day_time,
hour_time,
min_time,
temperature,
humidity,
wind_speed,
wind_direction,
pressure,
plane_irradiance,
horizontal_irradiance,
power,
create_time) VALUES
DATA_DATE,
YEAR_TIME,
MONTH_TIME,
DAY_TIME,
HOUR_TIME,
MIN_TIME,
TEMPERATURE,
HUMIDITY,
WIND_SPEED,
WIND_DIRECTION,
PRESSURE,
PLANE_IRRADIANCE,
HORIZONTAL_IRRADIANCE,
POWER,
CREATE_TIME) VALUES
<foreach collection="list" separator="," item="item">
(#{item.plantId},
#{item.dataDate},
......
......@@ -2,26 +2,26 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.PredictedPowerViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.PredictedPowerView">
<result column="POWER" property="power" />
<result column="CREATE_TIME" property="createTime" />
<result column="hour_time" property="hourTime" />
<result column="POWER" property="power"/>
<result column="CREATE_TIME" property="createTime"/>
<result column="HOUR_TIME" property="hourTime"/>
</resultMap>
<select id="selectMidPowerList" resultMap="BaseResultMap">
SELECT
HOUR( a.create_time ) AS hour_time,
IFNULL( AVG( a.predict_power ), 0 ) AS power,
a.create_time AS create_time
HOUR( A.CREATE_TIME ) AS HOUR_TIME,
IFNULL( AVG( A.PREDICT_POWER ), 0 ) AS POWER,
A.CREATE_TIME AS CREATE_TIME
FROM
(
SELECT
predict_power,
PREDICT_POWER,
<choose>
<when test="formatType == 1">
DATE_FORMAT ( data_date, '%H:00:00' ) AS create_time
DATE_FORMAT ( DATA_DATE, '%H:00:00' ) AS CREATE_TIME
</when>
<otherwise>
DATE_FORMAT ( data_date, '%H:%i:%s' ) AS create_time
DATE_FORMAT ( DATA_DATE, '%H:%i:%s' ) AS CREATE_TIME
</otherwise>
</choose>
FROM
......@@ -33,32 +33,32 @@
</foreach>
<if test="startTime != null and endTime != null">
AND
data_date BETWEEN
DATA_DATE BETWEEN
#{startTime} AND
#{endTime}
</if>
) a
) A
GROUP BY
a.create_time
A.CREATE_TIME
ORDER BY
a.create_time
A.CREATE_TIME
</select>
<select id="selectShortPowerList" resultMap="BaseResultMap">
SELECT
HOUR( a.create_time ) AS hour_time,
IFNULL( AVG( a.predict_power ), 0 ) AS power,
a.create_time AS create_time
HOUR( A.CREATE_TIME ) AS HOUR_TIME,
IFNULL( AVG( A.PREDICT_POWER ), 0 ) AS POWER,
A.CREATE_TIME AS CREATE_TIME
FROM
(
SELECT
predict_power,
PREDICT_POWER,
<choose>
<when test="formatType == 1">
DATE_FORMAT ( data_date, '%H:00:00' ) AS create_time
DATE_FORMAT ( DATA_DATE, '%H:00:00' ) AS CREATE_TIME
</when>
<otherwise>
DATE_FORMAT ( data_date, '%H:%i:%s' ) AS create_time
DATE_FORMAT ( DATA_DATE, '%H:%i:%s' ) AS CREATE_TIME
</otherwise>
</choose>
FROM
......@@ -70,28 +70,28 @@
</foreach>
<if test="startTime != null and endTime != null">
AND
data_date BETWEEN
DATA_DATE BETWEEN
#{startTime} AND
#{endTime}
</if>
) a
) A
GROUP BY
a.create_time
A.CREATE_TIME
ORDER BY
a.create_time
A.CREATE_TIME
</select>
<!--*********************************************************************************-->
<select id="selectMidPowerHourList" resultMap="BaseResultMap">
SELECT
IFNULL( AVG( a.predict_power ), 0 ) AS power,
a.create_time AS hour_time
IFNULL( AVG( A.PREDICT_POWER ), 0 ) AS POWER,
A.CREATE_TIME AS HOUR_TIME
FROM
(
SELECT
predict_power,
HOUR( data_date ) AS create_time
PREDICT_POWER,
HOUR( DATA_DATE ) AS CREATE_TIME
FROM
PLANT_PREDICTED_POWER_MID_TERM
WHERE
......@@ -101,26 +101,26 @@
</foreach>
<if test="startTime != null and endTime != null">
AND
data_date BETWEEN
DATA_DATE BETWEEN
#{startTime} AND
#{endTime}
</if>
) a
) A
GROUP BY
a.create_time
A.CREATE_TIME
ORDER BY
a.create_time
A.CREATE_TIME
</select>
<select id="selectShortPowerHourList" resultMap="BaseResultMap">
SELECT
IFNULL( ROUND( AVG( a.predict_power ), 2 ), 0 ) AS power,
a.create_time AS hour_time
IFNULL( ROUND( AVG( A.PREDICT_POWER ), 2 ), 0 ) AS POWER,
A.CREATE_TIME AS HOUR_TIME
FROM
(
SELECT
predict_power,
HOUR( data_date ) AS create_time
PREDICT_POWER,
HOUR( DATA_DATE ) AS CREATE_TIME
FROM
PLANT_PREDICTED_POWER_SHORT_TERM
<where>
......@@ -132,50 +132,50 @@
</if>
<if test="startTime != null and endTime != null">
AND
data_date BETWEEN
DATA_DATE BETWEEN
#{startTime} AND
#{endTime}
</if>
<if test="createTime != null">
AND DATE( data_date ) = #{createTime}
AND DATE( DATA_DATE ) = #{createTime}
</if>
<if test="plantId != null">
AND PLANT_ID = #{plantId}
</if>
</where>
) a
) A
GROUP BY
a.create_time
A.CREATE_TIME
ORDER BY
a.create_time
A.CREATE_TIME
</select>
<!--*********************************************************************************-->
<select id="selectMidPowerHalfHourList" resultMap="BaseResultMap">
SELECT
IFNULL( AVG( a.predict_power ), 0 ) AS power,
a.create_time AS create_time
IFNULL( AVG( A.PREDICT_POWER ), 0 ) AS POWER,
A.CREATE_TIME AS CREATE_TIME
FROM
(
SELECT
predict_power,
PREDICT_POWER,
DATE_FORMAT (
<choose>
<when test="formatType == 0">
data_date
DATA_DATE
</when>
<otherwise>
CASE
MINUTE ( data_date )
MINUTE ( DATA_DATE )
WHEN 15 THEN
DATE_SUB( data_date, INTERVAL 15 MINUTE )
DATE_SUB( DATA_DATE, INTERVAL 15 MINUTE )
WHEN 45 THEN
DATE_SUB( data_date, INTERVAL 15 MINUTE ) ELSE data_date
DATE_SUB( DATA_DATE, INTERVAL 15 MINUTE ) ELSE DATA_DATE
END
</otherwise>
</choose>
, '%H:%i:%s' ) AS create_time
, '%H:%i:%s' ) AS CREATE_TIME
FROM
PLANT_PREDICTED_POWER_MID_TERM
WHERE
......@@ -185,41 +185,41 @@
</foreach>
<if test="startTime != null and endTime != null">
AND
data_date BETWEEN
DATA_DATE BETWEEN
#{startTime} AND
#{endTime}
</if>
) a
) A
GROUP BY
a.create_time
A.CREATE_TIME
ORDER BY
a.create_time
A.CREATE_TIME
</select>
<select id="selectShortPowerHalfHourList" resultMap="BaseResultMap">
SELECT
IFNULL( AVG( a.predict_power ), 0 ) AS power,
a.create_time AS create_time
IFNULL( AVG( A.PREDICT_POWER ), 0 ) AS POWER,
A.CREATE_TIME AS CREATE_TIME
FROM
(
SELECT
predict_power,
PREDICT_POWER,
DATE_FORMAT (
<choose>
<when test="formatType == 0">
data_date
DATA_DATE
</when>
<otherwise>
CASE
MINUTE ( data_date )
MINUTE ( DATA_DATE )
WHEN 15 THEN
DATE_SUB( data_date, INTERVAL 15 MINUTE )
DATE_SUB( DATA_DATE, INTERVAL 15 MINUTE )
WHEN 45 THEN
DATE_SUB( data_date, INTERVAL 15 MINUTE ) ELSE data_date
DATE_SUB( DATA_DATE, INTERVAL 15 MINUTE ) ELSE DATA_DATE
END
</otherwise>
</choose>
, '%H:%i:%s' ) AS create_time
, '%H:%i:%s' ) AS CREATE_TIME
FROM
PLANT_PREDICTED_POWER_SHORT_TERM
WHERE
......@@ -229,14 +229,14 @@
</foreach>
<if test="startTime != null and endTime != null">
AND
data_date BETWEEN
DATA_DATE BETWEEN
#{startTime} AND
#{endTime}
</if>
) a
) A
GROUP BY
a.create_time
A.CREATE_TIME
ORDER BY
a.create_time
A.CREATE_TIME
</select>
</mapper>
\ No newline at end of file
......@@ -2,44 +2,47 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.StoragePredictedPowerDataViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.StoragePredictedPowerDataView">
<id column="ID" property="id" />
<result column="STORAGE_ID" property="storageId" />
<result column="DATA_DATE" property="dataDate" />
<result column="year_time" property="yearTime" />
<result column="month_time" property="monthTime" />
<result column="day_time" property="dayTime" />
<result column="hour_time" property="hourTime" />
<result column="min_time" property="minTime" />
<result column="POWER" property="power" />
<result column="CREATE_TIME" property="createTime" />
<id column="ID" property="id"/>
<result column="STORAGE_ID" property="storageId"/>
<result column="DATA_DATE" property="dataDate"/>
<result column="YEAR_TIME" property="yearTime"/>
<result column="MONTH_TIME" property="monthTime"/>
<result column="DAY_TIME" property="dayTime"/>
<result column="HOUR_TIME" property="hourTime"/>
<result column="MIN_TIME" property="minTime"/>
<result column="POWER" property="power"/>
<result column="CREATE_TIME" property="createTime"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
STORAGE_ID,
data_date,
year_time,
month_time,
day_time,
hour_time,
min_time,
power,
create_time
DATA_DATE,
YEAR_TIME,
MONTH_TIME,
DAY_TIME,
HOUR_TIME,
MIN_TIME,
POWER,
CREATE_TIME
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.StoragePredictedPowerDataView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from STORAGE_PREDICTED_POWER_DATA
where
id=#{id}
FROM STORAGE_PREDICTED_POWER_DATA
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.StoragePredictedPowerDataView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from STORAGE_PREDICTED_POWER_DATA
where
id=#{id}
FROM STORAGE_PREDICTED_POWER_DATA
WHERE
ID=#{id}
</select>
</mapper>
\ No newline at end of file
......@@ -2,73 +2,76 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.ThirdActivePowerDailyUpdateViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ThirdActivePowerDailyUpdateView">
<id column="ID" property="id" />
<result column="STATION_NAME" property="stationName" />
<result column="STATION_ID" property="stationId" />
<result column="CREATE_DATE" property="createDate" />
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower" />
<result column="meter_power" property="meterPower" />
<result column="SYSTEM_SOURCE" property="systemSource" />
<result column="save_date" property="saveDate" />
<result column="save_hour" property="saveHour" />
<id column="ID" property="id"/>
<result column="STATION_NAME" property="stationName"/>
<result column="STATION_ID" property="stationId"/>
<result column="CREATE_DATE" property="createDate"/>
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower"/>
<result column="METER_POWER" property="meterPower"/>
<result column="SYSTEM_SOURCE" property="systemSource"/>
<result column="SAVE_DATE" property="saveDate"/>
<result column="SAVE_HOUR" property="saveHour"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
STATION_NAME,
STATION_ID,
CREATE_DATE,
PHOTOVOLTAIC_POWER,
meter_power,
METER_POWER,
SYSTEM_SOURCE,
save_date,
save_hour
SAVE_DATE,
SAVE_HOUR
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.ThirdActivePowerDailyUpdateView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_ACTIVE_POWER_DAILY_UPDATE
where
id=#{id}
FROM THIRD_ACTIVE_POWER_DAILY_UPDATE
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.ThirdActivePowerDailyUpdateView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_ACTIVE_POWER_DAILY_UPDATE
where
id=#{id}
FROM THIRD_ACTIVE_POWER_DAILY_UPDATE
WHERE
ID=#{id}
</select>
<delete id="deleteByCurrentDayData" parameterType="java.util.List">
delete
from THIRD_ACTIVE_POWER_DAILY_UPDATE
where save_hour = #{currentDay}
and STATION_NAME IN
DELETE
FROM THIRD_ACTIVE_POWER_DAILY_UPDATE
WHERE SAVE_HOUR = #{currentDay}
AND STATION_NAME IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.stationName}
</foreach>
</delete>
<delete id="deleteByCurrentDayDataList" parameterType="java.util.List">
delete
from THIRD_ACTIVE_POWER_DAILY_UPDATE
where save_hour IN
DELETE
FROM THIRD_ACTIVE_POWER_DAILY_UPDATE
WHERE SAVE_HOUR IN
<foreach collection="currentDayList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and STATION_NAME IN
AND STATION_NAME IN
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item.stationName}
</foreach>
</delete>
<insert id="batchInsertList" parameterType="java.util.List">
insert into THIRD_ACTIVE_POWER_DAILY_UPDATE (STATION_NAME, STATION_ID, CREATE_DATE, PHOTOVOLTAIC_POWER,
meter_power,
SYSTEM_SOURCE, save_date, save_hour)
values
INSERT INTO THIRD_ACTIVE_POWER_DAILY_UPDATE (STATION_NAME, STATION_ID, CREATE_DATE, PHOTOVOLTAIC_POWER,
METER_POWER,
SYSTEM_SOURCE, SAVE_DATE, SAVE_HOUR)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.stationName},
......@@ -85,14 +88,14 @@
<resultMap id="ExtBaseResultMap" type="pps.core.prediction.entity.ThirdActivePowerDailyUpdateView"
extends="BaseResultMap">
<result column="hour_number" property="hourNumber" />
<result column="HOUR_NUMBER" property="hourNumber"/>
</resultMap>
<select id="selectEnergyUseCurve" resultMap="ExtBaseResultMap">
SELECT hour_str AS hour_number,
SELECT HOUR_STR AS HOUR_NUMBER,
IFNULL( ROUND( AVG( PHOTOVOLTAIC_POWER ), 2 ), 0 ) AS PHOTOVOLTAIC_POWER,
IFNULL( ROUND( AVG( meter_power ), 2 ), 0 ) AS meter_power
FROM (SELECT STATION_NAME, HOUR ( CREATE_DATE ) AS hour_str, PHOTOVOLTAIC_POWER, meter_power
IFNULL( ROUND( AVG( METER_POWER ), 2 ), 0 ) AS METER_POWER
FROM (SELECT STATION_NAME, HOUR ( CREATE_DATE ) AS HOUR_STR, PHOTOVOLTAIC_POWER, METER_POWER
FROM THIRD_ACTIVE_POWER_DAILY_UPDATE
<where>
<if test="systemSource != null">
......@@ -111,14 +114,14 @@
</foreach>
</if>
</where>
) z
GROUP BY hour_str
ORDER BY hour_str
) Z
GROUP BY HOUR_STR
ORDER BY HOUR_STR
</select>
<delete id="deleteHistory">
DELETE
FROM plant_power_history_data
WHERE data_date > '2024-10-21 00:00:00'
FROM PLANT_POWER_HISTORY_DATA
WHERE DATA_DATE > '2024-10-21 00:00:00'
</delete>
</mapper>
\ No newline at end of file
......@@ -2,42 +2,45 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.ThirdActivePowerViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ThirdActivePowerView">
<id column="ID" property="id" />
<result column="STATION_NAME" property="stationName" />
<result column="STATION_ID" property="stationId" />
<result column="CREATE_DATE" property="createDate" />
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower" />
<result column="meter_power" property="meterPower" />
<result column="SYSTEM_SOURCE" property="systemSource" />
<result column="INPUT_TIME" property="inputTime" />
<id column="ID" property="id"/>
<result column="STATION_NAME" property="stationName"/>
<result column="STATION_ID" property="stationId"/>
<result column="CREATE_DATE" property="createDate"/>
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower"/>
<result column="METER_POWER" property="meterPower"/>
<result column="SYSTEM_SOURCE" property="systemSource"/>
<result column="INPUT_TIME" property="inputTime"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
STATION_NAME,
STATION_ID,
CREATE_DATE,
PHOTOVOLTAIC_POWER,
meter_power,
METER_POWER,
SYSTEM_SOURCE
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.ThirdActivePowerView" resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_ACTIVE_POWER
where
id=#{id}
FROM THIRD_ACTIVE_POWER
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.ThirdActivePowerView" resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_ACTIVE_POWER
where
id=#{id}
FROM THIRD_ACTIVE_POWER
WHERE
ID=#{id}
</select>
<insert id="batchInsertList" parameterType="list">
INSERT INTO THIRD_ACTIVE_POWER ( STATION_NAME, STATION_ID, CREATE_DATE, PHOTOVOLTAIC_POWER, meter_power,
INSERT INTO THIRD_ACTIVE_POWER ( STATION_NAME, STATION_ID, CREATE_DATE, PHOTOVOLTAIC_POWER, METER_POWER,
SYSTEM_SOURCE, INPUT_TIME)
VALUES
<foreach collection="list" item="item" separator=",">
......@@ -54,20 +57,20 @@
</insert>
<resultMap id="ExtBaseResultMap" type="pps.core.prediction.entity.ThirdActivePowerView" extends="BaseResultMap">
<result column="save_hour" property="saveHour" />
<result column="SAVE_HOUR" property="saveHour"/>
</resultMap>
<select id="selectEnergyUseCurve" parameterType="pps.core.prediction.entity.ThirdActivePowerView"
resultMap="ExtBaseResultMap">
SELECT hour_str AS save_hour,
SELECT HOUR_STR AS SAVE_HOUR,
IFNULL(AVG(PHOTOVOLTAIC_POWER), 0) AS PHOTOVOLTAIC_POWER,
IFNULL(AVG(meter_power), 0) AS meter_power
FROM (SELECT STATION_NAME, HOUR ( CREATE_DATE ) AS hour_str, PHOTOVOLTAIC_POWER, meter_power
IFNULL(AVG(METER_POWER), 0) AS METER_POWER
FROM (SELECT STATION_NAME, HOUR ( CREATE_DATE ) AS HOUR_STR, PHOTOVOLTAIC_POWER, METER_POWER
FROM THIRD_ACTIVE_POWER
WHERE STATION_NAME = #{stationName}
AND DATE ( CREATE_DATE ) = #{createDate}) z
GROUP BY hour_str
ORDER BY hour_str
AND DATE ( CREATE_DATE ) = #{createDate}) Z
GROUP BY HOUR_STR
ORDER BY HOUR_STR
</select>
<select id="selectGeneratedPowerHour" parameterType="pps.core.prediction.entity.ThirdActivePowerView"
......@@ -103,7 +106,7 @@
</if>
)
GROUP BY STATION_NAME,
CREATE_DATE) z
CREATE_DATE) Z
GROUP BY CREATE_DATE
ORDER BY
CREATE_DATE
......@@ -111,31 +114,30 @@
<select id="selectAvgPhotovoltaicPower" parameterType="pps.core.prediction.entity.ThirdActivePowerView"
resultMap="BaseResultMap">
SELECT g.STATION_NAME,
g.create_time AS CREATE_DATE,
AVG(g.PHOTOVOLTAIC_POWER) AS PHOTOVOLTAIC_POWER
FROM (SELECT a.STATION_NAME,
a.PHOTOVOLTAIC_POWER,
SELECT G.STATION_NAME,
G.CREATE_TIME AS CREATE_DATE,
AVG(G.PHOTOVOLTAIC_POWER) AS PHOTOVOLTAIC_POWER
FROM (SELECT A.STATION_NAME,
A.PHOTOVOLTAIC_POWER,
DATE_FORMAT(
CASE
WHEN MINUTE ( a.create_time ) IN ( 10, 20, 40, 50 ) THEN
DATE_SUB( a.create_time, INTERVAL - 5 MINUTE ) ELSE a.create_time
WHEN MINUTE ( A.CREATE_TIME ) IN ( 10, 20, 40, 50 ) THEN
DATE_SUB( A.CREATE_TIME, INTERVAL - 5 MINUTE ) ELSE A.CREATE_TIME
END,
'%H:%i:%s'
) AS create_time
FROM (SELECT z.STATION_NAME,
z.PHOTOVOLTAIC_POWER,
) AS CREATE_TIME
FROM (SELECT Z.STATION_NAME,
Z.PHOTOVOLTAIC_POWER,
CASE
WHEN z.mo &lt; 10 THEN
FROM_UNIXTIME(z.time_stamp + 10 - z.mo)
ELSE z.CREATE_DATE
END AS create_time
WHEN Z.MO &lt; 10 THEN
FROM_UNIXTIME(Z.TIME_STAMP + 10 - Z.MO)
ELSE Z.CREATE_DATE
END AS CREATE_TIME
FROM (SELECT STATION_NAME,
CREATE_DATE,
PHOTOVOLTAIC_POWER,
UNIX_TIMESTAMP(CREATE_DATE) AS time_stamp,
UNIX_TIMESTAMP(CREATE_DATE) % 10 AS mo
UNIX_TIMESTAMP(CREATE_DATE) AS TIME_STAMP,
UNIX_TIMESTAMP(CREATE_DATE) % 10 AS MO
FROM
THIRD_ACTIVE_POWER
WHERE
......@@ -144,17 +146,17 @@
AND SYSTEM_SOURCE = #{systemSource}
</if>
AND PHOTOVOLTAIC_POWER
&gt; 0) z) a) g
GROUP BY g.STATION_NAME,
g.create_time
ORDER BY g.STATION_NAME,
g.create_time
&gt; 0) Z) A) G
GROUP BY G.STATION_NAME,
G.CREATE_TIME
ORDER BY G.STATION_NAME,
G.CREATE_TIME
</select>
<select id="selectAvgPower15" parameterType="pps.core.prediction.entity.ThirdActivePowerView"
resultMap="BaseResultMap">
SELECT IFNULL(AVG(z.PHOTOVOLTAIC_POWER), 0) AS PHOTOVOLTAIC_POWER,
z.INPUT_TIME
SELECT IFNULL(AVG(Z.PHOTOVOLTAIC_POWER), 0) AS PHOTOVOLTAIC_POWER,
Z.INPUT_TIME
FROM (SELECT PHOTOVOLTAIC_POWER,
<choose>
<when test="systemSource == 'SY'">
......@@ -190,10 +192,10 @@
</if>
ORDER BY
INPUT_TIME ASC
) z
) Z
GROUP BY
z.INPUT_TIME
Z.INPUT_TIME
ORDER BY
z.INPUT_TIME
Z.INPUT_TIME
</select>
</mapper>
\ No newline at end of file
......@@ -2,41 +2,44 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.ThirdCurrentWellConditionViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ThirdCurrentWellConditionView">
<id column="ID" property="id" />
<result column="WELL_NUMBER" property="wellNumber" />
<result column="next_time" property="nextTime" />
<result column="well_status" property="wellStatus" />
<result column="cumulative_production" property="cumulativeProduction" />
<result column="running_time" property="runningTime" />
<result column="SYSTEM_SOURCE" property="systemSource" />
<result column="UPDATE_TIME" property="updateTime" />
<id column="ID" property="id"/>
<result column="WELL_NUMBER" property="wellNumber"/>
<result column="NEXT_TIME" property="nextTime"/>
<result column="WELL_STATUS" property="wellStatus"/>
<result column="CUMULATIVE_PRODUCTION" property="cumulativeProduction"/>
<result column="RUNNING_TIME" property="runningTime"/>
<result column="SYSTEM_SOURCE" property="systemSource"/>
<result column="UPDATE_TIME" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
WELL_NUMBER,
next_time,
well_status,
cumulative_production,
running_time,
NEXT_TIME,
WELL_STATUS,
CUMULATIVE_PRODUCTION,
RUNNING_TIME,
SYSTEM_SOURCE,
UPDATE_TIME
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.ThirdCurrentWellConditionView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_CURRENT_WELL_CONDITION
where
id=#{id}
FROM THIRD_CURRENT_WELL_CONDITION
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.ThirdCurrentWellConditionView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_CURRENT_WELL_CONDITION
where
id=#{id}
FROM THIRD_CURRENT_WELL_CONDITION
WHERE
ID=#{id}
</select>
<delete id="deleteByParams" parameterType="list">
......@@ -49,8 +52,8 @@
</delete>
<insert id="batchInsertList" parameterType="list">
INSERT INTO THIRD_CURRENT_WELL_CONDITION (WELL_NUMBER, next_time, well_status, cumulative_production,
running_time, SYSTEM_SOURCE, UPDATE_TIME)
INSERT INTO THIRD_CURRENT_WELL_CONDITION (WELL_NUMBER, NEXT_TIME, WELL_STATUS, CUMULATIVE_PRODUCTION,
RUNNING_TIME, SYSTEM_SOURCE, UPDATE_TIME)
VALUES
<foreach collection="list" item="item" separator=",">
(
......
......@@ -2,21 +2,22 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.ThirdDailyAccumulationUpdateViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ThirdDailyAccumulationUpdateView">
<id column="ID" property="id" />
<result column="STATION_NAME" property="stationName" />
<result column="STATION_ID" property="stationId" />
<result column="CREATE_DATE" property="createDate" />
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower" />
<result column="DAILY_ELECTRICITY_CONSUMPTION" property="dailyElectricityConsumption" />
<result column="DAILY_LIQUID_PRODUCTION" property="dailyLiquidProduction" />
<result column="in_place_consumption" property="inPlaceConsumption" />
<result column="energy_storage_discharge" property="energyStorageDischarge" />
<result column="save_date" property="saveDate" />
<result column="SYSTEM_SOURCE" property="systemSource" />
<result column="save_hour" property="saveHour" />
<id column="ID" property="id"/>
<result column="STATION_NAME" property="stationName"/>
<result column="STATION_ID" property="stationId"/>
<result column="CREATE_DATE" property="createDate"/>
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower"/>
<result column="DAILY_ELECTRICITY_CONSUMPTION" property="dailyElectricityConsumption"/>
<result column="DAILY_LIQUID_PRODUCTION" property="dailyLiquidProduction"/>
<result column="IN_PLACE_CONSUMPTION" property="inPlaceConsumption"/>
<result column="ENERGY_STORAGE_DISCHARGE" property="energyStorageDischarge"/>
<result column="SAVE_DATE" property="saveDate"/>
<result column="SYSTEM_SOURCE" property="systemSource"/>
<result column="SAVE_HOUR" property="saveHour"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
STATION_NAME,
STATION_ID,
......@@ -24,34 +25,36 @@
PHOTOVOLTAIC_POWER,
DAILY_ELECTRICITY_CONSUMPTION,
DAILY_LIQUID_PRODUCTION,
in_place_consumption,
energy_storage_discharge,
save_date,
IN_PLACE_CONSUMPTION,
ENERGY_STORAGE_DISCHARGE,
SAVE_DATE,
SYSTEM_SOURCE,
save_hour
SAVE_HOUR
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.ThirdDailyAccumulationUpdateView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_DAILY_ACCUMULATION_UPDATE
where
id=#{id}
FROM THIRD_DAILY_ACCUMULATION_UPDATE
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.ThirdDailyAccumulationUpdateView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_DAILY_ACCUMULATION_UPDATE
where
id=#{id}
FROM THIRD_DAILY_ACCUMULATION_UPDATE
WHERE
ID=#{id}
</select>
<insert id="batchInsertList" parameterType="list">
INSERT INTO THIRD_DAILY_ACCUMULATION_UPDATE ( STATION_NAME, STATION_ID, CREATE_DATE, PHOTOVOLTAIC_POWER,
DAILY_ELECTRICITY_CONSUMPTION, DAILY_LIQUID_PRODUCTION, in_place_consumption, energy_storage_discharge,
save_date, SYSTEM_SOURCE,
save_hour)
DAILY_ELECTRICITY_CONSUMPTION, DAILY_LIQUID_PRODUCTION, IN_PLACE_CONSUMPTION, ENERGY_STORAGE_DISCHARGE,
SAVE_DATE, SYSTEM_SOURCE,
SAVE_HOUR)
VALUES
<foreach collection="list" item="item" separator=",">
(
......@@ -72,22 +75,22 @@
<resultMap id="ExtResultMap" type="pps.core.prediction.entity.ThirdDailyAccumulationUpdateView"
extends="BaseResultMap">
<result column="DAY_FLAG" property="dayFlag" />
<result column="GREEN_ELECTRICITY_RATE" property="greenElectricityRate" />
<result column="avoid_peak_rate" property="avoidPeakRate" />
<result column="DAY_FLAG" property="dayFlag"/>
<result column="GREEN_ELECTRICITY_RATE" property="greenElectricityRate"/>
<result column="AVOID_PEAK_RATE" property="avoidPeakRate"/>
</resultMap>
<select id="selectPowerStatisticsByDate" parameterType="pps.core.prediction.entity.ThirdDailyAccumulationUpdateView"
resultMap="ExtResultMap">
SELECT z.DAY_FLAG,
ROUND(z.PHOTOVOLTAIC_POWER, 2) AS PHOTOVOLTAIC_POWER,
ROUND(z.DAILY_ELECTRICITY_CONSUMPTION, 2) AS DAILY_ELECTRICITY_CONSUMPTION,
IFNULL(ROUND(z.in_place_consumption / z.DAILY_ELECTRICITY_CONSUMPTION * 100, 2),
SELECT Z.DAY_FLAG,
ROUND(Z.PHOTOVOLTAIC_POWER, 2) AS PHOTOVOLTAIC_POWER,
ROUND(Z.DAILY_ELECTRICITY_CONSUMPTION, 2) AS DAILY_ELECTRICITY_CONSUMPTION,
IFNULL(ROUND(Z.IN_PLACE_CONSUMPTION / Z.DAILY_ELECTRICITY_CONSUMPTION * 100, 2),
0) AS GREEN_ELECTRICITY_RATE,
IFNULL(ROUND(z.PHOTOVOLTAIC_POWER - z.in_place_consumption, 2), 0) AS avoid_peak_rate
IFNULL(ROUND(Z.PHOTOVOLTAIC_POWER - Z.IN_PLACE_CONSUMPTION, 2), 0) AS AVOID_PEAK_RATE
FROM (SELECT IFNULL(SUM(PHOTOVOLTAIC_POWER), 0) AS PHOTOVOLTAIC_POWER,
IFNULL(SUM(DAILY_ELECTRICITY_CONSUMPTION), 0) AS DAILY_ELECTRICITY_CONSUMPTION,
IFNULL(SUM(in_place_consumption), 0) AS in_place_consumption,
IFNULL(SUM(IN_PLACE_CONSUMPTION), 0) AS IN_PLACE_CONSUMPTION,
1 AS DAY_FLAG
FROM THIRD_DAILY_ACCUMULATION_UPDATE
WHERE
......@@ -100,7 +103,7 @@
UNION ALL
SELECT IFNULL(SUM(PHOTOVOLTAIC_POWER), 0) AS PHOTOVOLTAIC_POWER,
IFNULL(SUM(DAILY_ELECTRICITY_CONSUMPTION), 0) AS DAILY_ELECTRICITY_CONSUMPTION,
IFNULL(SUM(in_place_consumption), 0) AS in_place_consumption,
IFNULL(SUM(IN_PLACE_CONSUMPTION), 0) AS IN_PLACE_CONSUMPTION,
2 AS DAY_FLAG
FROM THIRD_DAILY_ACCUMULATION_UPDATE
WHERE
......@@ -113,7 +116,7 @@
UNION ALL
SELECT IFNULL(SUM(PHOTOVOLTAIC_POWER), 0) AS PHOTOVOLTAIC_POWER,
IFNULL(SUM(DAILY_ELECTRICITY_CONSUMPTION), 0) AS DAILY_ELECTRICITY_CONSUMPTION,
IFNULL(SUM(in_place_consumption), 0) AS in_place_consumption,
IFNULL(SUM(IN_PLACE_CONSUMPTION), 0) AS IN_PLACE_CONSUMPTION,
3 AS DAY_FLAG
FROM THIRD_DAILY_ACCUMULATION_UPDATE
WHERE
......@@ -123,7 +126,7 @@
<foreach collection="stationNameList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
) z
) Z
</select>
<select id="selectPowerTrendByDate"
......
......@@ -2,20 +2,21 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.ThirdDailyAccumulationViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ThirdDailyAccumulationView">
<id column="ID" property="id" />
<result column="STATION_NAME" property="stationName" />
<result column="STATION_ID" property="stationId" />
<result column="CREATE_DATE" property="createDate" />
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower" />
<result column="DAILY_ELECTRICITY_CONSUMPTION" property="dailyElectricityConsumption" />
<result column="DAILY_LIQUID_PRODUCTION" property="dailyLiquidProduction" />
<result column="in_place_consumption" property="inPlaceConsumption" />
<result column="energy_storage_discharge" property="energyStorageDischarge" />
<result column="save_date" property="saveDate" />
<result column="SYSTEM_SOURCE" property="systemSource" />
<id column="ID" property="id"/>
<result column="STATION_NAME" property="stationName"/>
<result column="STATION_ID" property="stationId"/>
<result column="CREATE_DATE" property="createDate"/>
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower"/>
<result column="DAILY_ELECTRICITY_CONSUMPTION" property="dailyElectricityConsumption"/>
<result column="DAILY_LIQUID_PRODUCTION" property="dailyLiquidProduction"/>
<result column="IN_PLACE_CONSUMPTION" property="inPlaceConsumption"/>
<result column="ENERGY_STORAGE_DISCHARGE" property="energyStorageDischarge"/>
<result column="SAVE_DATE" property="saveDate"/>
<result column="SYSTEM_SOURCE" property="systemSource"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
STATION_NAME,
STATION_ID,
......@@ -23,31 +24,33 @@
PHOTOVOLTAIC_POWER,
DAILY_ELECTRICITY_CONSUMPTION,
DAILY_LIQUID_PRODUCTION,
in_place_consumption,
energy_storage_discharge,
save_date
IN_PLACE_CONSUMPTION,
ENERGY_STORAGE_DISCHARGE,
SAVE_DATE
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.ThirdDailyAccumulationView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_DAILY_ACCUMULATION
where
id=#{id}
FROM THIRD_DAILY_ACCUMULATION
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.ThirdDailyAccumulationView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_DAILY_ACCUMULATION
where
id=#{id}
FROM THIRD_DAILY_ACCUMULATION
WHERE
ID=#{id}
</select>
<insert id="batchInsertList" parameterType="list">
INSERT INTO THIRD_DAILY_ACCUMULATION ( STATION_NAME, STATION_ID, CREATE_DATE, PHOTOVOLTAIC_POWER,
DAILY_ELECTRICITY_CONSUMPTION, DAILY_LIQUID_PRODUCTION, in_place_consumption, energy_storage_discharge,
save_date, SYSTEM_SOURCE )
DAILY_ELECTRICITY_CONSUMPTION, DAILY_LIQUID_PRODUCTION, IN_PLACE_CONSUMPTION, ENERGY_STORAGE_DISCHARGE,
SAVE_DATE, SYSTEM_SOURCE )
VALUES
<foreach collection="list" item="item" separator=",">
(
......
......@@ -2,35 +2,38 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.ThirdPhotovoltaicPowerViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ThirdPhotovoltaicPowerView">
<id column="ID" property="id" />
<result column="STATION_NAME" property="stationName" />
<result column="CREATE_DATE" property="createDate" />
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower" />
<result column="SYSTEM_SOURCE" property="systemSource" />
<id column="ID" property="id"/>
<result column="STATION_NAME" property="stationName"/>
<result column="CREATE_DATE" property="createDate"/>
<result column="PHOTOVOLTAIC_POWER" property="photovoltaicPower"/>
<result column="SYSTEM_SOURCE" property="systemSource"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
STATION_NAME,
CREATE_DATE,
PHOTOVOLTAIC_POWER,
SYSTEM_SOURCE
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.ThirdPhotovoltaicPowerView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_PHOTOVOLTAIC_POWER
where
id=#{id}
FROM THIRD_PHOTOVOLTAIC_POWER
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.ThirdPhotovoltaicPowerView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_PHOTOVOLTAIC_POWER
where
id=#{id}
FROM THIRD_PHOTOVOLTAIC_POWER
WHERE
ID=#{id}
</select>
<insert id="batchInsertList" parameterType="list">
......
......@@ -2,42 +2,45 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.ThirdWellAvgActivePowerViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.ThirdWellAvgActivePowerView">
<id column="ID" property="id" />
<result column="WELL_NUMBER" property="wellNumber" />
<result column="INPUT_TIME" property="inputTime" />
<result column="avg_active_power" property="avgActivePower" />
<result column="SYSTEM_SOURCE" property="systemSource" />
<result column="save_date" property="saveDate" />
<id column="ID" property="id"/>
<result column="WELL_NUMBER" property="wellNumber"/>
<result column="INPUT_TIME" property="inputTime"/>
<result column="AVG_ACTIVE_POWER" property="avgActivePower"/>
<result column="SYSTEM_SOURCE" property="systemSource"/>
<result column="SAVE_DATE" property="saveDate"/>
</resultMap>
<sql id="Base_Column_List">
id
ID
,
WELL_NUMBER,
INPUT_TIME,
avg_active_power,
AVG_ACTIVE_POWER,
SYSTEM_SOURCE,
save_date
SAVE_DATE
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.ThirdWellAvgActivePowerView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_WELL_AVG_ACTIVE_POWER
where
id=#{id}
FROM THIRD_WELL_AVG_ACTIVE_POWER
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.ThirdWellAvgActivePowerView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from THIRD_WELL_AVG_ACTIVE_POWER
where
id=#{id}
FROM THIRD_WELL_AVG_ACTIVE_POWER
WHERE
ID=#{id}
</select>
<insert id="batchInsertList" parameterType="list">
INSERT INTO THIRD_WELL_AVG_ACTIVE_POWER ( WELL_NUMBER, INPUT_TIME, avg_active_power, SYSTEM_SOURCE,
save_date )
INSERT INTO THIRD_WELL_AVG_ACTIVE_POWER ( WELL_NUMBER, INPUT_TIME, AVG_ACTIVE_POWER, SYSTEM_SOURCE,
SAVE_DATE )
VALUES
<foreach collection="list" item="item" separator=",">
(
......@@ -52,16 +55,16 @@
<resultMap id="ExtBaseResultMap" type="pps.core.prediction.entity.ThirdWellAvgActivePowerView"
extends="BaseResultMap">
<result column="hour_number" property="hourNumber" />
<result column="HOUR_NUMBER" property="hourNumber"/>
</resultMap>
<select id="selectMeterPower" parameterType="pps.core.prediction.entity.ThirdWellAvgActivePowerView"
resultMap="BaseResultMap">
SELECT
hour_str AS hour_number,
IFNULL( AVG( avg_active_power ), 0 ) AS avg_active_power
HOUR_STR AS HOUR_NUMBER,
IFNULL( AVG( AVG_ACTIVE_POWER ), 0 ) AS AVG_ACTIVE_POWER
FROM
( SELECT WELL_NUMBER, HOUR ( INPUT_TIME ) AS hour_str, avg_active_power FROM THIRD_WELL_AVG_ACTIVE_POWER
( SELECT WELL_NUMBER, HOUR ( INPUT_TIME ) AS HOUR_STR, AVG_ACTIVE_POWER FROM THIRD_WELL_AVG_ACTIVE_POWER
<where>
<if test="inputTime != null">
AND DATE ( INPUT_TIME ) = #{inputTime}
......@@ -73,11 +76,11 @@
</foreach>
</if>
</where>
) z
) Z
GROUP BY
hour_str
HOUR_STR
ORDER BY
hour_str
HOUR_STR
</select>
<select id="selectPowerConsumptionHour" parameterType="pps.core.prediction.entity.ThirdWellAvgActivePowerView"
......@@ -85,23 +88,23 @@
SELECT
<choose>
<when test="systemSource == 'SY'">
ROUND( SUM( avg_active_power )/ 1000, 2 ) AS avg_active_power,
ROUND( SUM( AVG_ACTIVE_POWER )/ 1000, 2 ) AS AVG_ACTIVE_POWER,
</when>
<otherwise>
ROUND( SUM( avg_active_power ), 2 ) AS avg_active_power,
ROUND( SUM( AVG_ACTIVE_POWER ), 2 ) AS AVG_ACTIVE_POWER,
</otherwise>
</choose>
INPUT_TIME
FROM
(
SELECT
IFNULL( AVG( avg_active_power ), 0 ) AS avg_active_power,
z.INPUT_TIME,
z.WELL_NUMBER
IFNULL( AVG( AVG_ACTIVE_POWER ), 0 ) AS AVG_ACTIVE_POWER,
Z.INPUT_TIME,
Z.WELL_NUMBER
FROM
(
SELECT
avg_active_power,
AVG_ACTIVE_POWER,
<choose>
<when test="dayFlag == 3">
DATE_FORMAT( INPUT_TIME, '%Y-%m-01' ) AS INPUT_TIME,
......@@ -129,11 +132,11 @@
<if test="systemSource != null">
AND SYSTEM_SOURCE = #{systemSource}
</if>
)) z
)) Z
GROUP BY
z.WELL_NUMBER,
z.INPUT_TIME
) z
Z.WELL_NUMBER,
Z.INPUT_TIME
) Z
GROUP BY
INPUT_TIME
ORDER BY
......
......@@ -2,78 +2,80 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.prediction.mapper.WellheadDailyProductionSituationViewMapper">
<resultMap id="BaseResultMap" type="pps.core.prediction.entity.WellheadDailyProductionSituationView">
<id column="ID" property="id" />
<result column="WELLHEAD_ID" property="wellheadId" />
<result column="WELL_NUMBER" property="wellNumber" />
<result column="DATA_DATE" property="dataDate" />
<result column="production_time" property="productionTime" />
<result column="DAILY_ELECTRICITY_CONSUMPTION" property="dailyElectricityConsumption" />
<result column="DAILY_LIQUID_PRODUCTION" property="dailyLiquidProduction" />
<result column="SYSTEM_SOURCE" property="systemSource" />
<result column="daily_utility_electricity_consumption" property="dailyUtilityElectricityConsumption"
/>
<result column="electricity_consumption_ph" property="electricityConsumptionPh" />
<result column="electricity_consumption_hh" property="electricityConsumptionHh" />
<result column="electricity_consumption_np" property="electricityConsumptionNp" />
<result column="electricity_consumption_vh" property="electricityConsumptionVh" />
<result column="electricity_charge_city" property="electricityChargeCity" />
<result column="electricity_charges_ph" property="electricityChargesPh" />
<result column="peak_hour_tariff" property="peakHourTariff" />
<result column="normal_period_tariff" property="normalPeriodTariff" />
<result column="alley_hours_tariff" property="alleyHoursTariff" />
<result column="CREATE_DATE" property="createDate" />
<id column="ID" property="id"/>
<result column="WELLHEAD_ID" property="wellheadId"/>
<result column="WELL_NUMBER" property="wellNumber"/>
<result column="DATA_DATE" property="dataDate"/>
<result column="PRODUCTION_TIME" property="productionTime"/>
<result column="DAILY_ELECTRICITY_CONSUMPTION" property="dailyElectricityConsumption"/>
<result column="DAILY_LIQUID_PRODUCTION" property="dailyLiquidProduction"/>
<result column="SYSTEM_SOURCE" property="systemSource"/>
<result column="DAILY_UTILITY_ELECTRICITY_CONSUMPTION" property="dailyUtilityElectricityConsumption"/>
<result column="ELECTRICITY_CONSUMPTION_PH" property="electricityConsumptionPh"/>
<result column="ELECTRICITY_CONSUMPTION_HH" property="electricityConsumptionHh"/>
<result column="ELECTRICITY_CONSUMPTION_NP" property="electricityConsumptionNp"/>
<result column="ELECTRICITY_CONSUMPTION_VH" property="electricityConsumptionVh"/>
<result column="ELECTRICITY_CHARGE_CITY" property="electricityChargeCity"/>
<result column="ELECTRICITY_CHARGES_PH" property="electricityChargesPh"/>
<result column="PEAK_HOUR_TARIFF" property="peakHourTariff"/>
<result column="NORMAL_PERIOD_TARIFF" property="normalPeriodTariff"/>
<result column="ALLEY_HOURS_TARIFF" property="alleyHoursTariff"/>
<result column="CREATE_DATE" property="createDate"/>
</resultMap>
<sql id="Base_Column_List">
id
,
ID
,
WELLHEAD_ID,
WELL_NUMBER,
data_date,
production_time,
DATA_DATE,
PRODUCTION_TIME,
DAILY_ELECTRICITY_CONSUMPTION,
DAILY_LIQUID_PRODUCTION,
daily_utility_electricity_consumption,
electricity_consumption_ph,
electricity_consumption_hh,
electricity_consumption_np,
electricity_consumption_vh,
electricity_charge_city,
electricity_charges_ph,
peak_hour_tariff,
normal_period_tariff,
alley_hours_tariff,
DAILY_UTILITY_ELECTRICITY_CONSUMPTION,
ELECTRICITY_CONSUMPTION_PH,
ELECTRICITY_CONSUMPTION_HH,
ELECTRICITY_CONSUMPTION_NP,
ELECTRICITY_CONSUMPTION_VH,
ELECTRICITY_CHARGE_CITY,
ELECTRICITY_CHARGES_PH,
PEAK_HOUR_TARIFF,
NORMAL_PERIOD_TARIFF,
ALLEY_HOURS_TARIFF,
SYSTEM_SOURCE,
CREATE_DATE
</sql>
<select id="selectOne" parameterType="pps.core.prediction.entity.WellheadDailyProductionSituationView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from WELLHEAD_DAILY_PRODUCTION_SITUATION
where
id=#{id}
FROM WELLHEAD_DAILY_PRODUCTION_SITUATION
WHERE
ID=#{id}
</select>
<select id="selectList" parameterType="pps.core.prediction.entity.WellheadDailyProductionSituationView"
resultMap="BaseResultMap">
select
SELECT
<include refid="Base_Column_List"/>
from WELLHEAD_DAILY_PRODUCTION_SITUATION
where
id=#{id}
FROM WELLHEAD_DAILY_PRODUCTION_SITUATION
WHERE
ID=#{id}
</select>
<insert id="batchInsertList" parameterType="list">
INSERT INTO WELLHEAD_DAILY_PRODUCTION_SITUATION ( WELLHEAD_ID, WELL_NUMBER, data_date, production_time,
DAILY_ELECTRICITY_CONSUMPTION, DAILY_LIQUID_PRODUCTION, SYSTEM_SOURCE, daily_utility_electricity_consumption,
electricity_consumption_ph,
electricity_consumption_hh,
electricity_consumption_np,
electricity_consumption_vh,
electricity_charge_city,
electricity_charges_ph,
peak_hour_tariff,
normal_period_tariff,
alley_hours_tariff,
INSERT INTO WELLHEAD_DAILY_PRODUCTION_SITUATION ( WELLHEAD_ID, WELL_NUMBER, DATA_DATE, PRODUCTION_TIME,
DAILY_ELECTRICITY_CONSUMPTION, DAILY_LIQUID_PRODUCTION, SYSTEM_SOURCE, DAILY_UTILITY_ELECTRICITY_CONSUMPTION,
ELECTRICITY_CONSUMPTION_PH,
ELECTRICITY_CONSUMPTION_HH,
ELECTRICITY_CONSUMPTION_NP,
ELECTRICITY_CONSUMPTION_VH,
ELECTRICITY_CHARGE_CITY,
ELECTRICITY_CHARGES_PH,
PEAK_HOUR_TARIFF,
NORMAL_PERIOD_TARIFF,
ALLEY_HOURS_TARIFF,
CREATE_DATE
)
VALUES
......@@ -103,23 +105,23 @@
<resultMap id="SumResultMap" type="pps.core.prediction.entity.WellheadDailyProductionSituationView"
extends="BaseResultMap">
<result column="LINE_ID" property="lineId" />
<result column="LINE_NAME" property="lineName" />
<result column="LINE_ID" property="lineId"/>
<result column="LINE_NAME" property="lineName"/>
</resultMap>
<select id="selectSumDailyElectricityConsumption" parameterType="date"
resultType="pps.core.prediction.entity.WellheadDailyProductionSituationView">
SELECT w.line_id AS line_id,
l.LINE_NAME AS LINE_NAME,
IFNULL(SUM(s.DAILY_ELECTRICITY_CONSUMPTION), 0) AS DAILY_ELECTRICITY_CONSUMPTION
FROM BASE_POWER_LINE_WELLHEAD w
JOIN WELLHEAD_DAILY_PRODUCTION_SITUATION s ON w.WELLHEAD_ID = s.WELLHEAD_ID
LEFT JOIN BASE_POWER_LINE l ON w.line_id = l.id
WHERE w.is_deleted = 1
AND s.data_date = #{date}
SELECT W.LINE_ID AS LINE_ID,
L.LINE_NAME AS LINE_NAME,
IFNULL(SUM(S.DAILY_ELECTRICITY_CONSUMPTION), 0) AS DAILY_ELECTRICITY_CONSUMPTION
FROM BASE_POWER_LINE_WELLHEAD W
JOIN WELLHEAD_DAILY_PRODUCTION_SITUATION S ON W.WELLHEAD_ID = S.WELLHEAD_ID
LEFT JOIN BASE_POWER_LINE L ON W.LINE_ID = L.ID
WHERE W.IS_DELETED = 1
AND S.DATA_DATE = #{date}
<if test="systemSource != null">
AND s.SYSTEM_SOURCE = #{systemSource}
AND S.SYSTEM_SOURCE = #{systemSource}
</if>
GROUP BY w.line_id
GROUP BY W.LINE_ID
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment