Commit 3939948c authored by ZWT's avatar ZWT

得到的

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