Commit 353eb0b1 authored by zhangsen's avatar zhangsen

td相关

parent 34850efa
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.PvHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@RestController
@Api(tags = "智能分析相关API - TD数据源")
@RequestMapping(value = "/tdInfoQueryApi")
public class TdInfoQueryController {
@Autowired
private FanHealthIndexMapper fanHealthIndexMapper;
@Autowired
private PvHealthIndexMapper pvHealthIndexMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getFanHealthIndexInfo")
@ApiOperation(httpMethod = "GET", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
public ResponseModel<Page<FanHealthIndex>> getFanHealthIndexInfo(@RequestBody FanHealthIndexDto dto, @RequestParam String analysisObjType) {
dto.setAnalysisObjType(analysisObjType);
Page<FanHealthIndex> resultPage = new Page<>(dto.getCurrent(), dto.getSize());
dto.setCurrent((dto.getCurrent() - 1) * dto.getSize());
List<Map<String, String>> orderWeight = dto.getSorts().stream().sorted(Comparator.comparing(t -> Integer.parseInt(t.get("orderWeight")))).collect(Collectors.toList());
List<String> orderByList = new ArrayList<>();
for (Map<String, String> map : orderWeight) {
String replace = map.get("order").replace("end", "");
String columnOrder = map.get("columnKey") + " " + replace;
orderByList.add(columnOrder);
}
String join = String.join(",", orderByList);
dto.setOrderColumns(join);
List<FanHealthIndex> fanHealthIndexIPage = fanHealthIndexMapper.getInfoByPage(dto);
Integer infoByPageTotal = fanHealthIndexMapper.getInfoByPageTotal(dto);
resultPage.setRecords(fanHealthIndexIPage);
resultPage.setTotal(infoByPageTotal);
return ResponseHelper.buildResponse(resultPage);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/getPvHealthIndexInfo")
@ApiOperation(httpMethod = "GET", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏")
public ResponseModel<Page<PvHealthIndex>> getPvHealthIndexInfo(@RequestBody PvHealthIndexDto dto, @RequestParam String analysisObjType) {
dto.setAnalysisObjType(analysisObjType);
Page<PvHealthIndex> resultPage = new Page<>(dto.getCurrent(), dto.getSize());
dto.setCurrent((dto.getCurrent() - 1) * dto.getSize());
List<Map<String, String>> orderWeight = dto.getSorts().stream().sorted(Comparator.comparing(t -> Integer.parseInt(t.get("orderWeight")))).collect(Collectors.toList());
List<String> orderByList = new ArrayList<>();
for (Map<String, String> map : orderWeight) {
String replace = map.get("order").replace("end", "");
String columnOrder = map.get("columnKey") + " " + replace;
orderByList.add(columnOrder);
}
String join = String.join(",", orderByList);
dto.setOrderColumns(join);
List<PvHealthIndex> pvHealthIndexIPage = pvHealthIndexMapper.getInfoByPage(dto);
Integer infoByPageTotal = pvHealthIndexMapper.getInfoByPageTotal(dto);
resultPage.setRecords(pvHealthIndexIPage);
resultPage.setTotal(infoByPageTotal);
return ResponseHelper.buildResponse(resultPage);
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Data
public class FanHealthIndexDto implements Serializable {
private Long ts;
private String recDate;
private String analysisObjType;
private String analysisObjSeq;
private Double weight;
private Double healthIndex;
private String healthLevel;
private String analysisType;
private String analysisStartTime;
private String analysisEndTime;
private String area;
private String station;
private String subSystem;
private String number;
private String equipmentName;
private String gatewayId;
private String indexAddress;
private Double anomaly;
private String pointName;
private String analysisTime;
private String kks;
private String startDate;
private String endDate;
private List<Map<String, String>> sorts = new ArrayList<>();
private Integer current;
private Integer size;
private String orderColumns;
}
package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
*
*
* @author system_generator
* @date 2023-08-15
*/
@Data
public class PvHealthIndexDto {
private Long ts;
private String recDate;
private String analysisObjType;
private String analysisObjSeq;
private Double weight;
private Double healthIndex;
private String healthLevel;
private String analysisType;
private String analysisStartTime;
private String analysisEndTime;
private String area;
private String station;
private String subarray;
private String manufacturer;
private String deviceType;
private String gatewayId;
private String indexAddress;
private String equipmentName;
private Double anomaly;
private String pointName;
private String analysisTime;
private String kks;
private String startDate;
private String endDate;
private List<Map<String, String>> sorts = new ArrayList<>();
private Integer current;
private Integer size;
private String orderColumns;
}
......@@ -1708,7 +1708,7 @@ public class CommonServiceImpl {
}
idxBizFanHealthIndexService.saveBatch(idxBizFanHealthIndexs);
// 按时刻相关数据插入TDEngine 【异步】
insertFanDataTDEngine(fanHealthIndices1, format);
insertFanDataTDEngine(fanHealthIndices1, format, "按时刻");
}
......@@ -1732,7 +1732,8 @@ public class CommonServiceImpl {
* @param fanHealthIndices
*/
@Async
public void insertFanDataTDEngine(ArrayList<FanHealthIndex> fanHealthIndices, String recDate) {
public void insertFanDataTDEngine(ArrayList<FanHealthIndex> fanHealthIndices, String recDate, String analysisType) {
fanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", "按时刻");
// 按时刻 - 测点插入
ArrayList<FanHealthIndex> newList = new ArrayList<>();
for (int i = 0; i < fanHealthIndices.size(); i++) {
......@@ -1740,7 +1741,8 @@ public class CommonServiceImpl {
newList.add(fanHealthIndices.get(i));//循环将数据填入载体list
if (500 == newList.size() || i == fanHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
fanHealthIndexMapper.saveBatchHealthIndexList(newList, "fan_health_index_moment");
fanHealthIndexMapper.saveBatchHealthIndexList(newList, "fan_health_index_moment", analysisType);
fanHealthIndexMapper.saveBatchHealthIndexLatestInfo(newList, "fan_health_index_latest_data");
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
......@@ -1982,7 +1984,7 @@ public class CommonServiceImpl {
}
idxBizPvHealthIndexService.saveBatch(idxBizPvHealthIndexs);
//按时刻 - 相关数据插入
insertPvDataTDEngine(fanHealthIndices1, format);
insertPvDataTDEngine(fanHealthIndices1, format, "按时刻");
}
try {
logger.info("--------------------response: " + response);
......@@ -2000,7 +2002,10 @@ public class CommonServiceImpl {
* @param pvHealthIndices
*/
@Async
public void insertPvDataTDEngine(ArrayList<PvHealthIndex> pvHealthIndices, String recDate) {
public void insertPvDataTDEngine(ArrayList<PvHealthIndex> pvHealthIndices, String recDate, String analysisType) {
fanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", analysisType);
// 按时刻 - 测点插入
ArrayList<PvHealthIndex> newList = new ArrayList<>();
for (int i = 0; i < pvHealthIndices.size(); i++) {
......@@ -2008,7 +2013,8 @@ public class CommonServiceImpl {
newList.add(pvHealthIndices.get(i));//循环将数据填入载体list
if (500 == newList.size() || i == pvHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
pvHealthIndexMapper.saveBatchHealthIndexList(newList, "pv_health_index_moment");
pvHealthIndexMapper.saveBatchHealthIndexList(newList, "pv_health_index_moment", analysisType);
pvHealthIndexMapper.saveBatchHealthIndexLatestInfo(newList, "fan_health_index_latest_data");
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
......
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
......@@ -41,7 +42,8 @@ public class TdengineTimeServiceImpl {
@Autowired
private IdxBizPvHealthLevelMapper idxBizPvHealthLevelMapper;
@Value("${openHealth:true}")
Boolean openHealth;
/**
* 风电 - 按时刻生成子系统、设备、场站、区域 数据
......@@ -73,6 +75,10 @@ public class TdengineTimeServiceImpl {
*/
@Scheduled(cron = "0 0 0/1 * * ? ")
public void insertHourData() throws ParseException {
if (!openHealth) {
return;
}
fanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", "按小时");
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd HH:00:00");
// 8小时 + 59分钟
String startTime = DateUtils.dateFormat(DateUtils.dateAddMinutes(new Date(), -541), DateUtils.DATE_TIME_PATTERN);
......@@ -103,6 +109,10 @@ public class TdengineTimeServiceImpl {
*/
@Scheduled(cron = "0 0 0 1/1 * ? ")
public void insertDayData() throws ParseException {
if (!openHealth) {
return;
}
fanHealthIndexMapper.deleteAllDataByTableName("fan_health_index_latest_data", "按天");
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
String startTime = DateUtils.dateFormat(DateUtils.dateAddHours(new Date(), -32), DateUtils.DATE_TIME_PATTERN);
List<IdxBizFanHealthLevel> levelList = idxBizFanHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizFanHealthLevel>().eq(IdxBizFanHealthLevel::getAnalysisObjType, "测点").last("limit 4"));
......@@ -155,7 +165,8 @@ public class TdengineTimeServiceImpl {
newList.add(fanHealthIndex);//循环将数据填入载体list
if (500 == newList.size() || i == fanHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
fanHealthIndexMapper.saveBatchHealthIndexList(newList, tableName);
fanHealthIndexMapper.saveBatchHealthIndexList(newList, tableName, analysisType);
fanHealthIndexMapper.saveBatchHealthIndexLatestInfo(newList, "fan_health_index_latest_data");
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
......@@ -189,6 +200,10 @@ public class TdengineTimeServiceImpl {
*/
@Scheduled(cron = "0 0 0/1 * * ? ")
public void insertHourDataPv() throws ParseException {
if (!openHealth) {
return;
}
fanHealthIndexMapper.deleteAllDataByTableName("pv_health_index_latest_data", "按小时");
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd HH:00:00");
// 8小时 + 59分钟
String startTime = DateUtils.dateFormat(DateUtils.dateAddMinutes(new Date(), -541), DateUtils.DATE_TIME_PATTERN);
......@@ -219,6 +234,10 @@ public class TdengineTimeServiceImpl {
*/
@Scheduled(cron = "0 0 0 1/1 * ? ")
public void insertDayDataPv() throws ParseException {
if (!openHealth) {
return;
}
fanHealthIndexMapper.deleteAllDataByTableName("pv_health_index_latest_data", "按天");
String recDate = DateUtil.format(new Date(), "yyyy-MM-dd 00:00:00");
List<IdxBizPvHealthLevel> levelList = idxBizPvHealthLevelMapper.selectList(new LambdaQueryWrapper<IdxBizPvHealthLevel>().eq(IdxBizPvHealthLevel::getAnalysisObjType, "测点").last("limit 4"));
String startTime = DateUtils.dateFormat(DateUtils.dateAddHours(new Date(), -32), DateUtils.DATE_TIME_PATTERN);
......@@ -270,7 +289,8 @@ public class TdengineTimeServiceImpl {
newList.add(item);//循环将数据填入载体list
if (500 == newList.size() || i == pvHealthIndices.size() - 1) { //载体list达到要求,进行批量操作
//调用批量插入
pvHealthIndexMapper.saveBatchHealthIndexList(newList, tableName);
pvHealthIndexMapper.saveBatchHealthIndexList(newList, tableName, analysisType);
pvHealthIndexMapper.saveBatchHealthIndexLatestInfo(newList, "pv_health_index_latest_data");
newList.clear();//每次批量操作后,清空载体list,等待下次的数据填入
}
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexDay;
......@@ -24,7 +25,11 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName);
int saveBatchHealthIndexList(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
int saveBatchHealthIndexLatestInfo(@Param("list") List<FanHealthIndex> list, @Param("tableName") String tableName);
void deleteAllDataByTableName(@Param("tableName") String tableName, @Param("analysisType") String analysisType);
/**
* 测点
......@@ -62,4 +67,8 @@ public interface FanHealthIndexMapper extends BaseMapper<FanHealthIndex> {
List<FanHealthIndex> getInfoListByGroupByQyFan(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<FanHealthIndex> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
Integer getInfoByPageTotal(@Param("dto") FanHealthIndexDto dto);
}
package com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.PvHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex;
......@@ -27,7 +29,9 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
"</script>")
List<FanHealthIndexDay> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName);
int saveBatchHealthIndexList(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName, @Param("analysisType") String analysisType);
int saveBatchHealthIndexLatestInfo(@Param("list") List<PvHealthIndex> list, @Param("tableName") String tableName);
List<PvHealthIndex> getInfoListByGroupByCdPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
......@@ -48,4 +52,9 @@ public interface PvHealthIndexMapper extends BaseMapper<PvHealthIndex> {
List<PvHealthIndex> getInfoListByGroupByQyPv(@Param("startTime") String startTime,
@Param("tableName") String tableName,
@Param("analysisObjectType") String analysisObjectType);
List<PvHealthIndex> getInfoByPage(@Param("dto") PvHealthIndexDto dto);
Integer getInfoByPageTotal(@Param("dto") PvHealthIndexDto dto);
}
......@@ -5,7 +5,7 @@
<insert id="saveBatchHealthIndexList">
insert into
${tableName}
using fan_health_index_data TAGS ('按时刻')
using fan_health_index_data TAGS (#{analysisType})
values
<foreach collection="list" separator="," item="item" index="index">
(
......@@ -152,4 +152,78 @@
analysis_obj_type,
area
</select>
<select id="getInfoByPage" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex">
SELECT * FROM fan_health_index_data
<where>
<if test='dto.analysisObjType!= null'>analysis_obj_type = #{dto.analysisObjType}</if>
<if test='dto.analysisType!= null'>and analysis_type = #{dto.analysisType}</if>
<if test='dto.endDate!= null'> and ts &lt;= #{dto.endDate} </if>
<if test='dto.startDate!= null'> and ts &gt;= #{dto.startDate} </if>
<if test='dto.area!= null'> AND area = #{area} </if>
<if test='dto.number!= null'> AND `number` = #{dto.number} </if>
<if test='dto.pointName!= null'>AND point_name = #{dto.pointName} </if>
<if test='dto.station!= null'>AND station = #{dto.station} </if>
<if test='dto.healthLevel!= null'>AND health_level = #{dto.healthLevel} </if>
<if test='dto.subSystem!= null'>AND sub_system = #{dto.subSystem} </if>
<if test='dto.equipmentName!= null'>AND equipment_name = #{dto.equipmentName}
</if>
</where>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
</if>
limit #{dto.current}, #{dto.size}
</select>
<select id="getInfoByPageTotal" resultType="java.lang.Integer">
SELECT count(1) FROM fan_health_index_data
<where>
<if test='dto.analysisObjType!= null'>analysis_obj_type = #{dto.analysisObjType}</if>
<if test='dto.analysisType!= null'>and analysis_type = #{dto.analysisType}</if>
<if test='dto.endDate!= null'> and ts &lt;= #{dto.endDate} </if>
<if test='dto.startDate!= null'> and ts &gt;= #{dto.startDate} </if>
<if test='dto.area!= null'> AND area = #{area} </if>
<if test='dto.number!= null'> AND `number` = #{dto.number} </if>
<if test='dto.pointName!= null'>AND point_name = #{dto.pointName} </if>
<if test='dto.station!= null'>AND station = #{dto.station} </if>
<if test='dto.healthLevel!= null'>AND health_level = #{dto.healthLevel} </if>
<if test='dto.subSystem!= null'>AND sub_system = #{dto.subSystem} </if>
<if test='dto.equipmentName!= null'>AND equipment_name = #{dto.equipmentName}</if>
</where>
</select>
<select id="saveBatchHealthIndexLatestInfo" resultType="int">
insert into
${tableName}
values
<foreach collection="list" separator="," item="item" index="index">
(
now,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
#{item.healthIndex, jdbcType=FLOAT},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.analysisStartTime, jdbcType=VARCHAR},
#{item.analysisEndTime, jdbcType=VARCHAR},
#{item.area, jdbcType=VARCHAR},
#{item.station, jdbcType=VARCHAR},
#{item.subSystem, jdbcType=VARCHAR},
#{item.number, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR}
)
</foreach>
</select>
<delete id="deleteAllDataByTableName">
delete * from ${tableName} where analysis_type = #{analysisType}
</delete>
</mapper>
......@@ -38,7 +38,7 @@
<insert id="saveBatchHealthIndexList">
insert into ${tableName}
using pv_health_index_data TAGS ('按时刻')
using pv_health_index_data TAGS (#{analysisType})
values
<foreach collection="list" separator="," item="item" index="index">
(
......@@ -186,4 +186,72 @@
analysis_obj_type,
area
</select>
<select id="getInfoByPage" resultType="com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvHealthIndex">
SELECT * FROM pv_health_index_data
<where>
<if test='dto.analysisObjType!= null'>analysis_obj_type = #{dto.analysisObjType}</if>
<if test='dto.analysisType!= null'>and analysis_type = #{dto.analysisType}</if>
<if test='dto.endDate!= null'> and ts &lt;= #{dto.endDate} </if>
<if test='dto.startDate!= null'> and ts &gt;= #{dto.startDate} </if>
<if test='dto.area!= null'> AND area = #{area} </if>
<if test='dto.number!= null'> AND `subarray` = #{dto.subarray} </if>
<if test='dto.pointName!= null'>AND point_name = #{dto.pointName} </if>
<if test='dto.station!= null'>AND station = #{dto.station} </if>
<if test='dto.healthLevel!= null'>AND health_level = #{dto.healthLevel} </if>
<if test='dto.equipmentName!= null'>AND equipment_name = #{dto.equipmentName}
</if>
</where>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
</if>
limit #{dto.current}, #{dto.size}
</select>
<select id="getInfoByPageTotal" resultType="java.lang.Integer">
SELECT count(1) FROM fan_health_index_data
<where>
<if test='dto.analysisObjType!= null'>analysis_obj_type = #{dto.analysisObjType}</if>
<if test='dto.analysisType!= null'>and analysis_type = #{dto.analysisType}</if>
<if test='dto.endDate!= null'> and ts &lt;= #{dto.endDate} </if>
<if test='dto.startDate!= null'> and ts &gt;= #{dto.startDate} </if>
<if test='dto.area!= null'> AND area = #{area} </if>
<if test='dto.number!= null'> AND `number` = #{dto.number} </if>
<if test='dto.pointName!= null'>AND point_name = #{dto.pointName} </if>
<if test='dto.station!= null'>AND station = #{dto.station} </if>
<if test='dto.healthLevel!= null'>AND health_level = #{dto.healthLevel} </if>
<if test='dto.subSystem!= null'>AND sub_system = #{dto.subSystem} </if>
<if test='dto.equipmentName!= null'>AND equipment_name = #{dto.equipmentName}</if>
</where>
</select>
<select id="saveBatchHealthIndexLatestInfo" resultType="int">
insert into ${tableName}
values
<foreach collection="list" separator="," item="item" index="index">
(
now,
#{item.recDate, jdbcType=VARCHAR},
#{item.analysisObjType, jdbcType=VARCHAR},
#{item.analysisObjSeq, jdbcType=VARCHAR},
#{item.weight, jdbcType=FLOAT},
#{item.healthIndex, jdbcType=FLOAT},
#{item.healthLevel, jdbcType=VARCHAR},
#{item.analysisStartTime, jdbcType=VARCHAR},
#{item.analysisEndTime, jdbcType=VARCHAR},
#{item.area, jdbcType=VARCHAR},
#{item.station, jdbcType=VARCHAR},
#{item.subarray, jdbcType=VARCHAR},
#{item.manufacturer, jdbcType=VARCHAR},
#{item.deviceType, jdbcType=VARCHAR},
#{item.equipmentName, jdbcType=VARCHAR},
#{item.gatewayId, jdbcType=VARCHAR},
#{item.indexAddress, jdbcType=VARCHAR},
#{item.anomaly, jdbcType=FLOAT},
#{item.pointName, jdbcType=VARCHAR},
#{item.analysisTime, jdbcType=VARCHAR},
#{item.kks, jdbcType=VARCHAR}
)
</foreach>
</select>
</mapper>
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