You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
502 lines
28 KiB
502 lines
28 KiB
package com.mh.user.mapper; |
|
|
|
import com.mh.user.entity.NowDataEntity; |
|
import com.mh.user.entity.WaterLevelEntity; |
|
import com.mh.user.entity.WaterTempEntity; |
|
import com.mh.user.entity.PumpMinutesEntity; |
|
import com.mh.user.mapper.provider.NowDataProvider; |
|
import com.mh.user.model.WaterLevelModel; |
|
import org.apache.ibatis.annotations.*; |
|
import org.apache.ibatis.mapping.StatementType; |
|
|
|
import java.util.List; |
|
import java.util.Map; |
|
|
|
|
|
@Mapper |
|
public interface NowDataMapper { |
|
|
|
//保存监控界面实时信息 |
|
@Insert("insert into now_data(cur_date,building_id,building_name,pump_id,pump_name,temp_set,water_temp,run_state,is_fault,level_set,water_level,tank_id,tank_name) values (" + |
|
" getDate(),#{buildingId},#{buildingName},#{pumpId},#{pumpName},#{tempSet},#{waterTemp},#{runState},#{isFault},#{levelSet},#{waterLevel},#{tankId},#{tankName})") |
|
void saveNowData(NowDataEntity nowDataEntity); |
|
|
|
//修改监控界面实时信息(热泵) |
|
@Update("<script>" + |
|
" update now_data set cur_date=getDate()" + |
|
" <if test='buildingName!=null and buildingName != \"\"'> , building_name = #{buildingName} </if>" + |
|
" <if test='pumpName!=null and pumpName != \"\"'> , pump_name = #{pumpName} </if>" + |
|
" <if test='tempSet!=null and tempSet != \"\"'> , temp_set = #{tempSet} </if>" + |
|
" <if test='waterTemp!=null and waterTemp != \"\"'> , water_temp = #{waterTemp} </if>" + |
|
" <if test='runState!=null and runState != \"\"'> , run_state = #{runState} </if>" + |
|
" <if test='isFault!=null and isFault != \"\"'> , is_fault = #{isFault} </if>" + |
|
" <if test='levelSet!=null and levelSet != \"\"'> , level_set = #{levelSet} </if>" + |
|
" <if test='waterLevel!=null and waterLevel != \"\"'> , water_level = #{waterLevel} </if>" + |
|
" <if test='tankId!=null and tankId != \"\"'> , tank_id = #{tankId} </if>" + |
|
" <if test='tankName!=null and tankName != \"\"'> , tank_name = #{tankName} </if>" + |
|
" where building_id = #{buildingId} and pump_id = #{pumpId} " + |
|
"</script>") |
|
void updateNowData(NowDataEntity nowDataEntity); |
|
|
|
//修改监控界面实时信息(不包含热泵) |
|
@Update("<script>" + |
|
" update now_data set cur_date=getDate()" + |
|
" <if test='buildingName!=null and buildingName != \"\"'> , building_name = #{buildingName} </if>" + |
|
" <if test='pumpId!=null and pumpId != \"\"'> , pump_id = #{pumpId} </if>" + |
|
" <if test='pumpName!=null and pumpName != \"\"'> , pump_name = #{pumpName} </if>" + |
|
" <if test='tempSet!=null and tempSet != \"\"'> , temp_set = #{tempSet} </if>" + |
|
" <if test='waterTemp!=null and waterTemp != \"\"'> , water_temp = #{waterTemp} </if>" + |
|
" <if test='runState!=null and runState != \"\"'> , run_state = #{runState} </if>" + |
|
" <if test='isFault!=null and isFault != \"\"'> , is_fault = #{isFault} </if>" + |
|
" <if test='levelSet!=null and levelSet != \"\"'> , level_set = #{levelSet} </if>" + |
|
" <if test='waterLevel!=null and waterLevel != \"\"'> , water_level = #{waterLevel} </if>" + |
|
" <if test='tankId!=null and tankId != \"\"'> , tank_id = #{tankId} </if>" + |
|
" <if test='tankName!=null and tankName != \"\"'> , tank_name = #{tankName} </if>" + |
|
" where building_id = #{buildingId} " + |
|
"</script>") |
|
void updateNowData2(NowDataEntity nowDataEntity); |
|
|
|
//查询监控界面实时信息 |
|
@Results(id="rs",value = { |
|
@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingId",column="building_id"), |
|
@Result(property="buildingName",column="building_name"), |
|
@Result(property="pumpId",column="pump_id"), |
|
@Result(property ="pumpName",column ="pump_name"), |
|
@Result(property ="tempSet",column ="temp_set"), |
|
@Result(property="waterTemp",column="water_temp"), |
|
@Result(property ="runState",column ="run_state"), |
|
@Result(property ="upWaterState",column ="up_water_state"), |
|
@Result(property ="useWaterState",column ="use_water_state"), |
|
@Result(property ="backWaterState",column ="back_water_state"), |
|
@Result(property ="isFault",column ="is_fault"), |
|
@Result(property ="levelSet",column ="level_set"), |
|
@Result(property ="waterLevel",column ="water_level"), |
|
@Result(property ="tankId",column ="tank_id"), |
|
@Result(property ="tankName",column ="tank_name"), |
|
@Result(property ="envTemp",column ="env_temp") |
|
}) |
|
@Select("select * from now_data where building_id=#{buildingId} order by cast(pump_id as int) ") |
|
List<NowDataEntity> queryNowData(@Param("buildingId") String buildingId); |
|
|
|
//按热泵查询当前状态 |
|
@ResultMap(value = "rs") |
|
@Select("select * from now_data where pump_id=#{pumpId} and building_id=#{buildingId}") |
|
NowDataEntity queryNowDataByPump(@Param("buildingId") String buildingId,@Param("pumpId") String pumpId); |
|
|
|
//保存监控界面历史信息 |
|
@Insert("insert into history_data(cur_date,building_id,building_name,pump_id,pump_name,temp_set,water_temp,run_state,is_fault,level_set,water_level,tank_id,tank_name) values (" + |
|
" #{curDate},#{buildingId},#{buildingName},#{pumpId},#{pumpName},#{tempSet},#{waterTemp},#{runState},#{isFault},#{levelSet},#{waterLevel},#{tankId},#{tankName})") |
|
void saveHistoryData(NowDataEntity nowDataEntity); |
|
|
|
//修改监控界面历史信息(热泵) |
|
@Update("<script>" + |
|
" update history_data WITH(TABLOCKX) set " + |
|
" <if test='buildingId!=null'> building_id = #{buildingId} </if>" + |
|
" <if test='pumpName!=null'> , pump_name = #{pumpName} </if>" + |
|
" <if test='tempSet!=null'> , temp_set = #{tempSet} </if>" + |
|
" <if test='waterTemp!=null'> , water_temp = #{waterTemp} </if>" + |
|
" <if test='runState!=null'> , run_state = #{runState} </if>" + |
|
" <if test='isFault!=null'> , is_fault = #{isFault} </if>" + |
|
" <if test='levelSet!=null'> , level_set = #{levelSet} </if>" + |
|
" <if test='waterLevel!=null'> , water_level = #{waterLevel} </if>" + |
|
" <if test='tankId!=null'> , tank_id = #{tankId} </if>" + |
|
" <if test='tankName!=null'> , tank_name = #{tankName} </if>" + |
|
" where building_id = #{buildingId} and pump_id=#{pumpId} and convert(varchar(19),cur_date,121)=left(#{curDate},19)" + |
|
"</script>") |
|
void updateHistoryData(NowDataEntity nowDataEntity); |
|
|
|
//修改监控界面历史信息(不包含热泵) |
|
@Update("<script>" + |
|
" update history_data WITH(TABLOCKX) set " + |
|
" <if test='buildingId!=null'> building_id = #{buildingId} </if>" + |
|
" <if test='pumpName!=null'> , pump_name = #{pumpName} </if>" + |
|
" <if test='tempSet!=null'> , temp_set = #{tempSet} </if>" + |
|
" <if test='waterTemp!=null'> , water_temp = #{waterTemp} </if>" + |
|
" <if test='runState!=null'> , run_state = #{runState} </if>" + |
|
" <if test='isFault!=null'> , is_fault = #{isFault} </if>" + |
|
" <if test='levelSet!=null'> , level_set = #{levelSet} </if>" + |
|
" <if test='waterLevel!=null'> , water_level = #{waterLevel} </if>" + |
|
" <if test='tankId!=null'> , tank_id = #{tankId} </if>" + |
|
" <if test='tankName!=null'> , tank_name = #{tankName} </if>" + |
|
" where building_id = #{buildingId} and convert(varchar(19),cur_date,121)=#{curDate}" + |
|
"</script>") |
|
void updateHistoryData2(NowDataEntity nowDataEntity); |
|
|
|
//查询监控界面历史温度 |
|
@ResultMap(value = "rs") |
|
@SelectProvider(type = NowDataProvider.class,method = "queryHistoryData") |
|
List<NowDataEntity> queryHistoryData(@Param("curDate") String curDate, |
|
@Param("buildingId") String buildingId, |
|
@Param("pumpId") String pumpId, |
|
@Param("tankId") String tankId, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
//查询记录数 |
|
@SelectProvider(type = NowDataProvider.class,method = "getHistoryDataCount") |
|
int getHistoryDataCount(@Param("curDate") String curDate, |
|
@Param("buildingId") String buildingId, |
|
@Param("pumpId") String pumpId, |
|
@Param("tankId") String tankId, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
//从WaterLevel表查询水位 |
|
@Results({ |
|
@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingID",column="building_id"), |
|
@Result(property="buildingName",column="building_name") |
|
}) |
|
@SelectProvider(type = NowDataProvider.class,method = "queryWaterLevel") |
|
List<WaterLevelEntity> queryWaterLevel(@Param("curDate") String curDate, |
|
@Param("buildingID") String buildingID, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
//从history_data表查询水位记录数 |
|
@SelectProvider(type = NowDataProvider.class,method = "getWaterLevelCount") |
|
int getWaterLevelCount(@Param("curDate") String curDate, |
|
@Param("buildingID") String buildingID); |
|
|
|
//从history_data表按时间点查询水位 |
|
@Results({ |
|
@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingID",column="building_id"), |
|
@Result(property="buildingName",column="building_name"), |
|
@Result(property ="waterLevel",column ="water_level") |
|
}) |
|
// @Select("select distinct building_id,building_name,cur_date,water_level from history_data where CONVERT(varchar(13),cur_date,121)=#{curDate} order by building_id ") |
|
@SelectProvider(type = NowDataProvider.class,method = "queryWaterLevelByTime") |
|
List<WaterLevelModel> queryWaterLevelByTime(@Param("curDate") String curDate, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
//从history_data表按时间查询水位记录数 |
|
@SelectProvider(type = NowDataProvider.class,method = "waterLevelByTimeCount") |
|
int waterLevelByTimeCount(@Param("curDate") String curDate); |
|
|
|
//查询每天楼栋水位变化 |
|
@Results({ |
|
@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingID",column="building_id"), |
|
@Result(property="buildingName",column="building_name"), |
|
@Result(property="deviceName",column="device_name") |
|
}) |
|
@SelectProvider(type = NowDataProvider.class,method = "queryBuildWaterLevel") |
|
List<WaterLevelEntity> queryBuildWaterLevel(@Param("curDate") String curDate, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
//查询每天楼栋水位变化记录数 |
|
@Select("select count(*) from waterLevel where convert(varchar(10),cur_date,121)=left(#{curDate},10)") |
|
int buildWaterLevelCount(@Param("curDate") String curDate); |
|
|
|
//判断实时表有没有记录(热泵) |
|
@Select("select count(*) from now_data where building_id=#{buildingId} and pump_id=#{pumpId}") |
|
int selectNowDataCount(@Param("buildingId") String buildingId,@Param("pumpId") String pumpId); |
|
|
|
//查询实时表记录(热泵) |
|
@ResultMap(value = "rs") |
|
@Select("select * from now_data where building_id=#{buildingId} and pump_id=#{pumpId}") |
|
NowDataEntity selectNowData(@Param("buildingId") String buildingId,@Param("pumpId") String pumpId); |
|
|
|
//判断实时表有没有记录(非热泵) |
|
@Select("select count(*) from now_data where building_id=#{buildingId} ") |
|
int selectNowDataCount2(@Param("buildingId") String buildingId); |
|
|
|
//查询实时表记录(非热泵) |
|
@ResultMap(value = "rs") |
|
@Select("select * from now_data where building_id=#{buildingId} ") |
|
NowDataEntity selectNowData2(@Param("buildingId") String buildingId); |
|
|
|
//判断历史表有没有记录(热泵) |
|
@Select("select count(*) from history_data where convert(varchar(19),cur_date,121)=#{curDate} and building_id=#{buildingId} and pump_id=#{pumpId}") |
|
int selectHistoryDataCount(@Param("curDate") String curDate,@Param("buildingId") String buildingId,@Param("pumpId") String pumpId); |
|
|
|
//查询历史表记录(热泵) |
|
@ResultMap(value = "rs") |
|
@Select("select * from history_data where cur_date=#{curDate} and building_id=#{buildingId} and pump_id=#{pumpId}") |
|
NowDataEntity selectHistoryData(@Param("curDate") String curDate,@Param("buildingId") String buildingId,@Param("pumpId") String pumpId); |
|
|
|
//判断历史表有没有记录(非热泵) |
|
@Select("select count(*) from history_data where convert(varchar(19),cur_date,121)=#{curDate} and building_id=#{buildingId} ") |
|
int selectHistoryDataCount2(@Param("curDate") String curDate,@Param("buildingId") String buildingId); |
|
|
|
//查询历史表记录(非热泵) |
|
@ResultMap(value = "rs") |
|
@Select("select * from history_data where cur_date=#{curDate} and building_id=#{buildingId} ") |
|
NowDataEntity selectHistoryData2(@Param("curDate") String curDate,@Param("buildingId") String buildingId); |
|
|
|
//初始化开始----------------------------------------------------------------------------------------- |
|
//初始化温度设置 |
|
@Update("update now_data set temp_set='50' where building_id=#{buildingId} and temp_set is null ") |
|
void updateTempSet(@Param("buildingId") String buildingId); |
|
|
|
//初始化水位设置 |
|
@Update("update now_data set level_set='100' where building_id=#{buildingId} and level_set is null ") |
|
void updateLevelSet(@Param("buildingId") String buildingId); |
|
|
|
//初始化故障状态 |
|
@Update("update now_data set is_fault='无故障' where building_id=#{buildingId} and level_set is null ") |
|
void updateIsFault(@Param("buildingId") String buildingId); |
|
//初始化结束----------------------------------------------------------------------------------------- |
|
|
|
//求热泵平均温度 |
|
@Select("<script>" + |
|
"select Convert(decimal(18,1),avg(CAST(water_temp as FLOAT))) from now_data where building_id=#{buildingId} " + |
|
"<if test='temp != null'>" + |
|
" and water_temp >= #{temp} " + |
|
"</if>" + |
|
"</script>") |
|
String selectAve(@Param("buildingId") String buildingId, @Param("temp") Integer temp); |
|
|
|
//求单个热泵温度 |
|
@Select("select water_temp from now_data where pump_id=#{pumpId} and building_id=#{buildingId}") |
|
String selectSingleTemp(@Param("pumpId") String pumpId,@Param("buildingId") String buildingId); |
|
|
|
//求热泵状态运行数 |
|
@Select("select count(*) from now_data where building_id=#{buildingId} and run_state='运行'") |
|
int selectStateCount(@Param("buildingId") String buildingId); |
|
|
|
//求热泵状态运行 |
|
@Select("select run_state from now_data where building_id=#{buildingId} and pump_id=#{pumpId}") |
|
String selectState(@Param("buildingId") String buildingId,@Param("pumpId") String pumpId); |
|
|
|
//更新设置水位值 |
|
@Update("update now_data set level_set=#{levelSet},cur_date=getDate() where building_id=#{buildingId}") |
|
void upLevelSet(@Param("buildingId") String buildingId,@Param("levelSet") String levelSet); |
|
|
|
//更新设置温度值 |
|
@Update("update now_data set temp_set=#{tempSet},cur_date=getDate() where building_id=#{buildingId} and pump_id=#{pumpID}") |
|
void upTempSet2(@Param("buildingId") String buildingId,@Param("tempSet") String tempSet,@Param("pumpID") String pumpID); |
|
|
|
@Update("update now_data set temp_set=#{tempSet},cur_date=getDate() where building_id=#{buildingId}") |
|
void upTempSet(@Param("buildingId") String buildingId,@Param("tempSet") String tempSet); |
|
//---------------------------------------------------------------------------------------------------- |
|
|
|
//查询每天24小时每个热泵温度变化情况 |
|
@Results({@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingID",column="building_id"), |
|
@Result(property="buildingName",column="building_name"), |
|
@Result(property="pumpID",column="pump_id"), |
|
@Result(property="pumpName",column="pump_name") |
|
}) |
|
@SelectProvider(type = NowDataProvider.class,method = "queryWaterTemp") |
|
List<WaterTempEntity> queryWaterTemp(@Param("buildingID") String buildingID, |
|
@Param("curDate") String curDate, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
@SelectProvider(type = NowDataProvider.class,method = "queryWaterTempCount") |
|
int queryWaterTempCount(@Param("buildingID") String buildingID, |
|
@Param("curDate") String curDate); |
|
|
|
//查询每天24小时每个热泵温度变化情况2 |
|
@Results({@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingID",column="building_id"), |
|
@Result(property="buildingName",column="building_name") |
|
}) |
|
@SelectProvider(type = NowDataProvider.class,method = "queryWaterTemp2") |
|
List<WaterTempEntity> queryWaterTemp2(@Param("curDate") String curDate, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
@SelectProvider(type = NowDataProvider.class,method = "queryWaterTempCount2") |
|
int queryWaterTempCount2(@Param("curDate") String curDate); |
|
|
|
//生成楼栋温度 |
|
@Select("exec pro_waterTemp #{curDate,jdbcType=VARCHAR,mode=IN},#{buildingID,jdbcType=VARCHAR,mode=IN},#{pumpID,jdbcType=VARCHAR,mode=IN} ") |
|
@Options(statementType = StatementType.CALLABLE) |
|
void proWaterTemp(@Param("curDate") String curDate,@Param("buildingID") String buildingID,@Param("pumpID") String pumpID); |
|
|
|
//生成楼栋水位 |
|
@Select("exec pro_waterLevel #{curDate,jdbcType=VARCHAR,mode=IN},#{buildingID,jdbcType=VARCHAR,mode=IN}, #{deviceAddr,jdbcType=VARCHAR,mode=IN} ") |
|
@Options(statementType = StatementType.CALLABLE) |
|
void proWaterLevel(@Param("curDate") String curDate,@Param("buildingID") String buildingID, @Param("deviceAddr") String deviceAddr); |
|
|
|
//在没有接收到返回值前设置监控界面热泵是否离线 |
|
@Update("update now_data set run_state=#{strState} where building_id=#{buildingId} and pump_id=#{pumpId}") |
|
void updateRunState(@Param("buildingId") String buildingId,@Param("pumpId") String pumpId,@Param("strState") String strState); |
|
|
|
//计算热泵运行时间,按分钟 |
|
@Select("exec pro_pumpMinutes #{buildingId,jdbcType=VARCHAR,mode=IN}, #{pumpId,jdbcType=VARCHAR,mode=IN},#{runState,jdbcType=VARCHAR,mode=IN}") |
|
@Options(statementType = StatementType.CALLABLE) |
|
void proPumpMinutes(@Param("buildingId") String buildingID,@Param("pumpId") String pumpID,@Param("runState") String runState); |
|
|
|
//按日查询热泵运行时长 |
|
@Results({@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingId",column="building_id"), |
|
@Result(property="buildingName",column="building_name"), |
|
@Result(property="pumpId",column="pump_id"), |
|
@Result(property="pumpName",column="pump_name"), |
|
@Result(property="runMinutes",column="run_minutes") |
|
}) |
|
@SelectProvider(type = NowDataProvider.class,method = "pumpMinutes") |
|
List<PumpMinutesEntity> pumpMinutes(@Param("startDate") String startDate, |
|
@Param("endDate") String endDate, |
|
@Param("buildingId") String buildingId, |
|
@Param("pumpId") String pumpId, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
//按日查询热泵运行时长记录数 |
|
@SelectProvider(type = NowDataProvider.class,method = "pumpMinutesCount") |
|
int pumpMinutesCount(@Param("startDate") String startDate, |
|
@Param("endDate") String endDate, |
|
@Param("buildingId") String buildingId, |
|
@Param("pumpId") String pumpId); |
|
|
|
|
|
//按周查询热泵运行时长 |
|
@Results({@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingId",column="building_id"), |
|
@Result(property="buildingName",column="building_name"), |
|
@Result(property="pumpId",column="pump_id"), |
|
@Result(property="pumpName",column="pump_name"), |
|
@Result(property="runMinutes",column="run_minutes") |
|
}) |
|
@SelectProvider(type = NowDataProvider.class,method = "pumpWeekMinutes") |
|
List<PumpMinutesEntity> pumpWeekMinutes(@Param("startDate") String startDate, |
|
@Param("endDate") String endDate, |
|
@Param("buildingId") String buildingId, |
|
@Param("pumpId") String pumpId, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
//按周查询热泵运行时长记录数 |
|
@SelectProvider(type = NowDataProvider.class,method = "pumpWeekMinutesCount") |
|
int pumpWeekMinutesCount(@Param("startDate") String startDate, |
|
@Param("endDate") String endDate, |
|
@Param("buildingId") String buildingId, |
|
@Param("pumpId") String pumpId); |
|
|
|
//按周查询热泵运行时长 |
|
@Results({@Result(property="curDate",column="cur_date"), |
|
@Result(property="buildingId",column="building_id"), |
|
@Result(property="buildingName",column="building_name"), |
|
@Result(property="pumpId",column="pump_id"), |
|
@Result(property="pumpName",column="pump_name"), |
|
@Result(property="runMinutes",column="run_minutes") |
|
}) |
|
@SelectProvider(type = NowDataProvider.class,method = "pumpMonthMinutes") |
|
List<PumpMinutesEntity> pumpMonthMinutes(@Param("startDate") String startDate, |
|
@Param("endDate") String endDate, |
|
@Param("buildingId") String buildingId, |
|
@Param("pumpId") String pumpId, |
|
@Param("page") int page, |
|
@Param("limit") int limit); |
|
|
|
//按周查询热泵运行时长记录数 |
|
@SelectProvider(type = NowDataProvider.class,method = "pumpMonthMinutesCount") |
|
int pumpMonthMinutesCount(@Param("startDate") String startDate, |
|
@Param("endDate") String endDate, |
|
@Param("buildingId") String buildingId, |
|
@Param("pumpId") String pumpId); |
|
|
|
//通过楼栋编号获取最小热泵id号,规定最小热泵号为单箱 |
|
@Select("select min(cast(pump_id as int)) from now_data where building_id=#{buildingId}") |
|
String selectMinPumpId(@Param("buildingId") String buildingId); |
|
|
|
|
|
//按高低区更新water_Level |
|
@Update("update now_data SET now_data.water_Level=#{waterLevel} FROM device_install " + |
|
" where now_data.pump_id =device_install.device_addr AND device_install.seat=#{seat} and now_data.building_id=#{buildingId} " + |
|
" and now_data.building_id = device_install.building_id ") |
|
void nowDataWaterLevel(@Param("waterLevel") String waterLevel, |
|
@Param("seat") String seat, |
|
@Param("buildingId") String buildingId); |
|
|
|
//按高低区更新levelSet |
|
@Update("update now_data SET now_data.level_set=#{levelSet} FROM device_install " + |
|
" where now_data.pump_id =device_install.device_addr AND device_install.seat=#{seat} and now_data.building_id=#{buildingId} " + |
|
" and now_data.building_id = device_install.building_id ") |
|
void nowDataLevelSet(@Param("levelSet") String levelSet, |
|
@Param("seat") String seat, |
|
@Param("buildingId") String buildingId); |
|
|
|
//按高低区更新water_Level |
|
@Update("update history_Data SET history_Data.water_Level=#{waterLevel} FROM device_install where history_Data.pump_id =device_install.device_addr AND device_install.seat=#{seat} " + |
|
" and history_Data.building_id=#{buildingId} " + |
|
" and convert(varchar(13),cur_date,121)=left(#{curDate},13)" + |
|
" and history_Data.building_id = device_install.building_id ") |
|
void historyDataWaterLevel(@Param("waterLevel") String waterLevel, |
|
@Param("seat") String seat, |
|
@Param("buildingId") String buildingId, |
|
@Param("curDate") String curDate); |
|
|
|
//按高低区更新levelSet |
|
@Update("update history_Data SET history_Data.level_set=#{levelSet} FROM device_install where history_Data.pump_id =device_install.device_addr AND device_install.seat=#{seat} " + |
|
" and history_Data.building_id=#{buildingId} " + |
|
" and convert(varchar(13),cur_date,121)=left(#{curDate},13) " + |
|
" and history_Data.building_id = device_install.building_id ") |
|
void historyDataLevelSet(@Param("levelSet") String levelSet, |
|
@Param("seat") String seat, |
|
@Param("buildingId") String buildingId, |
|
@Param("curDate") String curDate); |
|
|
|
@Select("select count(1) from now_data where pump_name like '%热泵%' ") |
|
int selectPumpCount(@Param("buildingId") String buildingId); |
|
|
|
@Update("<script>" + |
|
"update now_data set use_water_state=#{useWater},back_water_state=#{backWater},up_water_state=#{upWater} " + |
|
" where building_id=#{buildingId} " + |
|
"<if test='pumpName != null and pumpName != \"\"'>" + |
|
" and pump_name like ('%'+#{pumpName}+'%') " + |
|
"</if>" + |
|
"</script>") |
|
void updateNowDataByPumpName(@Param("pumpName") String pumpName, |
|
@Param("buildingId") String buildingId, |
|
@Param("useWater") String useWater, |
|
@Param("backWater") String backWater, |
|
@Param("upWater") String upWater); |
|
|
|
/** |
|
* 查询对应的钱 |
|
* @return |
|
*/ |
|
@Select("SELECT " + |
|
" TOP 1 " + |
|
" CASE " + |
|
" WHEN EXISTS ( " + |
|
" SELECT " + |
|
" 1 " + |
|
" FROM " + |
|
" now_data " + |
|
" WHERE " + |
|
" up_water_state = '运行') THEN '运行' " + |
|
" ELSE '不运行' " + |
|
" END AS up_water_state, " + |
|
" CASE " + |
|
" WHEN EXISTS ( " + |
|
" SELECT " + |
|
" 1 " + |
|
" FROM " + |
|
" now_data " + |
|
" WHERE " + |
|
" use_water_state = '运行') THEN '运行' " + |
|
" ELSE '不运行' " + |
|
" END AS use_water_state, " + |
|
" CASE " + |
|
" WHEN EXISTS ( " + |
|
" SELECT " + |
|
" 1 " + |
|
" FROM " + |
|
" now_data " + |
|
" WHERE " + |
|
" back_water_state = '运行') THEN '运行' " + |
|
" ELSE '不运行' " + |
|
" END AS back_water_state " + |
|
"FROM " + |
|
" now_data " + |
|
"where " + |
|
" building_id = #{buildingId} and convert(varchar(10), cur_date, 120) = convert(varchar(10), getdate(), 120) ") |
|
Map<String, Object> selectTopOneState(@Param("buildingId") String buildingId); |
|
|
|
@Select("<script>" + |
|
"select Convert(decimal(18,1),max(CAST(water_temp as FLOAT))) from now_data where building_id=#{buildingId} " + |
|
"<if test='temp != null'>" + |
|
" and water_temp >= #{temp} " + |
|
"</if>" + |
|
"</script>") |
|
String selectMaxTemp(@Param("buildingId") String buildingId, @Param("temp") Integer temp); |
|
}
|
|
|