树形列表查询

This commit is contained in:
guoshengxiong 2024-05-18 18:22:43 +08:00
parent 26db3b59a3
commit 0702cfe5ac
3 changed files with 39 additions and 0 deletions

View File

@ -250,6 +250,15 @@ public class VideoItemController {
return Result.success(videoItemService.selectProjectVideoList(map));
}
@ApiOperation(value = "查询项目视频tree列表", notes = "查询项目视频tree列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
})
@PostMapping("/selectProjectVideoTreeList")
public Result<Map<String, Object>> selectProjectVideoTreeList(@RequestBody Map<String, Object> map) {
return Result.success(videoItemService.selectProjectVideoTreeList(map));
}
@ApiOperation(value = "查询项目下所有视频列表", notes = "查询项目下所有视频列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),

View File

@ -47,6 +47,8 @@ public interface IVideoItemService extends IService<VideoItem> {
Map<String, Object> selectProjectVideoList(Map<String, Object> map);
Map<String, Object> selectProjectVideoTreeList(Map<String, Object> map);
List<EntityMap> selecAllVideoList(Map<String, Object> map);
Map<String, Object> selectUserVideoList(Map<String, Object> map);

View File

@ -1,6 +1,8 @@
package com.zhgd.xmgl.modules.video.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -411,6 +413,32 @@ public class VideoItemServiceImpl extends ServiceImpl<VideoItemMapper, VideoItem
return data;
}
@Override
public Map<String, Object> selectProjectVideoTreeList(Map<String, Object> map) {
//视频也要放到分组的下面
Map<String, Object> data = new HashMap<>();
map.put("all", null);
Map<String, Object> resultMap = selectProjectVideoList(map);
JSONArray newArray = new JSONArray();
JSONArray jsonArray = JSONArray.parseArray(JSON.toJSONString(resultMap.get("videoList")));
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jo = jsonArray.getJSONObject(i);
newArray.add(jo);
JSONArray videoArr = jo.getJSONArray("list");
if (videoArr == null) {
continue;
}
for (int j = 0; j < videoArr.size(); j++) {
JSONObject videoJo = videoArr.getJSONObject(j);
videoJo.put("parentId", jo.getString("id"));
newArray.add(videoJo);
}
}
data.put("videoList", ListUtils.listToTree(newArray, "id", "parentId", "children"));
data.put("type", 2);
return data;
}
@Override
public List<EntityMap> selecAllVideoList(Map<String, Object> map) {
return videoItemMapper.selectProjectVideoList(map);