|
@ -0,0 +1,132 @@
|
|
|
|
package com.yihu.jw.base.endpoint.video;
|
|
|
|
|
|
|
|
import com.yihu.jw.base.service.video.BaseVideoGroupService;
|
|
|
|
import com.yihu.jw.restmodel.web.Envelop;
|
|
|
|
import com.yihu.jw.restmodel.web.PageEnvelop;
|
|
|
|
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author xyq
|
|
|
|
* @create 2022-07-04 16:18
|
|
|
|
* @slogan 他化自在,我自逍遥
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping(value = "/video/manager")
|
|
|
|
@Api(value = "视频栏目管理接口", description = "视频栏目管理接口", tags = {"wlyy基础服务 - 视频栏目管理接口"})
|
|
|
|
public class BaseVideoEndpoint extends EnvelopRestEndpoint {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private BaseVideoGroupService videoGroupService;
|
|
|
|
|
|
|
|
@ApiOperation(value = "分页获取视频栏目")
|
|
|
|
@GetMapping("/getVideoGroupPage")
|
|
|
|
public PageEnvelop getVideoGroupPage(@ApiParam(name = "name",value = "栏目名字搜索")@RequestParam(required = false)String name,
|
|
|
|
@ApiParam(name = "page",value = "页码") @RequestParam(required = false,defaultValue = "1")Integer page,
|
|
|
|
@ApiParam(name = "pageSize",value = "每页大小") @RequestParam(required = false,defaultValue = "20")Integer pageSize){
|
|
|
|
try {
|
|
|
|
return videoGroupService.getVideoGroupPage(name, page, pageSize);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedPageEnvelopException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "修改视频栏目")
|
|
|
|
@PostMapping("/updateVideoGroup")
|
|
|
|
public Envelop updateVideoGroup(@ApiParam @RequestParam Long id,
|
|
|
|
@ApiParam(name = "name",value = "栏目名称") @RequestParam String name,
|
|
|
|
@ApiParam(name = "sortNum",value = "栏目排序")@RequestParam(required = false,defaultValue = "1")Integer sortNum,
|
|
|
|
@ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1")Integer status){
|
|
|
|
try {
|
|
|
|
return videoGroupService.updateVideoGroup(id, name, sortNum, status);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "新增视频栏目")
|
|
|
|
@PostMapping("/addVideoGroup")
|
|
|
|
public Envelop addVideoGroup(@ApiParam(name = "name",value = "栏目名称") @RequestParam String name,
|
|
|
|
@ApiParam(name = "sortNum",value = "栏目排序")@RequestParam(required = false,defaultValue = "1")Integer sortNum,
|
|
|
|
@ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1")Integer status){
|
|
|
|
try {
|
|
|
|
return videoGroupService.updateVideoGroup(null, name, sortNum, status);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "删除视频栏目")
|
|
|
|
@PostMapping("/deleteVideoGroup")
|
|
|
|
public Envelop deleteVideoGroup(@ApiParam @RequestParam Long id){
|
|
|
|
try {
|
|
|
|
return videoGroupService.deleteVideoGroup(id);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("分页获取视频列表")
|
|
|
|
@GetMapping("/getVideoPage")
|
|
|
|
public PageEnvelop getVideoPage(@ApiParam(name = "title",value = "视频标题")@RequestParam(required = false) String title,
|
|
|
|
@ApiParam(name = "type",value = "栏目id")@RequestParam(required = false)Integer type,
|
|
|
|
@ApiParam(name = "page",value = "页码") @RequestParam(required = false,defaultValue = "1")Integer page,
|
|
|
|
@ApiParam(name = "pageSize",value = "每页大小") @RequestParam(required = false,defaultValue = "20")Integer pageSize){
|
|
|
|
try {
|
|
|
|
return videoGroupService.getVideoPage(title, type, page, pageSize);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedPageEnvelopException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation("修改视频")
|
|
|
|
@PostMapping("/updateVideo")
|
|
|
|
public Envelop updateVideo(@ApiParam @RequestParam String id,
|
|
|
|
@ApiParam(name = "type",value = "栏目id")@RequestParam Integer type,
|
|
|
|
@ApiParam(name = "title",value = "视频标题")@RequestParam String title,
|
|
|
|
@ApiParam(name = "url",value = "视频播放地址")@RequestParam String url,
|
|
|
|
@ApiParam(name = "img",value = "封面图片")@RequestParam(required = false) String img,
|
|
|
|
@ApiParam(name = "introduction",value = "简介")@RequestParam(required = false)String introduction,
|
|
|
|
@ApiParam(name = "sortNum",value = "排序")@RequestParam(required = false,defaultValue = "1")Integer sortNum,
|
|
|
|
@ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1")Integer status){
|
|
|
|
try {
|
|
|
|
return videoGroupService.updateVideo(id, type, title, url, img, introduction, sortNum, status);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("新增视频")
|
|
|
|
@PostMapping("/addVideo")
|
|
|
|
public Envelop addVideo(@ApiParam(name = "type",value = "栏目id")@RequestParam Integer type,
|
|
|
|
@ApiParam(name = "title",value = "视频标题")@RequestParam String title,
|
|
|
|
@ApiParam(name = "url",value = "视频播放地址")@RequestParam String url,
|
|
|
|
@ApiParam(name = "img",value = "封面图片")@RequestParam(required = false) String img,
|
|
|
|
@ApiParam(name = "introduction",value = "简介")@RequestParam(required = false)String introduction,
|
|
|
|
@ApiParam(name = "sortNum",value = "排序")@RequestParam(required = false,defaultValue = "1")Integer sortNum,
|
|
|
|
@ApiParam(name = "status",value = "1可用,0禁用")@RequestParam(required = false,defaultValue = "1")Integer status){
|
|
|
|
try {
|
|
|
|
return videoGroupService.updateVideo(null, type, title, url, img, introduction, sortNum, status);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("删除视频")
|
|
|
|
@RequestMapping(value = "/deleteVideo",method = RequestMethod.POST)
|
|
|
|
public Envelop deleteVideo(@ApiParam(name = "id",value = "视频id")@RequestParam String id){
|
|
|
|
try {
|
|
|
|
return videoGroupService.deleteVideo(id);
|
|
|
|
}catch (Exception e){
|
|
|
|
return failedException2(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|