1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- package com.jiayue.biz.mapper;
- import cn.hutool.db.Entity;
- import com.baomidou.dynamic.datasource.annotation.DS;
- import com.baomidou.mybatisplus.core.mapper.BaseMapper;
- import com.jiayue.biz.domain.ProphaseAnemometryData;
- import org.apache.ibatis.annotations.Insert;
- import org.apache.ibatis.annotations.Param;
- import org.apache.ibatis.annotations.Select;
- import java.sql.Timestamp;
- import java.util.List;
- import java.util.Map;
- /**
- * ProphaseAnemometryDataMapper
- *
- * @author L.ym
- * @date 2023-03-14
- **/
- @DS("tdengine")
- public interface ProphaseAnemometryDataMapper extends BaseMapper<ProphaseAnemometryData> {
- //单条插入
- @Insert("INSERT INTO anemometry_${equipmentId}_${layerHeight} USING prophase_anemometry_data TAGS(#{equipmentId}, #{layerHeight}) VALUES(#{ts}, #{wsInst}, #{wsMax}, #{wsMin}, #{wsAve}, #{wsGust}, #{wsSta}, #{wdInst}, #{wdMax}, #{wdMin}, #{wdAve}, #{wdSta})")
- int insertOneWithNew(ProphaseAnemometryData one);
- //批量插入
- @Insert("<script>" +
- "insert into anemometry_${equipmentId}_${layerHeight} USING prophase_anemometry_data TAGS(#{equipmentId}, #{layerHeight}) values " +
- "<foreach collection='prophaseAnemometryData' item='p' separator=','> " +
- "(#{p.ts},#{p.wsInst},#{p.wsMax},#{p.wsMin},#{p.wsAve},#{p.wsGust},#{p.wsSta},#{p.wdInst},#{p.wdMax},#{p.wdMin},#{p.wdAve},#{p.wdSta}) " +
- "</foreach> " +
- "</script>")
- int insertSplice(@Param("prophaseAnemometryData") List<ProphaseAnemometryData> prophaseAnemometryData,@Param("equipmentId") String equipmentId,@Param("layerHeight") String layerHeight);
- //所有层高风速风向平均值
- @Select("SELECT * FROM prophase_anemometry_data t1 where t1.equipment_id = #{equipmentId} and t1.ts >= #{startTime} and t1.ts <= #{endTime}")
- List<ProphaseAnemometryData> selectAll(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
- //所有层高风速风向平均值
- @Select("SELECT t1.ts,t1.ws_ave,t1.wd_ave,t1.layer_height FROM prophase_anemometry_data t1 where t1.equipment_id = #{equipmentId} and t1.ts >= #{startTime} and t1.ts <= #{endTime}")
- List<ProphaseAnemometryData> selectAve(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
- //查询所有层高风速以及风速标差
- @Select("SELECT t1.ts,t1.ws_ave,t1.ws_sta,t1.layer_height FROM prophase_anemometry_data t1 where t1.equipment_id = #{equipmentId} and t1.ts >= #{startTime} and t1.ts <= #{endTime}")
- List<ProphaseAnemometryData> selectAveAndSta(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
- //查询所有层高风速
- @Select("SELECT t1.ts,t1.ws_ave,t1.layer_height FROM prophase_anemometry_data t1 where t1.equipment_id = #{equipmentId} and t1.ts >= #{startTime} and t1.ts <= #{endTime}")
- List<ProphaseAnemometryData> selectWsAve(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
- //根据层高和设备编号查询风速
- @Select("SELECT t1.ts,t1.ws_ave FROM prophase_anemometry_data t1 where t1.layer_height = #{height} and t1.equipment_id = #{equipmentId} and t1.ts >= #{startTime} and t1.ts <= #{endTime}")
- List<ProphaseAnemometryData> selectWsAveForHeight(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime,@Param("height") String height);
- //根据层高和设备编号查询风向
- @Select("SELECT t1.ts,t1.wd_ave FROM prophase_anemometry_data t1 where t1.layer_height = #{height} and t1.equipment_id = #{equipmentId} and t1.ts >= #{startTime} and t1.ts <= #{endTime}")
- List<ProphaseAnemometryData> selectWdAveForHeight(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime,@Param("height") String height);
- //根据层高和设备编号查询风向、风速、标差
- @Select("SELECT t1.ts,t1.ws_ave,t1.ws_sta,t1.wd_ave FROM prophase_anemometry_data t1 where t1.layer_height = #{height} and t1.equipment_id = #{equipmentId} and t1.ts >= #{startTime} and t1.ts <= #{endTime}")
- List<ProphaseAnemometryData> selectWdAveAndWdAveAndWsStaForHeight(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime,@Param("height") String height);
- //查询设备编号查询所有层高风向 风速 风速标差
- @Select("SELECT t1.ts,t1.ws_ave,t1.ws_sta,t1.wd_ave,t1.layer_height FROM prophase_anemometry_data t1 where t1.equipment_id = #{equipmentId} and t1.ts >= #{startTime} and t1.ts <= #{endTime}")
- List<ProphaseAnemometryData> selectWdAveAndWdAveAndWsSta(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime);
- @Select("delete from anemometry_${equipmentId}_${height} where ts >= #{startTime} and ts <= #{endTime}")
- void deleteByLayerHeightAndEquipmentId(@Param("equipmentId") String equipmentId, @Param("startTime") Timestamp startTime, @Param("endTime") Timestamp endTime,@Param("height") String height);
- @Select("drop table if exists anemometry_${equipmentId}_${height}")
- void deleteTable(@Param("equipmentId") String equipmentId,@Param("height") String height);
- }
|