Commit b82fd2bc authored by chenzhao's avatar chenzhao

修改代码

parent c87f5901
...@@ -7,9 +7,9 @@ import lombok.Getter; ...@@ -7,9 +7,9 @@ import lombok.Getter;
@AllArgsConstructor @AllArgsConstructor
public enum StationType { public enum StationType {
FJC("风电场","FJC"), FJC("风电场","FDZ"),
JZGFC("集中光伏场","JZGFC"), JZGFC("集中光伏场","JZSGFDZ"),
FBSGFC("分布式光伏场","FBSGFC"); FBSGFC("分布式光伏场","FBSGFDZ");
......
...@@ -72,6 +72,9 @@ public class MonitorFanIdxController extends BaseController { ...@@ -72,6 +72,9 @@ public class MonitorFanIdxController extends BaseController {
MonitorFanIndicatorImpl monitorFanIndicatorImpl; MonitorFanIndicatorImpl monitorFanIndicatorImpl;
@Autowired @Autowired
CommonServiceImpl commonServiceImpl;
@Autowired
MonitorFanIndicatorImpl monitorFanIndicator; MonitorFanIndicatorImpl monitorFanIndicator;
@Autowired @Autowired
...@@ -280,7 +283,8 @@ public class MonitorFanIdxController extends BaseController { ...@@ -280,7 +283,8 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "概览-全站功率曲线") @ApiOperation(value = "概览-全站功率曲线")
@GetMapping("/overviewWindSpeed") @GetMapping("/overviewWindSpeed")
public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type) { public ResponseModel<Map<String, Object>> getOverviewWindSpeed(@RequestParam(value = "stationId", required = false)String stationId,@RequestParam(value = "type", required = false)String type
,@RequestParam(value = "areaCode", required = false)String areaCode) {
String gatewayId = ""; String gatewayId = "";
if (null != stationId){ if (null != stationId){
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
...@@ -735,11 +739,15 @@ public class MonitorFanIdxController extends BaseController { ...@@ -735,11 +739,15 @@ public class MonitorFanIdxController extends BaseController {
public ResponseModel<Map<String,String>> getStatisticsInfo(@RequestParam(value = "equipmentIndexName", required = false) String equipmentIndexName, public ResponseModel<Map<String,String>> getStatisticsInfo(@RequestParam(value = "equipmentIndexName", required = false) String equipmentIndexName,
@RequestParam(value = "stationId", required = false) String stationId, @RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "stationType", required = false) String stationType) { @RequestParam(value = "stationType", required = false) String stationType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); String gatewayId = "";
String gatewayId = stationBasic.getFanGatewayId(); if (null != stationId){
if (null != stationType){ StationBasic stationBasic = stationBasicMapper.selectById(stationId);
gatewayId = stationBasic.getBoosterGatewayId(); gatewayId = stationBasic.getFanGatewayId();
} if (null != stationType){
gatewayId = stationBasic.getBoosterGatewayId();
}
}
return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(gatewayId,equipmentIndexName )); return ResponseHelper.buildResponse(monitorFanIndicator.getStatisticsInfo(gatewayId,equipmentIndexName ));
} }
...@@ -923,8 +931,8 @@ public class MonitorFanIdxController extends BaseController { ...@@ -923,8 +931,8 @@ public class MonitorFanIdxController extends BaseController {
for (StationType value : StationType.values()) { for (StationType value : StationType.values()) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
List<StationCacheInfoDto> dtos = listMap.get(value.getCode()); List<StationCacheInfoDto> dtos = listMap.get(value.getCode());
map.put("data",dtos.size()); map.put("data",dtos == null ? 0 :dtos.size());
map.put("title",dtos.stream().filter(obj -> !ObjectUtils.isEmpty(obj.getInstalledCapacity())).mapToDouble(l->Double.parseDouble(l.getInstalledCapacity())).sum()); map.put("title",dtos == null ? 0 :dtos.stream().filter(obj -> !ObjectUtils.isEmpty(obj.getInstalledCapacity())).mapToDouble(l->Double.parseDouble(l.getInstalledCapacity())).sum());
mapList.add(map); mapList.add(map);
} }
...@@ -941,12 +949,18 @@ public class MonitorFanIdxController extends BaseController { ...@@ -941,12 +949,18 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "社会贡献 ") @ApiOperation(value = "社会贡献 ")
@GetMapping("/SocialContribution") @GetMapping("/SocialContribution")
public ResponseModel<Page<SocialContributionDto> > socialContribution() { public ResponseModel<Page<SocialContributionDto> > socialContribution(String areaCode ) {
List<String> value=new ArrayList<>(); List<String> value=new ArrayList<>();
value.add(NFDL); value.add(NFDL);
Map<String,List<String>> map=new HashMap<>(); Map<String,List<String>> map=new HashMap<>();
map.put("equipmentIndexName.keyword",value); map.put("equipmentIndexName.keyword",value);
if (null != areaCode){
List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
List<String> collect = listStationCacheInfoDto.stream().filter(e -> e.getBelongArea().equals(areaCode)).map(StationCacheInfoDto::getFanGatewayId).collect(Collectors.toList());
map.put("gateWayId",collect);
}
List<? extends Terms.Bucket> lidate= commonService.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword", ESEquipments.class); List<? extends Terms.Bucket> lidate= commonService.getgroupsum(map,"valueDouble" ,"equipmentIndexName.keyword", ESEquipments.class);
DecimalFormat format2 = new DecimalFormat("#.0000"); DecimalFormat format2 = new DecimalFormat("#.0000");
...@@ -973,19 +987,16 @@ public class MonitorFanIdxController extends BaseController { ...@@ -973,19 +987,16 @@ public class MonitorFanIdxController extends BaseController {
BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery(); BoolQueryBuilder boolMustAll = QueryBuilders.boolQuery();
//警情状态 //警情状态
BoolQueryBuilder qb0 = QueryBuilders.boolQuery(); List<QueryBuilder> should = boolMustAll.should();
String[] keys = new String[] {"日发电量","月发电量","年发电量"}; String[] keys = new String[] {"日发电量","月发电量","年发电量"};
List<String> list = Arrays.asList(keys); List<String> list = Arrays.asList(keys);
qb0.must((QueryBuilders.termsQuery("equipmentIndexName.keyword", list))); BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
boolMustAll.must(qb0); boolQueryBuilder.must((QueryBuilders.termsQuery("equipmentIndexName.keyword", list))).must(QueryBuilders.matchQuery("gatewayId.keyword","1668801435891929089"));
BoolQueryBuilder qb1 = QueryBuilders.boolQuery(); should.add(boolQueryBuilder);
qb1.must(QueryBuilders.matchQuery("gatewayId.keyword","1668801435891929089"));
boolMustAll.must(qb1);
// 创建查询构造器 // 创建查询构造器
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder() NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
// 分页 // 分页
.withPageable(PageRequest.of(current, size))
//过滤条件 //过滤条件
.withQuery(boolMustAll); .withQuery(boolMustAll);
......
...@@ -20,6 +20,7 @@ import org.elasticsearch.search.aggregations.Aggregations; ...@@ -20,6 +20,7 @@ import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms; import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
import org.elasticsearch.search.aggregations.metrics.AvgAggregationBuilder;
import org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder; import org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
...@@ -213,4 +214,40 @@ public class CommonServiceImpl { ...@@ -213,4 +214,40 @@ public class CommonServiceImpl {
return search.getSearchHits().size(); return search.getSearchHits().size();
} }
/*
*分组平均值
**/
public List<? extends Terms.Bucket> getgroupavg(Map<String,List<String>> value,String keyavg,String groupKey,Class clas){
List<? extends Terms.Bucket> listdata=null;
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
for(String key:value.keySet()){
List<String> va= value.get(key);
queryBuilder.must( QueryBuilders.termsQuery(key, va));
}
TermsAggregationBuilder tb1 = AggregationBuilders.terms("groupKey").field(groupKey);
AvgAggregationBuilder buyCountAvg = AggregationBuilders.avg("buyCountAvg").field(keyavg);
tb1.subAggregation(buyCountAvg); // 通过typeId字段分组统计总数
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.addAggregation(tb1)
.withPageable(PageRequest.of(0, 1))
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, ESEquipments.class);
if (search.hasAggregations()) {
Aggregations aggregations = search.getAggregations();
if (Objects.nonNull(aggregations)) {
List<Aggregation> list= aggregations.asList();
listdata= list!=null&&!list.isEmpty()?((ParsedStringTerms) list.get(0)).getBuckets():null;
}
}
return listdata;
}
} }
...@@ -540,9 +540,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -540,9 +540,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String,Object> map1 = new HashMap<>(); Map<String,Object> map1 = new HashMap<>();
Map<String,Object> map2 = new HashMap<>(); Map<String,Object> map2 = new HashMap<>();
map1.put("data", values); map1.put("data", values);
map2.put("data", valueList); if (StringUtils.isNotEmpty(gatewayId)){
map2.put("data", valueList);
seriesData.add(map2);
}
seriesData.add(map1); seriesData.add(map1);
seriesData.add(map2);
map.put("seriesData", seriesData); map.put("seriesData", seriesData);
map.put("axisData",time); map.put("axisData",time);
......
...@@ -80,3 +80,7 @@ spring.elasticsearch.rest.connection-timeout=30000 ...@@ -80,3 +80,7 @@ spring.elasticsearch.rest.connection-timeout=30000
spring.elasticsearch.rest.username=elastic spring.elasticsearch.rest.username=elastic
spring.elasticsearch.rest.password=123456 spring.elasticsearch.rest.password=123456
spring.elasticsearch.rest.read-timeout=30000 spring.elasticsearch.rest.read-timeout=30000
daily.power.generation.cron=*/30 * * * * ?
moon.power.generation.cron=*/30 * * * * ?
year.power.generation.cron=*/30 * * * * ?
\ No newline at end of file
...@@ -69,7 +69,7 @@ public class PowerGeneration { ...@@ -69,7 +69,7 @@ public class PowerGeneration {
} }
//定时更新月发电量 //定时更新月发电量
@Scheduled(cron = "${moon.power.generation.cron}") @Scheduled(cron = "${moon.power.generation.cron}")
public void addESMoonPowerGeneration(){ public void addESMoonPowerGeneration(){
List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto(); List<StationCacheInfoDto> list =commonServiceImpl.getListStationCacheInfoDto();
//获取时间天字符串 //获取时间天字符串
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl; package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationPlan; import com.yeejoin.amos.boot.module.jxiop.api.entity.StationPlan;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationPlanMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationPlanMapper;
...@@ -7,6 +8,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments; ...@@ -7,6 +8,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.SeriesData; import com.yeejoin.amos.boot.module.jxiop.biz.dto.SeriesData;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.TimeDate; import com.yeejoin.amos.boot.module.jxiop.biz.dto.TimeDate;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil; import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.aggregations.bucket.terms.Terms;
...@@ -14,6 +16,8 @@ import org.elasticsearch.search.aggregations.metrics.ParsedAvg; ...@@ -14,6 +16,8 @@ import org.elasticsearch.search.aggregations.metrics.ParsedAvg;
import org.elasticsearch.search.aggregations.metrics.ParsedSum; import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -31,6 +35,8 @@ public class LargeScreenImpl { ...@@ -31,6 +35,8 @@ public class LargeScreenImpl {
CommonServiceImpl commonServiceImpl; CommonServiceImpl commonServiceImpl;
@Autowired @Autowired
StationPlanMapper StationPlanMapper; StationPlanMapper StationPlanMapper;
@Autowired
EmqKeeper emqKeeper;
private final String SS = "瞬时风速"; private final String SS = "瞬时风速";
private final String ZFS = "WTX-801_25_WTX-801_总辐射"; private final String ZFS = "WTX-801_25_WTX-801_总辐射";
...@@ -134,6 +140,11 @@ public class LargeScreenImpl { ...@@ -134,6 +140,11 @@ public class LargeScreenImpl {
Double ybfbn = sumValuen > 0 ? mapdta.get("NFD") / sumValue * 100 : 0; Double ybfbn = sumValuen > 0 ? mapdta.get("NFD") / sumValue * 100 : 0;
ybfbn = new BigDecimal(ybfbn).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); ybfbn = new BigDecimal(ybfbn).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
mapdta.put("NJHWC", ybfbn); mapdta.put("NJHWC", ybfbn);
try {
emqKeeper.getMqttClient().publish("topic", JSON.toJSONString(mapdta).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return mapdta; return mapdta;
} }
...@@ -234,6 +245,11 @@ public class LargeScreenImpl { ...@@ -234,6 +245,11 @@ public class LargeScreenImpl {
Double ybfbn = sumValuen > 0 ? mapdta.get("NFD") / sumValue * 100 : 0; Double ybfbn = sumValuen > 0 ? mapdta.get("NFD") / sumValue * 100 : 0;
ybfbn = new BigDecimal(ybfbn).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue(); ybfbn = new BigDecimal(ybfbn).setScale(4, BigDecimal.ROUND_HALF_UP).doubleValue();
mapdta.put("NJHWC", ybfbn); mapdta.put("NJHWC", ybfbn);
try {
emqKeeper.getMqttClient().publish("topic", JSON.toJSONString(mapdta).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return mapdta; return mapdta;
} }
...@@ -267,6 +283,11 @@ public class LargeScreenImpl { ...@@ -267,6 +283,11 @@ public class LargeScreenImpl {
//获取日期 //获取日期
List<String> listdate= dayReportnq(new Date()); List<String> listdate= dayReportnq(new Date());
seriesData.setAxisData(listdate); seriesData.setAxisData(listdate);
try {
emqKeeper.getMqttClient().publish("topic", JSON.toJSONString(seriesData).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return seriesData; return seriesData;
} }
...@@ -298,6 +319,12 @@ public class LargeScreenImpl { ...@@ -298,6 +319,12 @@ public class LargeScreenImpl {
//获取日期 //获取日期
List<String> listdate= dayReportnq(new Date()); List<String> listdate= dayReportnq(new Date());
seriesData.setAxisData(listdate); seriesData.setAxisData(listdate);
try {
emqKeeper.getMqttClient().publish("topic", JSON.toJSONString(seriesData).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return seriesData; return seriesData;
} }
...@@ -341,6 +368,11 @@ public class LargeScreenImpl { ...@@ -341,6 +368,11 @@ public class LargeScreenImpl {
listdate.add(0d); listdate.add(0d);
} }
} }
try {
emqKeeper.getMqttClient().publish("topic", JSON.toJSONString(listdate).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return listdate; return listdate;
...@@ -387,6 +419,12 @@ public class LargeScreenImpl { ...@@ -387,6 +419,12 @@ public class LargeScreenImpl {
} }
} }
try {
emqKeeper.getMqttClient().publish("topic", JSON.toJSONString(listdate).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return listdate; return listdate;
} }
...@@ -433,8 +471,14 @@ public class LargeScreenImpl { ...@@ -433,8 +471,14 @@ public class LargeScreenImpl {
list.add(m+"-"+String.valueOf(i+1)); list.add(m+"-"+String.valueOf(i+1));
} }
try {
emqKeeper.getMqttClient().publish("topic", JSON.toJSONString(list).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return list; return list;
} }
} }
\ No newline at end of file
...@@ -43,7 +43,7 @@ public class PowerGenerationImpl { ...@@ -43,7 +43,7 @@ public class PowerGenerationImpl {
public List<IndexDto> getlast(String gatewayId, String value,String daty){ public List<IndexDto> getlast(String gatewayId, String value,String daty){
IndexDto indexDto=null; IndexDto indexDto=null;
String querySql = " SELECT * FROM test_%s WHERE equipmentIndexName='%s' and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1"; String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
querySql = String.format(querySql, gatewayId, value,daty,daty); querySql = String.format(querySql, gatewayId, value,daty,daty);
List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class); List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
...@@ -51,7 +51,7 @@ public class PowerGenerationImpl { ...@@ -51,7 +51,7 @@ public class PowerGenerationImpl {
} }
public List<IndexDto> getlastgf(String gatewayId, String value,String daty){ public List<IndexDto> getlastgf(String gatewayId, String value,String daty){
IndexDto indexDto=null; IndexDto indexDto=null;
String querySql = " SELECT * FROM test_%s WHERE equipmentIndexName='%s' and equipmentSpecificName =~/.*逆变器.*/ and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1"; String querySql = " SELECT * FROM iot_data_%s WHERE equipmentIndexName='%s' and equipmentSpecificName =~/.*逆变器.*/ and time >='%sT00:55:00Z' AND time < '%sT23:59:59Z' group by equipmentsIdx order by time desc LIMIT 1";
querySql = String.format(querySql, gatewayId, value,daty,daty); querySql = String.format(querySql, gatewayId, value,daty,daty);
List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class); List<IndexDto> queryList = influxDButils.getListData(querySql,IndexDto.class);
......
...@@ -126,9 +126,9 @@ fan.statuts.stattuspath=upload/jxiop/device_status ...@@ -126,9 +126,9 @@ fan.statuts.stattuspath=upload/jxiop/device_status
pictureUrl=upload/jxiop/syz/ pictureUrl=upload/jxiop/syz/
daily.power.generation.cron=* * */10 * * ? daily.power.generation.cron=0/30 * * * * ?
moon.power.generation.cron=* * */10 * * ? moon.power.generation.cron=0/30 * * * * ?
year.power.generation.cron=* * */10 * * ? year.power.generation.cron=0/30 * * * * ?
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
gatewayId = #{gatewayId} gatewayId = #{gatewayId}
</if> </if>
<if test="gatewayId == null or gatewayId == ''"> <if test="gatewayId == null or gatewayId == ''">
equipmentNumber is not null equipmentNumber is not null and equipmentIndexName is not null
</if> </if>
</where> </where>
GROUP BY batch_no ,equipmentIndexName; GROUP BY batch_no ,equipmentIndexName;
...@@ -25,15 +25,29 @@ ...@@ -25,15 +25,29 @@
<select id="getStatisticsInfo" resultType="map"> <select id="getStatisticsInfo" resultType="map">
SELECT SELECT
avg( VALUE ) AS mean, avg( VALUE ) AS mean,
( SELECT created_time FROM temporary_data WHERE gatewayId = #{gatewayId} and equipmentIndexName =#{equipmentIndexName} ORDER BY `value` LIMIT 1 ) AS minTime, ( SELECT created_time FROM temporary_data WHERE
equipmentIndexName =#{equipmentIndexName}
<if test="gatewayId != null and gatewayId != ''">
and gatewayId = #{gatewayId}
</if>
ORDER BY `value` LIMIT 1 ) AS minTime,
max( `value` ) AS max, max( `value` ) AS max,
( SELECT created_time FROM temporary_data WHERE gatewayId = #{gatewayId} and equipmentIndexName =#{equipmentIndexName} ORDER BY `value` DESC LIMIT 1 ) AS maxTime, ( SELECT created_time FROM temporary_data WHERE
equipmentIndexName =#{equipmentIndexName}
<if test="gatewayId != null and gatewayId != ''">
and gatewayId = #{gatewayId}
</if> ORDER BY `value` DESC LIMIT 1 ) AS maxTime,
min( `value` ) AS min min( `value` ) AS min
FROM FROM
`temporary_data` `temporary_data`
WHERE <where>
<if test="gatewayId != null and gatewayId != ''">
gatewayId = #{gatewayId} and equipmentIndexName =#{equipmentIndexName} gatewayId = #{gatewayId} and equipmentIndexName =#{equipmentIndexName}
</if>
<if test="gatewayId == null or gatewayId == ''">
equipmentNumber is not null and equipmentIndexName is not null and equipmentIndexName =#{equipmentIndexName}
</if>
</where>
</select> </select>
......
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