Commit 1b25b560 by 邓敏

新增查询全部Label + 视频

1 parent b559abba
......@@ -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());
}
}
......@@ -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;
/**
* <p>
* 视频库类目表 Mapper 接口
......@@ -15,4 +18,5 @@ import org.springframework.stereotype.Repository;
@Repository
public interface VodLabelDictMapper extends BaseMapper<VodLabelDictDO> {
List<VodLabelTreeVO> queryVodLabel();
}
......@@ -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;
/**
* <p>
......@@ -13,7 +16,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
* @author DengMin
* @since 2022-07-19
*/
public interface VodLableDictService extends IService<VodLabelDictDO> {
public interface VodLabelDictService extends IService<VodLabelDictDO> {
IPage<VodLabelDictDO> queryVodLabelPage(VodLabelPageDTO vodLabelPageDTO);
List<VodLabelTreeVO> queryVodLabelTree();
}
......@@ -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;
/**
* <p>
* 视频库类目表 服务实现类
......@@ -20,7 +26,10 @@ import org.springframework.stereotype.Service;
* @since 2022-07-19
*/
@Service
public class VodLabelDictServiceImpl extends ServiceImpl<VodLabelDictMapper, VodLabelDictDO> implements VodLableDictService {
public class VodLabelDictServiceImpl extends ServiceImpl<VodLabelDictMapper, VodLabelDictDO> implements VodLabelDictService {
@Autowired
private VodDictMapper vodDictMapper;
@Override
public IPage<VodLabelDictDO> queryVodLabelPage(VodLabelPageDTO vodLabelPageDTO) {
......@@ -29,4 +38,17 @@ public class VodLabelDictServiceImpl extends ServiceImpl<VodLabelDictMapper, Vod
.lambda().like(StringUtils.isNotBlank(vodLabelPageDTO.getLabelName()),
VodLabelDictDO::getLabelName, vodLabelPageDTO.getLabelName()));
}
@Override
public List<VodLabelTreeVO> queryVodLabelTree() {
List<VodLabelTreeVO> list = this.baseMapper.queryVodLabel();
for (VodLabelTreeVO vodLabelTreeVO : list) {
List<VodDictDO> vodDictDOList = vodDictMapper.selectList(new QueryWrapper<VodDictDO>()
.lambda()
.eq(VodDictDO::getLabelId, vodLabelTreeVO.getId())
.orderByDesc(VodDictDO::getOrderNo));
vodLabelTreeVO.setVods(vodDictDOList);
}
return list;
}
}
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<VodDictDO> vods;
}
......@@ -19,4 +19,8 @@
id, label_name
</sql>
<select id="queryVodLabel" resultType="com.subsidy.vo.vodLabel.VodLabelTreeVO">
SELECT * FROM vod_label_dict WHERE delete_date IS NULL
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!