diff --git a/UI/Controllers/UpgradeController.cs b/UI/Controllers/UpgradeController.cs
index f483f28..e0847c9 100644
--- a/UI/Controllers/UpgradeController.cs
+++ b/UI/Controllers/UpgradeController.cs
@@ -717,6 +717,51 @@ namespace UI.Controllers
}
}
+ ///
+ /// 修改房间设备访问日志
+ ///
+ /// 日志ID
+ /// 故障情况
+ /// 故障类型
+ /// 返回操作结果
+ [HttpPost]
+ public ActionResult UpdateRoomVisitLog(int id, string faultDescription, string equipmentStatusType)
+ {
+ try
+ {
+ if (id <= 0)
+ {
+ return Json(new { Status = 0, Message = "日志ID不能为空且必须大于0" }, JsonRequestBehavior.AllowGet);
+ }
+
+ // 构建更新SQL语句
+ string sql = "UPDATE tbl_roomvisitlogform SET FaultDescription = @FaultDescription, EquipmentStatusType = @EquipmentStatusType WHERE ID = @ID";
+ var parameters = new Dictionary
+ {
+ { "ID", id },
+ { "FaultDescription", faultDescription },
+ { "EquipmentStatusType", equipmentStatusType }
+ };
+
+ // 执行更新操作
+ int updateCount = SqlSugarBase.RcuDb.Ado.ExecuteCommand(sql, parameters);
+
+ if (updateCount > 0)
+ {
+ return Json(new { Status = 1, Message = "更新成功", Count = updateCount }, JsonRequestBehavior.AllowGet);
+ }
+ else
+ {
+ return Json(new { Status = 0, Message = "更新失败,未找到对应记录" }, JsonRequestBehavior.AllowGet);
+ }
+ }
+ catch (Exception ex)
+ {
+ logger.Error(ex, "UpdateRoomVisitLog error");
+ return Json(new { Status = -1, Message = "更新失败", Detail = ex.Message }, JsonRequestBehavior.AllowGet);
+ }
+ }
+
}
public class RCUDBData
{
diff --git a/更新日志.md b/更新日志.md
index 39429cf..06850f3 100644
--- a/更新日志.md
+++ b/更新日志.md
@@ -220,4 +220,63 @@ ALTER TABLE `tbl_roomvisitlogform` ADD COLUMN `EquipmentOnlineStatus` varchar(25
```
**开发人员**:
-技术团队
+技术团队
+
+## 2025-12-30
+
+### 新增接口
+
+#### 房间设备访问日志修改接口
+
+**接口地址**:
+`/Upgrade/UpdateRoomVisitLog`
+
+**请求方式**:
+`POST`
+
+**请求参数**:
+| 参数名 | 类型 | 必填 | 描述 |
+| --- | --- | --- | --- |
+| id | int | 是 | 日志ID,必填参数,必须大于0 |
+| faultDescription | string | 是 | 故障情况描述 |
+| equipmentStatusType | string | 是 | 故障类型 |
+
+**返回结果**:
+```json
+{
+ "Status": 1, // 1成功,0失败,-1异常
+ "Message": "更新成功", // 操作结果描述
+ "Count": 1 // 更新记录数量
+}
+```
+
+**功能描述**:
+该接口用于修改 `tbl_roomvisitlogform` 表中的故障描述和故障类型信息,根据传入的日志ID更新对应记录。
+
+**使用示例**:
+```javascript
+fetch('/Upgrade/UpdateRoomVisitLog', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/x-www-form-urlencoded'
+ },
+ body: JSON.stringify({
+ id: 123,
+ faultDescription: "设备温度过高",
+ equipmentStatusType: "高温故障"
+ })
+})
+.then(response => response.json())
+.then(data => {
+ console.log(data);
+ // 输出:{"Status":1,"Message":"更新成功","Count":1}
+});
+```
+
+**开发人员**:
+系统开发团队
+
+**备注**:
+- 该接口使用参数化查询防止SQL注入
+- 包含完整的参数验证和异常处理机制
+- 与现有的查询接口 `QueryRoomVisitLog` 配套使用,实现故障记录的修改功能