瀏覽代碼

添加查询所有直播间接口

yuhongqi 1 天之前
父節點
當前提交
6a23ed9323

+ 12 - 0
fs-admin/src/main/java/com/fs/live/controller/LiveDataController.java

@@ -5,6 +5,7 @@ import com.fs.common.core.domain.R;
 import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.utils.SecurityUtils;
 import com.fs.live.domain.LiveData;
+import com.fs.live.param.LiveDataParam;
 import com.fs.live.service.ILiveDataService;
 import com.fs.live.vo.LiveUserFirstVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -41,6 +42,17 @@ public class LiveDataController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询新直播数据列表
+     */
+    @PreAuthorize("@ss.hasPermi('liveData:liveData:list')")
+    @PostMapping("/listLiveData")
+    public R listLiveData(@RequestBody LiveDataParam param, HttpServletRequest request)
+    {
+        startPage();
+        return liveDataService.listLiveData(param);
+    }
+
     /**
      * 查询直播数据列表
      * */

+ 2 - 0
fs-service/src/main/java/com/fs/live/mapper/LiveMapper.java

@@ -144,4 +144,6 @@ public interface LiveMapper
 
     List<Live> selectLiveShowReadyStartLiveList(@Param("companyIds") List<Long> companyIds);
 
+    @Select("select * from live where is_audit = 1 and id_del = 0 and status in (1,2,4) and live_type in (2,3) order by create_time desc")
+    List<Live> liveListAll();
 }

+ 1 - 1
fs-service/src/main/java/com/fs/live/mapper/LiveOrderMapper.java

@@ -418,7 +418,7 @@ public interface LiveOrderMapper {
 
     List<LiveOrderVoZm> selectLiveOrderListZm(LiveOrder liveOrder);
 
-    @Select(" SELECT * from live_order WHERE item_json is NULL ORDER BY id DESC  LIMIT 30")
+    @Select(" SELECT * from live_order WHERE item_json is NULL ORDER BY create_time DESC  LIMIT 30")
     List<LiveOrder> selectLiveOrderItemJson();
 
     @Update(" UPDATE live_order SET item_json=#{itemJson} WHERE order_id=#{orderId}")

+ 3 - 0
fs-service/src/main/java/com/fs/live/service/ILiveService.java

@@ -1,6 +1,7 @@
 package com.fs.live.service;
 
 
+import com.fs.common.core.page.PageRequest;
 import com.fs.live.vo.LiveVo;
 import com.fs.common.core.domain.R;
 import com.fs.live.domain.Live;
@@ -189,4 +190,6 @@ public interface ILiveService
     void updateGlobalVisible(long liveId, Integer status);
 
     String getGotoWxAppLiveLink(String linkStr, String appid);
+
+    R liveListAll(PageRequest pageRequest);
 }

+ 21 - 0
fs-service/src/main/java/com/fs/live/service/impl/LiveServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 
+import com.fs.common.core.page.PageRequest;
 import com.fs.common.exception.base.BaseException;
 import com.fs.company.mapper.CompanyMapper;
 import com.fs.core.config.WxMaConfiguration;
@@ -31,6 +32,7 @@ import com.fs.live.utils.ProcessManager;
 import com.fs.live.vo.*;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.service.ISysConfigService;
+import com.github.pagehelper.PageInfo;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import me.chanjar.weixin.common.error.WxErrorException;
@@ -448,6 +450,25 @@ public class LiveServiceImpl implements ILiveService
         return "";
     }
 
+
+
+    @Override
+    public R liveListAll(PageRequest pageRequest) {
+        int start = (pageRequest.getCurrentPage() - 1) * pageRequest.getPageSize();
+        int end = pageRequest.getCurrentPage() * pageRequest.getPageSize() - 1;
+        List<Live> lives = baseMapper.liveListAll();
+
+        // 对结果进行分页处理
+        List<Live> pageLives = lives.stream()
+                .skip(start)
+                .limit(pageRequest.getPageSize())
+                .collect(Collectors.toList());
+
+        PageInfo<Live> result = new PageInfo<>(pageLives);
+        result.setTotal(lives.size());
+        return R.ok().put("data", result);
+    }
+
     /**
      * 修改直播
      *

+ 16 - 0
fs-user-app/src/main/java/com/fs/app/controller/live/LiveController.java

@@ -110,6 +110,22 @@ public class LiveController extends AppBaseController {
 		return liveFacadeService.liveList(pageRequest);
 	}
 
+	@Login
+	@ApiOperation("直播间列表")
+	@GetMapping("/liveListAll")
+	@ApiResponse(code = 200, message = "", response = LiveInfoVo.class)
+	public R liveListAll(PageRequest pageRequest) {
+/*		PageHelper.startPage(Integer.parseInt(ServletUtils.getParameter("pageNum")) ,Integer.parseInt(ServletUtils.getParameter("pageSize")) );
+		try {
+			List<Live> list = liveService.liveList();
+			PageInfo<Live> result = new PageInfo<>(list);
+			return R.ok().put("data", result);
+		} catch (Exception e) {
+			return R.error("操作异常");
+		}*/
+		return liveService.liveListAll(pageRequest);
+	}
+
 	@Login
 	@ApiOperation("直播间列表")
 	@GetMapping("/liveList/{companyId}")