Commit 3b6a3fbc authored by ZWT's avatar ZWT

得到的

parent 6bd11509
......@@ -29,7 +29,7 @@
</sql>
<select id="selectOne" parameterType="pps.core.base.entity.BasePhotovoltaicPlantMapeAdjView"
resultMap="BaseResultMap">
resultMap="BaseResultMap" databaseId="MySQL">
SELECT
<include refid="Base_Column_List"/>
FROM BASE_PHOTOVOLTAIC_PLANT_MAPE_ADJ
......@@ -48,6 +48,28 @@
LIMIT 1
</select>
<select id="selectOne" parameterType="pps.core.base.entity.BasePhotovoltaicPlantMapeAdjView"
resultMap="BaseResultMap" databaseId="Oracle">
SELECT * FROM (
SELECT
<include refid="Base_Column_List"/>
FROM BASE_PHOTOVOLTAIC_PLANT_MAPE_ADJ
<where>
<if test="plantId != null and plantId != ''">
AND PLANT_ID = #{plantId}
</if>
<if test="mapeType != null">
AND MAPE_TYPE = #{mapeType}
</if>
<if test="id != null">
AND ID = #{id}
</if>
</where>
ORDER BY CREATE_TIME DESC
)
WHERE ROWNUM = 1
</select>
<select id="selectList" parameterType="pps.core.base.entity.BasePhotovoltaicPlantMapeAdjView"
resultMap="BaseResultMap">
SELECT
......
......@@ -168,7 +168,7 @@ public class ServiceUtil {
PlantPredictedPowerShortTermMapper shortMapper = context.getBean(PlantPredictedPowerShortTermMapper.class);
List<PlantPredictedPowerShortTermEnt> predictedList = shortMapper.selectList(new LambdaQueryWrapper<PlantPredictedPowerShortTermEnt>()
.eq(PlantPredictedPowerShortTermEnt::getPlantId, stationId)
.between(PlantPredictedPowerShortTermEnt::getDataDate, beginTime, endTime)
.between(PlantPredictedPowerShortTermEnt::getDataDate, DateUtil.formatDate(beginTime), DateUtil.formatDate(endTime))
.orderByAsc(PlantPredictedPowerShortTermEnt::getDataDate)
);
if (CollUtil.isNotEmpty(predictedList)) {
......@@ -183,7 +183,7 @@ public class ServiceUtil {
PlantPredictedPowerMidTermMapper midMapper = context.getBean(PlantPredictedPowerMidTermMapper.class);
List<PlantPredictedPowerMidTermEnt> midList = midMapper.selectList(new LambdaQueryWrapper<PlantPredictedPowerMidTermEnt>()
.eq(PlantPredictedPowerMidTermEnt::getPlantId, stationId)
.between(PlantPredictedPowerMidTermEnt::getDataDate, beginTime, endTime)
.between(PlantPredictedPowerMidTermEnt::getDataDate, DateUtil.formatDate(beginTime), DateUtil.formatDate(endTime))
.orderByAsc(PlantPredictedPowerMidTermEnt::getDataDate)
);
if (CollUtil.isNotEmpty(midList)) {
......@@ -198,7 +198,7 @@ public class ServiceUtil {
PlantPredictedPowerUltraTermMapper ultraMapper = context.getBean(PlantPredictedPowerUltraTermMapper.class);
List<PlantPredictedPowerUltraTermEnt> ultraList = ultraMapper.selectList(new LambdaQueryWrapper<PlantPredictedPowerUltraTermEnt>()
.eq(PlantPredictedPowerUltraTermEnt::getPlantId, stationId)
.between(PlantPredictedPowerUltraTermEnt::getDataDate, beginTime, endTime)
.between(PlantPredictedPowerUltraTermEnt::getDataDate, DateUtil.formatDate(beginTime), DateUtil.formatDate(endTime))
.orderByAsc(PlantPredictedPowerUltraTermEnt::getDataDate)
);
if (CollUtil.isNotEmpty(ultraList)) {
......
......@@ -155,7 +155,7 @@
</select>
<select id="selectAvgPower15" parameterType="pps.core.prediction.entity.ThirdActivePowerView"
resultMap="BaseResultMap">
resultMap="BaseResultMap" databaseId="MySQL">
SELECT IFNULL(AVG(Z.PHOTOVOLTAIC_POWER), 0) AS PHOTOVOLTAIC_POWER,
Z.INPUT_TIME
FROM (SELECT PHOTOVOLTAIC_POWER,
......@@ -174,8 +174,54 @@
<otherwise>
CASE
WHEN MINUTE ( INPUT_TIME) IN ( 10, 40 ) THEN
DATE_SUB( INPUT_TIME, INTERVAL + 10 MINUTE )
INPUT_TIME - NUMTODSINTERVAL(10, 'MINUTE')
WHEN MINUTE ( INPUT_TIME ) IN ( 20, 50 ) THEN
INPUT_TIME - NUMTODSINTERVAL(5, 'MINUTE') ELSE INPUT_TIME
END INPUT_TIME
</otherwise>
</choose>
FROM
THIRD_ACTIVE_POWER
WHERE
STATION_ID = #{stationId}
AND INPUT_TIME &gt;= #{startTime}
<if test="endTime != null">
AND INPUT_TIME &lt;= #{endTime}
</if>
<if test="systemSource != null">
AND SYSTEM_SOURCE = #{systemSource}
</if>
ORDER BY
INPUT_TIME ASC
) Z
GROUP BY
Z.INPUT_TIME
ORDER BY
Z.INPUT_TIME
</select>
<select id="selectAvgPower15" parameterType="pps.core.prediction.entity.ThirdActivePowerView"
resultMap="BaseResultMap" databaseId="Oracle">
SELECT NVL(AVG(Z.PHOTOVOLTAIC_POWER), 0) AS PHOTOVOLTAIC_POWER,
Z.INPUT_TIME
FROM (SELECT PHOTOVOLTAIC_POWER,
<choose>
<when test="systemSource == 'SY'">
CASE
WHEN EXTRACT( MINUTE FROM CAST( CREATE_DATE AS TIMESTAMP ) ) &lt; 15 THEN
TO_CHAR( CREATE_DATE, 'YYYY-MM-dd HH24' ) || ':00:00'
WHEN EXTRACT( MINUTE FROM CAST( CREATE_DATE AS TIMESTAMP ) ) &lt; 30 THEN
TO_CHAR( CREATE_DATE, 'YYYY-MM-dd HH24' ) || ':15:00'
WHEN EXTRACT( MINUTE FROM CAST( CREATE_DATE AS TIMESTAMP ) ) &lt; 45 THEN
TO_CHAR( CREATE_DATE, 'YYYY-MM-dd HH24' ) || ':30:00'
ELSE TO_CHAR( CREATE_DATE, 'YYYY-MM-dd HH24' ) || ':45:00'
END INPUT_TIME
</when>
<otherwise>
CASE
WHEN EXTRACT( MINUTE FROM CAST( CREATE_DATE AS TIMESTAMP ) ) IN ( 10, 40 ) THEN
DATE_SUB( INPUT_TIME, INTERVAL + 10 MINUTE )
WHEN EXTRACT( MINUTE FROM CAST( CREATE_DATE AS TIMESTAMP ) ) IN ( 20, 50 ) THEN
DATE_SUB( INPUT_TIME, INTERVAL + 5 MINUTE ) ELSE INPUT_TIME
END INPUT_TIME
</otherwise>
......
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