From 1b25b560071086188a9fe4e0a812a0dbeb70f7af Mon Sep 17 00:00:00 2001
From: DengMin <16679070171@qq.com>
Date: Fri, 5 Aug 2022 15:11:00 +0800
Subject: [PATCH] 新增查询全部Label + 视频
---
src/main/java/com/subsidy/controller/VodLabelDictController.java | 11 +++++++++--
src/main/java/com/subsidy/mapper/VodLabelDictMapper.java | 4 ++++
src/main/java/com/subsidy/service/VodLabelDictService.java | 24 ++++++++++++++++++++++++
src/main/java/com/subsidy/service/VodLableDictService.java | 19 -------------------
src/main/java/com/subsidy/service/impl/VodLabelDictServiceImpl.java | 26 ++++++++++++++++++++++++--
src/main/java/com/subsidy/vo/vodLabel/VodLabelTreeVO.java | 15 +++++++++++++++
src/main/resources/mapper/VodLabelDictMapper.xml | 4 ++++
7 files changed, 80 insertions(+), 23 deletions(-)
create mode 100644 src/main/java/com/subsidy/service/VodLabelDictService.java
delete mode 100644 src/main/java/com/subsidy/service/VodLableDictService.java
create mode 100644 src/main/java/com/subsidy/vo/vodLabel/VodLabelTreeVO.java
diff --git a/src/main/java/com/subsidy/controller/VodLabelDictController.java b/src/main/java/com/subsidy/controller/VodLabelDictController.java
index 7525d6c..c92faf6 100644
--- a/src/main/java/com/subsidy/controller/VodLabelDictController.java
+++ b/src/main/java/com/subsidy/controller/VodLabelDictController.java
@@ -5,7 +5,7 @@ import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.label.VodLabelPageDTO;
import com.subsidy.model.VodLabelDictDO;
-import com.subsidy.service.VodLableDictService;
+import com.subsidy.service.VodLabelDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@@ -28,7 +28,7 @@ import io.swagger.annotations.Api;
public class VodLabelDictController {
@Autowired
- private VodLableDictService vodLableDictService;
+ private VodLabelDictService vodLableDictService;
@PostMapping(value = "addVodLabel")
@ApiOperation("添加视频类目: labelName/类目名称")
@@ -67,4 +67,11 @@ public class VodLabelDictController {
public ResponseVO queryVodLabel() {
return ResponseData.generateCreatedResponse(0, vodLableDictService.list());
}
+
+ @PostMapping(value = "queryVodLabelTree")
+ @ApiOperation("获取目录和视频")
+ @LoginRequired
+ public ResponseVO getContentVodTree() {
+ return ResponseData.generateCreatedResponse(0, vodLableDictService.queryVodLabelTree());
+ }
}
diff --git a/src/main/java/com/subsidy/mapper/VodLabelDictMapper.java b/src/main/java/com/subsidy/mapper/VodLabelDictMapper.java
index 058bff9..ea6f5e1 100644
--- a/src/main/java/com/subsidy/mapper/VodLabelDictMapper.java
+++ b/src/main/java/com/subsidy/mapper/VodLabelDictMapper.java
@@ -2,8 +2,11 @@ package com.subsidy.mapper;
import com.subsidy.model.VodLabelDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.subsidy.vo.vodLabel.VodLabelTreeVO;
import org.springframework.stereotype.Repository;
+import java.util.List;
+
/**
*
* 视频库类目表 Mapper 接口
@@ -15,4 +18,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface VodLabelDictMapper extends BaseMapper {
+ List queryVodLabel();
}
diff --git a/src/main/java/com/subsidy/service/VodLabelDictService.java b/src/main/java/com/subsidy/service/VodLabelDictService.java
new file mode 100644
index 0000000..21ada08
--- /dev/null
+++ b/src/main/java/com/subsidy/service/VodLabelDictService.java
@@ -0,0 +1,24 @@
+package com.subsidy.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.subsidy.dto.label.VodLabelPageDTO;
+import com.subsidy.model.VodLabelDictDO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.subsidy.vo.vodLabel.VodLabelTreeVO;
+
+import java.util.List;
+
+/**
+ *
+ * 视频库类目表 服务类
+ *
+ *
+ * @author DengMin
+ * @since 2022-07-19
+ */
+public interface VodLabelDictService extends IService {
+
+ IPage queryVodLabelPage(VodLabelPageDTO vodLabelPageDTO);
+
+ List queryVodLabelTree();
+}
diff --git a/src/main/java/com/subsidy/service/VodLableDictService.java b/src/main/java/com/subsidy/service/VodLableDictService.java
deleted file mode 100644
index b0fcb56..0000000
--- a/src/main/java/com/subsidy/service/VodLableDictService.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.subsidy.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.subsidy.dto.label.VodLabelPageDTO;
-import com.subsidy.model.VodLabelDictDO;
-import com.baomidou.mybatisplus.extension.service.IService;
-
-/**
- *
- * 视频库类目表 服务类
- *
- *
- * @author DengMin
- * @since 2022-07-19
- */
-public interface VodLableDictService extends IService {
-
- IPage queryVodLabelPage(VodLabelPageDTO vodLabelPageDTO);
-}
diff --git a/src/main/java/com/subsidy/service/impl/VodLabelDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/VodLabelDictServiceImpl.java
index 09e650b..0728ccf 100644
--- a/src/main/java/com/subsidy/service/impl/VodLabelDictServiceImpl.java
+++ b/src/main/java/com/subsidy/service/impl/VodLabelDictServiceImpl.java
@@ -4,13 +4,19 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.label.VodLabelPageDTO;
+import com.subsidy.mapper.VodDictMapper;
+import com.subsidy.model.VodDictDO;
import com.subsidy.model.VodLabelDictDO;
import com.subsidy.mapper.VodLabelDictMapper;
-import com.subsidy.service.VodLableDictService;
+import com.subsidy.service.VodLabelDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.subsidy.vo.vodLabel.VodLabelTreeVO;
import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import java.util.List;
+
/**
*
* 视频库类目表 服务实现类
@@ -20,7 +26,10 @@ import org.springframework.stereotype.Service;
* @since 2022-07-19
*/
@Service
-public class VodLabelDictServiceImpl extends ServiceImpl implements VodLableDictService {
+public class VodLabelDictServiceImpl extends ServiceImpl implements VodLabelDictService {
+
+ @Autowired
+ private VodDictMapper vodDictMapper;
@Override
public IPage queryVodLabelPage(VodLabelPageDTO vodLabelPageDTO) {
@@ -29,4 +38,17 @@ public class VodLabelDictServiceImpl extends ServiceImpl queryVodLabelTree() {
+ List list = this.baseMapper.queryVodLabel();
+ for (VodLabelTreeVO vodLabelTreeVO : list) {
+ List vodDictDOList = vodDictMapper.selectList(new QueryWrapper()
+ .lambda()
+ .eq(VodDictDO::getLabelId, vodLabelTreeVO.getId())
+ .orderByDesc(VodDictDO::getOrderNo));
+ vodLabelTreeVO.setVods(vodDictDOList);
+ }
+ return list;
+ }
}
diff --git a/src/main/java/com/subsidy/vo/vodLabel/VodLabelTreeVO.java b/src/main/java/com/subsidy/vo/vodLabel/VodLabelTreeVO.java
new file mode 100644
index 0000000..8d703d7
--- /dev/null
+++ b/src/main/java/com/subsidy/vo/vodLabel/VodLabelTreeVO.java
@@ -0,0 +1,15 @@
+package com.subsidy.vo.vodLabel;
+
+import com.subsidy.model.VodDictDO;
+import lombok.Data;
+import java.util.List;
+
+@Data
+public class VodLabelTreeVO {
+
+ private Long id;
+
+ private String labelName;
+
+ private List vods;
+}
diff --git a/src/main/resources/mapper/VodLabelDictMapper.xml b/src/main/resources/mapper/VodLabelDictMapper.xml
index 7467d2a..797da16 100644
--- a/src/main/resources/mapper/VodLabelDictMapper.xml
+++ b/src/main/resources/mapper/VodLabelDictMapper.xml
@@ -19,4 +19,8 @@
id, label_name
+
+
--
libgit2 0.25.0