VodLabelDictController.java 2.53 KB
package com.subsidy.controller;

import com.subsidy.common.ResponseData;
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 io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;

/**
 * <p>
 * 视频库类目表 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2022-07-19
 */
@RestController
@Api(tags = "视频库类目表")
@RequestMapping("/vodLabelDict")
public class VodLabelDictController {

    @Autowired
    private VodLableDictService vodLableDictService;

    @PostMapping(value = "addVodLabel")
    @ApiOperation("添加视频类目: labelName/类目名称")
    @LoginRequired
    public ResponseVO addVodLabel(@RequestBody VodLabelDictDO vodLabelDictDO) {
        vodLableDictService.save(vodLabelDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "updateVodLabel")
    @ApiOperation("添加视频类目: id/类目ID、labelName/类目名称")
    @LoginRequired
    public ResponseVO updateVodLabel(@RequestBody VodLabelDictDO vodLabelDictDO) {
        vodLableDictService.updateById(vodLabelDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "deleteVodLabel")
    @ApiOperation("添加视频类目: id/类目ID")
    @LoginRequired
    public ResponseVO deleteVodLabel(@RequestBody VodLabelDictDO vodLabelDictDO) {
        vodLableDictService.removeById(vodLabelDictDO.getId());
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "queryVodLabelPage")
    @ApiOperation("分页查询视频类目: labelName/名称、pageNum/但前页数、pageSize/每页显示条数")
    @LoginRequired
    public ResponseVO queryVodLabelPage(@RequestBody VodLabelPageDTO vodLabelPageDTO) {
        return ResponseData.generateCreatedResponse(0, vodLableDictService.queryVodLabelPage(vodLabelPageDTO));
    }

    @PostMapping(value = "queryVodLabel")
    @ApiOperation("查询全部视频类目")
    @LoginRequired
    public ResponseVO queryVodLabel() {
        return ResponseData.generateCreatedResponse(0, vodLableDictService.list());
    }
}