温度监测

This commit is contained in:
曹磊 2025-07-21 15:28:34 +08:00
parent 37c70de44e
commit 03be6c5adf
5 changed files with 37 additions and 9 deletions

View File

@ -66,6 +66,7 @@ public class HeatsourceController extends JeecgController<Heatsource, Heatsource
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
customeRuleMap.put("companyId", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("sourceName", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<Heatsource> queryWrapper = QueryGenerator.initQueryWrapper(heatsource, req.getParameterMap(),customeRuleMap);
Page<Heatsource> page = new Page<Heatsource>(pageNo, pageSize);
IPage<Heatsource> pageList = heatsourceService.page(page, queryWrapper);

View File

@ -66,6 +66,7 @@ public class ThermalcompanyController extends JeecgController<Thermalcompany, Th
Map<String, QueryRuleEnum> customeRuleMap = new HashMap<>();
// 自定义多选的查询规则为LIKE_WITH_OR
customeRuleMap.put("companyType", QueryRuleEnum.LIKE_WITH_OR);
customeRuleMap.put("companyName", QueryRuleEnum.LIKE_WITH_OR);
QueryWrapper<Thermalcompany> queryWrapper = QueryGenerator.initQueryWrapper(thermalcompany, req.getParameterMap(),customeRuleMap);
Page<Thermalcompany> page = new Page<Thermalcompany>(pageNo, pageSize);
IPage<Thermalcompany> pageList = thermalcompanyService.page(page, queryWrapper);

View File

@ -40,4 +40,7 @@ public class Temperature extends JeecgEntity {
private String EDate;//结束时间
@TableField(exist = false)
private String tableName;//表名字
@TableField(exist = false)
private String houseName;//房屋名字
}

View File

@ -4,8 +4,8 @@
<select id="findOne" resultType="org.jeecg.modules.temperature.entity.Temperature">
SELECT
id,
code,
a.id,
a.code,
up_peri,
csq,
bat,
@ -17,13 +17,20 @@
room_temp,
humidity,
report_time,
create_time
create_time,
(select b.house_name from bl_temperature_house b where a.code = b.code and b.del_flag = '0' limit 1) houseName
FROM
${tableName}
${tableName} a
<where>
<if test="code != null and code != ''">
AND code = #{code}
</if>
<if test="SDate != null and SDate != ''">
AND report_time >= #{SDate}
</if>
<if test="EDate != null and EDate != ''">
AND report_time &lt;#{EDate}
</if>
</where>
ORDER BY
report_time DESC
@ -34,8 +41,9 @@
SELECT code,
max(room_temp) as roomTemp,
DATE_FORMAT(report_time, '%H') reportHour,
concat(DATE_FORMAT(now(), '%Y-%m-%d %H'),':00') reportTime
FROM ${tableName}
concat(DATE_FORMAT(now(), '%Y-%m-%d %H'),':00') reportTime,
(select b.house_name from bl_temperature_house b where a.code = b.code and b.del_flag = '0' limit 1) houseName
FROM ${tableName} a
<where>
<if test="code != null and code != ''">
AND code = #{code}

View File

@ -16,14 +16,29 @@ public class TemperatureServiceImpl extends JeecgServiceImpl<TemperatureMapper,
@Override
public Temperature findOne(Temperature temperature){
String dateStr = temperature.getSDate();
String suffix = "";
if(dateStr==null||dateStr.equals("")){
String SDate = temperature.getSDate();
if(SDate==null||SDate.equals("")){
SDate = new SimpleDateFormat("YYYY-MM-dd").format(new Date())+" 00:00:00";
suffix = new SimpleDateFormat("YYMM").format(new Date());
}else{
suffix = dateStr.substring(2, 4)+dateStr.substring(5, 7);
suffix = SDate.substring(2, 4)+SDate.substring(5, 7);
}
temperature.setTableName("bl_temperature_"+suffix);
if(SDate.length()<=10){
SDate = SDate +" 00:00:00";
}
temperature.setSDate(SDate);
String EDate = temperature.getEDate();
if(EDate==null||EDate.equals("")) {
// EDate = new SimpleDateFormat("YYYY-MM-dd").format(new Date()) + " 23:59:59";
EDate = SDate.substring(0,10)+ " 23:59:59";
}
if(EDate.length()<=10){
EDate = EDate +" 23:59:59";
}
temperature.setEDate(EDate);
return baseMapper.findOne(temperature);
}