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/VodLableDictService.java b/src/main/java/com/subsidy/service/VodLabelDictService.java similarity index 85% rename from src/main/java/com/subsidy/service/VodLableDictService.java rename to src/main/java/com/subsidy/service/VodLabelDictService.java index b0fcb56..21ada08 100644 --- a/src/main/java/com/subsidy/service/VodLableDictService.java +++ b/src/main/java/com/subsidy/service/VodLabelDictService.java @@ -4,6 +4,9 @@ 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; /** *

@@ -13,7 +16,9 @@ import com.baomidou.mybatisplus.extension.service.IService; * @author DengMin * @since 2022-07-19 */ -public interface VodLableDictService extends IService { +public interface VodLabelDictService extends IService { IPage queryVodLabelPage(VodLabelPageDTO vodLabelPageDTO); + + List queryVodLabelTree(); } 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 + +