add(record): 新增看板接口

- 在 RecordBusbarTempController 中添加 boardTempList 方法,用于获取母排测温记录列表
- 在 RecordBusbarTempMapper 中添加 boardTempList 方法,用于查询每个设备的最新一条测温记录
- 在 RecordBusbarTempServiceImpl 中实现 boardTempList 方法
- 在 RecordBusbarTemp 模型中添加 cabinetAlias 字段,用于存储电柜别名
- 更新 RecordBusbarTempMapper.xml,添加新的查询语句和结果映射
IOT
zch 1 month ago
parent 8b1f3d596b
commit 7f3927ca60

@ -175,4 +175,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getMonitorCountByEnergyType" parameterType="String" resultType="java.lang.Integer">
select count(1) from ems_base_monitor_info where monitor_type = #{energyType}
</select>
</mapper>

@ -135,5 +135,4 @@ public class BaseCabinetInfoController extends BaseController
return baseCabinetInfoService.countBaseCabinetInfo();
}
}

@ -59,5 +59,8 @@ public interface BaseCabinetInfoMapper
*/
public int deleteBaseCabinetInfoByObjIds(Long[] objIds);
/**
*
* */
public int countBaseCabinetInfo();
}

@ -69,5 +69,8 @@ public interface IBaseCabinetInfoService
*/
public List<baseCabinetInfoTreeSelects> selectCabinetInfoTreeList(BaseCabinetInfo baseCabinetInfo);
/**
*
* */
public int countBaseCabinetInfo();
}

@ -124,6 +124,9 @@ public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService
return baseCabinetInfos.stream().map(baseCabinetInfoTreeSelects::new).collect(Collectors.toList());
}
/**
*
* */
@Override
public int countBaseCabinetInfo(){
return baseCabinetInfoMapper.countBaseCabinetInfo();

@ -1,6 +1,8 @@
package com.ruoyi.record.controller;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@ -113,13 +115,15 @@ public class RecordBusbarAlarmController extends BaseController
public AjaxResult recordBusbarAlarmList(RecordBusbarAlarm recordBusbarAlarm)
{
List<RecordBusbarAlarm> list = recordBusbarAlarmService.selectRecordBusbarAlarmList(recordBusbarAlarm);
// 反转列表顺序
Collections.reverse(list);
return success(list);
}
//记录母排近七天每天一天的巡检记录次数。
//记录母排测温近七天每天一天的巡检记录次数。
@PostMapping("/recordBusbarAlarmCount")
public AjaxResult recordBusbarAlarmCount(@RequestBody RecordBusbarAlarm recordBusbarAlarm) {
public AjaxResult recordBusbarAlarmCount(RecordBusbarAlarm recordBusbarAlarm) {
return AjaxResult.success(recordBusbarAlarmService.recordBusbarAlarmCount(recordBusbarAlarm));
}
}

@ -158,4 +158,18 @@ public class RecordBusbarTempController extends BaseController
return success(list);
}
/**
*
* @param recordBusbarTemp 线
* @return AjaxResult线
*/
@PostMapping("/boardTempList")
public AjaxResult boardTempList(RecordBusbarTemp recordBusbarTemp)
{
List<RecordBusbarTemp> list = recordBusbarTempService.boardTempList(recordBusbarTemp);
return success(list);
}
}

@ -85,6 +85,9 @@ public class RecordBusbarTemp extends BaseEntity
@Excel(name = "巡检模式1-自动2-快速3-定点")
private Long routModel;
/** 电柜别名 */
private String cabinetAlias;
public void setObjId(Long objId)
{
this.objId = objId;
@ -228,6 +231,13 @@ public class RecordBusbarTemp extends BaseEntity
public void setRoutModel(Long routModel) {
this.routModel = routModel;
}
public String getCabinetAlias() {
return cabinetAlias;
}
public void setCabinetAlias(String cabinetAlias) {
this.cabinetAlias = cabinetAlias;
}
@Override
public String toString() {
@ -249,6 +259,7 @@ public class RecordBusbarTemp extends BaseEntity
.append("updatedTime", getUpdatedTime())
.append("recordTime", getRecordTime())
.append("routModel", getRoutModel())
.append("cabinetAlias", getCabinetAlias())
.toString();
}
}

@ -1,5 +1,6 @@
package com.ruoyi.record.domain.VO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.record.domain.RecordBusbarAlarm;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -8,7 +9,9 @@ import java.util.Date;
public class RecordBusbarAlarmCountResult extends RecordBusbarAlarm {
@JsonFormat(pattern = "yyyy-MM")
private Date recordDate;
private int alarmCount;
public Date getRecordDate() {

@ -5,15 +5,15 @@ import com.ruoyi.record.domain.RecordBusbarTemp;
/**
* Mapper
*
*
* @author zangch
* @date 2024-11-07
*/
public interface RecordBusbarTempMapper
public interface RecordBusbarTempMapper
{
/**
*
*
*
* @param objId
* @return
*/
@ -21,7 +21,7 @@ public interface RecordBusbarTempMapper
/**
*
*
*
* @param recordBusbarTemp
* @return
*/
@ -29,7 +29,7 @@ public interface RecordBusbarTempMapper
/**
*
*
*
* @param recordBusbarTemp
* @return
*/
@ -37,7 +37,7 @@ public interface RecordBusbarTempMapper
/**
*
*
*
* @param recordBusbarTemp
* @return
*/
@ -45,7 +45,7 @@ public interface RecordBusbarTempMapper
/**
*
*
*
* @param objId
* @return
*/
@ -53,9 +53,11 @@ public interface RecordBusbarTempMapper
/**
*
*
*
* @param objIds
* @return
*/
public int deleteRecordBusbarTempByObjIds(Long[] objIds);
public List<RecordBusbarTemp> boardTempList(RecordBusbarTemp recordBusbarTemp);
}

@ -81,4 +81,6 @@ public interface IRecordBusbarTempService
* @return 404
*/
public ResponseEntity<FileSystemResource> getVisiblePhoto(String filePath);
public List<RecordBusbarTemp> boardTempList(RecordBusbarTemp recordBusbarTemp);
}

@ -236,4 +236,9 @@ public class RecordBusbarTempServiceImpl implements IRecordBusbarTempService
return ResponseEntity.notFound().build();
}
}
@Override
public List<RecordBusbarTemp> boardTempList(RecordBusbarTemp recordBusbarTemp){
return recordBusbarTempMapper.boardTempList(recordBusbarTemp);
}
}

@ -24,6 +24,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="routModel" column="rout_model" />
</resultMap>
<resultMap type="RecordBusbarTemp" id="BusbarTempResult">
<result property="objId" column="objId" />
<result property="busbarCode" column="busbar_code" />
<result property="cabinetCode" column="cabinet_code" />
<result property="tempMax" column="temp_max" />
<result property="tempMin" column="temp_min" />
<result property="tempAvg" column="temp_avg" />
<result property="tempDiff" column="temp_diff" />
<result property="isAlarm" column="is_alarm" />
<result property="filePath" column="file_path" />
<result property="isFlag" column="is_flag" />
<result property="remark" column="remark" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
<result property="recordTime" column="record_time" />
<result property="routModel" column="rout_model" />
<result property="cabinetAlias" column="cabinet_alias" />
</resultMap>
<sql id="selectRecordBusbarTempVo">
select objId,
busbar_code,
@ -145,4 +166,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{objId}
</foreach>
</delete>
<select id="boardTempList" parameterType="RecordBusbarTemp" resultMap="BusbarTempResult">
<!-- 查询每个设备的最新一条记录 -->
select
rbt.objId,
rbt.cabinet_code,
rbt.busbar_code,
rbt.temp_max,
rbt.temp_min,
rbt.temp_avg,
rbt.temp_diff,
rbt.record_time,
bci.cabinet_alias
from record_busbar_temp rbt
left join base_cabinet_info bci on rbt.cabinet_code = bci.cabinet_code
INNER JOIN (
select cabinet_code, MAX(objId) as objId
from record_busbar_temp
group by cabinet_code
) rbt_max on rbt_max.cabinet_code = rbt.cabinet_code and rbt_max.objId = rbt.objId
ORDER BY rbt.cabinet_code asc
</select>
</mapper>

Loading…
Cancel
Save