diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/MediaController.java b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/MediaController.java index 54530295..2de6bdd4 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/controller/MediaController.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/controller/MediaController.java @@ -18,16 +18,13 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @Tag(name = "媒体流相关") -@Controller +@RestController @Slf4j @RequestMapping(value = "/api/media") public class MediaController { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java index 2fe3dc5e..092c90dc 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/ChannelProvider.java @@ -122,8 +122,8 @@ public class ChannelProvider { sqlBuild.append(BASE_SQL); sqlBuild.append(" where channel_type = 0 "); if (params.get("query") != null) { - sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')" + - " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') )") + sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'" + + " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )") ; } if (params.get("online") != null && (Boolean)params.get("online")) { @@ -154,8 +154,8 @@ public class ChannelProvider { sqlBuild.append(BASE_SQL); sqlBuild.append(" where channel_type = 0 "); if (params.get("query") != null) { - sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%')" + - " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') )") + sqlBuild.append(" AND (coalesce(gb_device_id, device_id) LIKE concat('%',#{query},'%') escape '/'" + + " OR coalesce(gb_name, name) LIKE concat('%',#{query},'%') escape '/' )") ; } if (params.get("online") != null && (Boolean)params.get("online")) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java index dc29280e..719ad284 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/dao/provider/DeviceChannelProvider.java @@ -71,8 +71,8 @@ public class DeviceChannelProvider { "OR (LENGTH(coalesce(dc.gb_device_id, dc.device_id))=LENGTH(#{civilCode}) + 2) AND coalesce(dc.gb_device_id, dc.device_id) LIKE concat(#{civilCode},'%'))"); } if (params.get("query") != null && !ObjectUtils.isEmpty(params.get("query"))) { - sqlBuild.append(" AND (coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%')" + - " OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%'))") + sqlBuild.append(" AND (coalesce(dc.gb_device_id, dc.device_id) LIKE concat('%',#{query},'%') escape '/'" + + " OR coalesce(dc.gb_name, dc.name) LIKE concat('%',#{query},'%') escape '/')") ; } if (params.get("online") != null && (Boolean)params.get("online")) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java index 97d00b12..654648fe 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java @@ -609,6 +609,11 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { parentId = channelId; } } + if (query != null) { + query = query.replaceAll("/", "//") + .replaceAll("%", "/%") + .replaceAll("_", "/_"); + } List all = channelMapper.queryChannels(deviceDbId, civilCode, businessGroupId, parentId, query, channelType, online,null); return new PageInfo<>(all); } @@ -624,7 +629,11 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService { if (device == null) { throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId); } - // 获取到所有正在播放的流 + if (query != null) { + query = query.replaceAll("/", "//") + .replaceAll("%", "/%") + .replaceAll("_", "/_"); + } PageHelper.startPage(page, count); List all = channelMapper.queryChannels(device.getId(), null,null, null, query, hasSubChannel, online,null); return new PageInfo<>(all); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java index 38e3bd12..f19f4f9c 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java @@ -390,6 +390,11 @@ public class GbChannelServiceImpl implements IGbChannelService { @Override public PageInfo queryListByCivilCode(int page, int count, String query, Boolean online, Integer channelType, String civilCode) { PageHelper.startPage(page, count); + if (query != null) { + query = query.replaceAll("/", "//") + .replaceAll("%", "/%") + .replaceAll("_", "/_"); + } List all = commonGBChannelMapper.queryListByCivilCode(query, online, channelType, civilCode); return new PageInfo<>(all); } @@ -397,6 +402,11 @@ public class GbChannelServiceImpl implements IGbChannelService { @Override public PageInfo queryListByParentId(int page, int count, String query, Boolean online, Integer channelType, String groupDeviceId) { PageHelper.startPage(page, count); + if (query != null) { + query = query.replaceAll("/", "//") + .replaceAll("%", "/%") + .replaceAll("_", "/_"); + } List all = commonGBChannelMapper.queryListByParentId(query, online, channelType, groupDeviceId); return new PageInfo<>(all); } diff --git a/src/main/java/com/genersoft/iot/vmp/streamProxy/controller/StreamProxyController.java b/src/main/java/com/genersoft/iot/vmp/streamProxy/controller/StreamProxyController.java index 861dea30..54304385 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamProxy/controller/StreamProxyController.java +++ b/src/main/java/com/genersoft/iot/vmp/streamProxy/controller/StreamProxyController.java @@ -30,7 +30,7 @@ import java.util.Map; * 拉流代理接口 */ @Tag(name = "拉流代理", description = "") -@Controller +@RestController @Slf4j @RequestMapping(value = "/api/proxy") public class StreamProxyController { diff --git a/src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java b/src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java index 3af1f294..1331c93a 100755 --- a/src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java +++ b/src/main/java/com/genersoft/iot/vmp/streamPush/controller/StreamPushController.java @@ -43,7 +43,7 @@ import java.util.Map; import java.util.UUID; @Tag(name = "推流信息管理") -@Controller +@RestController @Slf4j @RequestMapping(value = "/api/push") public class StreamPushController {