为推流列表增加搜索功能
This commit is contained in:
@@ -30,11 +30,9 @@ public interface IStreamPushService {
|
||||
|
||||
/**
|
||||
* 获取
|
||||
* @param page
|
||||
* @param count
|
||||
* @return
|
||||
*/
|
||||
PageInfo<StreamPushItem> getPushList(Integer page, Integer count);
|
||||
PageInfo<StreamPushItem> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId);
|
||||
|
||||
List<StreamPushItem> getPushList(String mediaSererId);
|
||||
|
||||
StreamPushItem transform(MediaItem item);
|
||||
|
||||
@@ -110,9 +110,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<StreamPushItem> getPushList(Integer page, Integer count) {
|
||||
public PageInfo<StreamPushItem> getPushList(Integer page, Integer count, String query, Boolean pushing, String mediaServerId) {
|
||||
PageHelper.startPage(page, count);
|
||||
List<StreamPushItem> all = streamPushMapper.selectAll();
|
||||
List<StreamPushItem> all = streamPushMapper.selectAllForList(query, pushing, mediaServerId);
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,7 @@ public interface PlatformGbStreamMapper {
|
||||
"LEFT JOIN parent_platform pp ON pp.serverGBId = pgs.platformId " +
|
||||
"WHERE " +
|
||||
"pgs.app =#{app} " +
|
||||
"AND pgs.stream =#{stream} " +
|
||||
"GROUP BY pp.serverGBId")
|
||||
"AND pgs.stream =#{stream} ")
|
||||
List<ParentPlatform> selectByAppAndStream(String app, String stream);
|
||||
|
||||
@Select("SELECT pgs.*, gs.gbId FROM platform_gb_stream pgs " +
|
||||
|
||||
@@ -48,6 +48,27 @@ public interface StreamPushMapper {
|
||||
"</script>")
|
||||
int delAll(List<StreamPushItem> streamPushItems);
|
||||
|
||||
|
||||
|
||||
|
||||
@Select(value = {" <script>" +
|
||||
"SELECT " +
|
||||
"st.*, " +
|
||||
"pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude " +
|
||||
"from " +
|
||||
"stream_push st " +
|
||||
"LEFT JOIN gb_stream pgs " +
|
||||
"on st.app = pgs.app AND st.stream = pgs.stream " +
|
||||
"WHERE " +
|
||||
"1=1 " +
|
||||
" <if test='query != null'> AND (st.app LIKE '%${query}%' OR st.stream LIKE '%${query}%' OR pgs.gbId LIKE '%${query}%' OR pgs.name LIKE '%${query}%')</if> " +
|
||||
" <if test='pushing == true' > AND (pgs.gbId is null OR pgs.status=1)</if>" +
|
||||
" <if test='pushing == false' > AND pgs.status=0</if>" +
|
||||
" <if test='mediaServerId != null' > AND st.mediaServerId=#{mediaServerId} </if>" +
|
||||
"order by st.createStamp desc" +
|
||||
" </script>"})
|
||||
List<StreamPushItem> selectAllForList(String query, Boolean pushing, String mediaServerId);
|
||||
|
||||
@Select("SELECT st.*, pgs.gbId, pgs.status, pgs.name, pgs.longitude, pgs.latitude FROM stream_push st LEFT JOIN gb_stream pgs on st.app = pgs.app AND st.stream = pgs.stream order by st.createStamp desc")
|
||||
List<StreamPushItem> selectAll();
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -57,16 +58,24 @@ public class StreamPushController {
|
||||
@ApiImplicitParam(name="page", value = "当前页", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="count", value = "每页查询数量", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name="query", value = "查询内容", dataTypeClass = String.class),
|
||||
@ApiImplicitParam(name="online", value = "是否在线", dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="pushing", value = "是否正在推流", dataTypeClass = Boolean.class),
|
||||
@ApiImplicitParam(name="mediaServerId", value = "流媒体ID", dataTypeClass = String.class),
|
||||
})
|
||||
@GetMapping(value = "/list")
|
||||
@ResponseBody
|
||||
public PageInfo<StreamPushItem> list(@RequestParam(required = false)Integer page,
|
||||
@RequestParam(required = false)Integer count,
|
||||
@RequestParam(required = false)String query,
|
||||
@RequestParam(required = false)Boolean online ){
|
||||
@RequestParam(required = false)Boolean pushing,
|
||||
@RequestParam(required = false)String mediaServerId ){
|
||||
|
||||
PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page, count);
|
||||
if (StringUtils.isEmpty(query)) {
|
||||
query = null;
|
||||
}
|
||||
if (StringUtils.isEmpty(mediaServerId)) {
|
||||
mediaServerId = null;
|
||||
}
|
||||
PageInfo<StreamPushItem> pushList = streamPushService.getPushList(page, count, query, pushing, mediaServerId);
|
||||
return pushList;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user