feat(sensor): 添加传感器设备详情视图功能

dev_visual_page
zhaokai 2026-07-27 17:54:41 +08:00
parent 153e42423f
commit edd19b5a33
5 changed files with 22 additions and 1 deletions

View File

@ -79,7 +79,7 @@ public class SensorDeviceQueryExe {
} }
public SingleResponse<SensorDeviceCO> getById(Long id) { public SingleResponse<SensorDeviceCO> getById(Long id) {
SensorDeviceDO d = sensorDeviceRepository.getById(id); SensorDeviceDO d = sensorDeviceRepository.detailView(id);
if (d == null || "TRUE".equals(d.getDeleteEnum())) { if (d == null || "TRUE".equals(d.getDeleteEnum())) {
return SingleResponse.buildFailure("记录不存在或已被删除"); return SingleResponse.buildFailure("记录不存在或已被删除");
} }

View File

@ -30,4 +30,6 @@ public interface SensorDeviceMapper extends BaseMapper<SensorDeviceDO> {
IPage<SensorDeviceScreenCO> screenList(IPage<SensorDeviceScreenCO> page, @Param("params") Map<String, Object> params); IPage<SensorDeviceScreenCO> screenList(IPage<SensorDeviceScreenCO> page, @Param("params") Map<String, Object> params);
List<SensorDeviceFireStatusCO> fireSituation(@Param("params") Map<String, Object> params); List<SensorDeviceFireStatusCO> fireSituation(@Param("params") Map<String, Object> params);
SensorDeviceDO detailView(@Param("id") Long id);
} }

View File

@ -21,4 +21,6 @@ public interface SensorDeviceRepository extends BaseRepository<SensorDeviceDO> {
PageResponse<SensorDeviceScreenCO> screenList(Map<String, Object> params); PageResponse<SensorDeviceScreenCO> screenList(Map<String, Object> params);
List<SensorDeviceFireStatusCO> fireSituation(Map<String, Object> params); List<SensorDeviceFireStatusCO> fireSituation(Map<String, Object> params);
SensorDeviceDO detailView(Long id);
} }

View File

@ -50,4 +50,9 @@ public class SensorDeviceRepositoryImpl extends BaseRepositoryImpl<SensorDeviceM
public List<SensorDeviceFireStatusCO> fireSituation(Map<String, Object> params) { public List<SensorDeviceFireStatusCO> fireSituation(Map<String, Object> params) {
return sensorDeviceMapper.fireSituation(params); return sensorDeviceMapper.fireSituation(params);
} }
@Override
public SensorDeviceDO detailView(Long id) {
return sensorDeviceMapper.detailView(id);
}
} }

View File

@ -75,4 +75,16 @@
</where> </where>
GROUP BY sd.sensor_status GROUP BY sd.sensor_status
</select> </select>
<select id="detailView" resultType="com.zcloud.persistence.dataobject.SensorDeviceDO">
SELECT
sd.*,
st.type_name AS sensorTypeName
FROM iot_alarm_sensor_device sd
LEFT JOIN iot_alarm_sensor_type st ON sd.sensor_type_id = st.id AND st.delete_enum = 'FALSE'
<where>
sd.id = #{id}
AND sd.delete_enum = 'FALSE'
</where>
</select>
</mapper> </mapper>