From 566d222bfd368ef10ceefd49e2cb73350631156a Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 19 十月 2021 10:20:16 +0800
Subject: [PATCH] 更新readme
---
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 71 +++++++++++++++++++++++++++++++++--
1 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
index da455fb..68ad28d 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
@@ -1,24 +1,87 @@
package com.genersoft.iot.vmp.storager.dao;
import com.genersoft.iot.vmp.gb28181.bean.Device;
-import org.apache.ibatis.annotations.Insert;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.*;
+import org.springframework.stereotype.Repository;
import java.util.List;
+/**
+ * 鐢ㄤ簬瀛樺偍璁惧淇℃伅
+ */
@Mapper
+@Repository
public interface DeviceMapper {
@Select("SELECT * FROM device WHERE deviceId = #{deviceId}")
Device getDeviceByDeviceId(String deviceId);
- @Insert("SELECT * FROM device WHERE deviceId = #{deviceId}")
+ @Insert("INSERT INTO device (" +
+ "deviceId, " +
+ "name, " +
+ "manufacturer, " +
+ "model, " +
+ "firmware, " +
+ "transport," +
+ "streamMode," +
+ "ip," +
+ "port," +
+ "hostAddress," +
+ "expires," +
+ "registerTime," +
+ "keepaliveTime," +
+ "createTime," +
+ "updateTime," +
+ "charset," +
+ "online" +
+ ") VALUES (" +
+ "#{deviceId}," +
+ "#{name}," +
+ "#{manufacturer}," +
+ "#{model}," +
+ "#{firmware}," +
+ "#{transport}," +
+ "#{streamMode}," +
+ "#{ip}," +
+ "#{port}," +
+ "#{hostAddress}," +
+ "#{expires}," +
+ "#{registerTime}," +
+ "#{keepaliveTime}," +
+ "#{createTime}," +
+ "#{updateTime}," +
+ "#{charset}," +
+ "#{online}" +
+ ")")
int add(Device device);
+ @Update(value = {" <script>" +
+ "UPDATE device " +
+ "SET updateTime='${updateTime}'" +
+ "<if test=\"name != null\">, name='${name}'</if>" +
+ "<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +
+ "<if test=\"model != null\">, model='${model}'</if>" +
+ "<if test=\"firmware != null\">, firmware='${firmware}'</if>" +
+ "<if test=\"transport != null\">, transport='${transport}'</if>" +
+ "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" +
+ "<if test=\"ip != null\">, ip='${ip}'</if>" +
+ "<if test=\"port != null\">, port=${port}</if>" +
+ "<if test=\"hostAddress != null\">, hostAddress='${hostAddress}'</if>" +
+ "<if test=\"online != null\">, online=${online}</if>" +
+ "<if test=\"registerTime != null\">, registerTime='${registerTime}'</if>" +
+ "<if test=\"keepaliveTime != null\">, keepaliveTime='${keepaliveTime}'</if>" +
+ "<if test=\"expires != null\">, expires=${expires}</if>" +
+ "<if test=\"charset != null\">, charset='${charset}'</if>" +
+ "WHERE deviceId='${deviceId}'"+
+ " </script>"})
int update(Device device);
+ @Select("SELECT *, (SELECT count(0) FROM device_channel WHERE deviceId=de.deviceId) as channelCount FROM device de")
List<Device> getDevices();
+ @Delete("DELETE FROM device WHERE deviceId=#{deviceId}")
int del(String deviceId);
+
+ @Update("UPDATE device SET online=0")
+ int outlineForAll();
}
--
Gitblit v1.8.0