Commit c70a3649 authored by ZWT's avatar ZWT

得到的

parent a0532dfd
...@@ -747,7 +747,7 @@ ...@@ -747,7 +747,7 @@
</select> </select>
<select id="selectOrgAndWindStationList" parameterType="pps.core.system.entity.SysOrganizationView" <select id="selectOrgAndWindStationList" parameterType="pps.core.system.entity.SysOrganizationView"
resultMap="ExtendResultMap"> resultMap="ExtendResultMap" databaseId="MySQL">
(SELECT ROW_NUMBER() OVER ( ORDER BY R.SORT ) AS RN, O.ID, (SELECT ROW_NUMBER() OVER ( ORDER BY R.SORT ) AS RN, O.ID,
O.OU_NAME AS OU_NAME, O.OU_NAME AS OU_NAME,
'' AS STATION_ID, '' AS STATION_ID,
...@@ -769,6 +769,37 @@ ...@@ -769,6 +769,37 @@
ORDER BY STATION_NAME) ORDER BY STATION_NAME)
</select> </select>
<select id="selectOrgAndWindStationList" parameterType="pps.core.system.entity.SysOrganizationView"
resultMap="ExtendResultMap" databaseId="Oracle">
WITH S1 AS (SELECT TO_CHAR( O.ID ) AS ID,
TO_CHAR( O.OU_NAME ) AS OU_NAME,
'' AS STATION_ID,
'ORG' AS OU_LEVEL
FROM SYS_ORGANIZATION O
LEFT JOIN SYS_ORGANIZATION_REL R ON O.ID = R.OU_ID
WHERE R.PARENT_OU_ID = #{id}
AND R.END_TIME >=
<include refid="now"/>
AND O.IS_DELETED = 1
ORDER BY R.SORT),
S2 AS (SELECT TO_CHAR( ID ) AS ID,
TO_CHAR( STATION_NAME ) AS OU_NAME,
TO_CHAR( ID ) AS STATION_ID,
'STATION' AS OU_LEVEL
FROM BASE_WIND_TURBINE
WHERE OU_ID = #{id}
AND IS_DELETED = 1
ORDER BY STATION_NAME,
CREATE_TIME) SELECT
*
FROM
S1 UNION ALL
SELECT
*
FROM
S2
</select>
<select id="selectChildLineList" parameterType="pps.core.system.entity.SysOrganizationView" <select id="selectChildLineList" parameterType="pps.core.system.entity.SysOrganizationView"
resultMap="ExtendResultMap"> resultMap="ExtendResultMap">
SELECT ID AS ID, SELECT ID AS ID,
......
...@@ -768,10 +768,19 @@ public class WindPredictionFutureService { ...@@ -768,10 +768,19 @@ public class WindPredictionFutureService {
* @return {@link Map }<{@link Date }, {@link WindPredictionFutureEnt }> * @return {@link Map }<{@link Date }, {@link WindPredictionFutureEnt }>
*/ */
private Map<Date, WindPredictionFutureEnt> getPredictedMap(XContext context, String stationId, DateTime beginTime, DateTime endTime) { private Map<Date, WindPredictionFutureEnt> getPredictedMap(XContext context, String stationId, DateTime beginTime, DateTime endTime) {
QueryWrapper<WindPredictionFutureEnt> queryWrapper = new QueryWrapper<>();
String property = context.getProperty("x.db.databaseId");
switch (property) {
case "Oracle":
queryWrapper.select("data_time", "NVL( MAX( actual_power ), 0 ) AS predicted_power",
"NVL( MAX( actual_wind_speed ), 0 ) AS actual_wind_speed", "NVL( MAX( wind_speed ), 0 ) AS wind_speed");
break;
default:
queryWrapper.select("data_time", "IFNULL( MAX( actual_power ), 0 ) AS predicted_power",
"IFNULL( MAX( actual_wind_speed ), 0 ) AS actual_wind_speed", "IFNULL( MAX( wind_speed ), 0 ) AS wind_speed");
}
WindPredictionFutureMapper mapper = context.getBean(WindPredictionFutureMapper.class); WindPredictionFutureMapper mapper = context.getBean(WindPredictionFutureMapper.class);
List<WindPredictionFutureEnt> predictedList = mapper.selectList(new QueryWrapper<WindPredictionFutureEnt>() List<WindPredictionFutureEnt> predictedList = mapper.selectList(queryWrapper
.select("data_time", "IFNULL( MAX( actual_power ), 0 ) AS predicted_power",
"IFNULL( MAX( actual_wind_speed ), 0 ) AS actual_wind_speed", "IFNULL( MAX( wind_speed ), 0 ) AS wind_speed")
.lambda() .lambda()
.eq(WindPredictionFutureEnt::getStationId, stationId) .eq(WindPredictionFutureEnt::getStationId, stationId)
.between(WindPredictionFutureEnt::getDataTime, beginTime, endTime) .between(WindPredictionFutureEnt::getDataTime, beginTime, endTime)
...@@ -801,9 +810,17 @@ public class WindPredictionFutureService { ...@@ -801,9 +810,17 @@ public class WindPredictionFutureService {
* @return {@link Map }<{@link Date }, {@link BigDecimal }> * @return {@link Map }<{@link Date }, {@link BigDecimal }>
*/ */
private Map<Date, BigDecimal> getPredictedMap(XContext context, List<String> stationIds, Date beginTime, Date endTime) { private Map<Date, BigDecimal> getPredictedMap(XContext context, List<String> stationIds, Date beginTime, Date endTime) {
QueryWrapper<WindPredictionFutureEnt> queryWrapper = new QueryWrapper<>();
String property = context.getProperty("x.db.databaseId");
switch (property) {
case "Oracle":
queryWrapper.select("data_time", "NVL( SUM( actual_power ), 0 ) AS predicted_power");
break;
default:
queryWrapper.select("data_time", "IFNULL( SUM( actual_power ), 0 ) AS predicted_power");
}
WindPredictionFutureMapper mapper = context.getBean(WindPredictionFutureMapper.class); WindPredictionFutureMapper mapper = context.getBean(WindPredictionFutureMapper.class);
List<WindPredictionFutureEnt> predictedList = mapper.selectList(new QueryWrapper<WindPredictionFutureEnt>() List<WindPredictionFutureEnt> predictedList = mapper.selectList(queryWrapper
.select("data_time", "IFNULL( SUM( actual_power ), 0 ) AS predicted_power")
.lambda() .lambda()
.in(WindPredictionFutureEnt::getStationId, stationIds) .in(WindPredictionFutureEnt::getStationId, stationIds)
.between(WindPredictionFutureEnt::getDataTime, beginTime, endTime) .between(WindPredictionFutureEnt::getDataTime, beginTime, endTime)
...@@ -857,9 +874,17 @@ public class WindPredictionFutureService { ...@@ -857,9 +874,17 @@ public class WindPredictionFutureService {
* @return {@link Map }<{@link Date }, {@link ThirdWindPowerGenerationEnt }> * @return {@link Map }<{@link Date }, {@link ThirdWindPowerGenerationEnt }>
*/ */
private Map<Date, ThirdWindPowerGenerationEnt> getActivePower15MinuteMap(XContext context, String stationId, DateTime beginTime, DateTime endTime) { private Map<Date, ThirdWindPowerGenerationEnt> getActivePower15MinuteMap(XContext context, String stationId, DateTime beginTime, DateTime endTime) {
QueryWrapper<ThirdWindPowerGenerationEnt> queryWrapper = new QueryWrapper<>();
String property = context.getProperty("x.db.databaseId");
switch (property) {
case "Oracle":
queryWrapper.select("collect_time", "NVL( MAX( actual_wind_speed ), 0 ) AS actual_wind_speed", "NVL( MAX( actual_power ), 0 ) AS actual_power");
break;
default:
queryWrapper.select("collect_time", "IFNULL( MAX( actual_wind_speed ), 0 ) AS actual_wind_speed", "IFNULL( MAX( actual_power ), 0 ) AS actual_power");
}
ThirdWindPowerGenerationMapper generationMapper = context.getBean(ThirdWindPowerGenerationMapper.class); ThirdWindPowerGenerationMapper generationMapper = context.getBean(ThirdWindPowerGenerationMapper.class);
List<ThirdWindPowerGenerationEnt> list = generationMapper.selectList(new QueryWrapper<ThirdWindPowerGenerationEnt>() List<ThirdWindPowerGenerationEnt> list = generationMapper.selectList(queryWrapper
.select("collect_time", "IFNULL( MAX( actual_wind_speed ), 0 ) AS actual_wind_speed", "IFNULL( MAX( actual_power ), 0 ) AS actual_power")
.groupBy("collect_time") .groupBy("collect_time")
.lambda() .lambda()
.eq(ThirdWindPowerGenerationEnt::getStationId, stationId) .eq(ThirdWindPowerGenerationEnt::getStationId, stationId)
......
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