package com.yida.data.school.secondClass.controller;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.school.secondClass.EduSecondClassVenueExhibit;
import com.yida.data.common.core.entity.school.secondClass.EduSecondClassVenueExhibitGroup;
import com.yida.data.common.core.utils.FebsUtil;
import com.yida.data.school.secondClass.service.EduSecondClassVenueExhibitGroupService;
import com.yida.data.school.vo.secondClass.VenueExhibitGroupVO;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * Controller
 *
 * @author zhanghaijun
 * @date 2022-04-18 09:39:53
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/secondClass/venue/exhibitGroup")
@RequiredArgsConstructor
public class EduSecondclassVenueExhibitGroupController {

    private final EduSecondClassVenueExhibitGroupService eduSecondclassVenueExhibitGroupService;

    @ApiOperation("查询展品分组列表")
    @GetMapping("/listGroup")
    public ResultBean<List<VenueExhibitGroupVO>> listGroup(Long venueId) {
        return ResultBean.buildSuccess(eduSecondclassVenueExhibitGroupService.listGroup(venueId));
    }

    @ApiOperation("查询分组信息")
    @GetMapping("/getInfo")
    public ResultBean<VenueExhibitGroupVO> getInfo(Long id) {
        return ResultBean.buildSuccess(eduSecondclassVenueExhibitGroupService.getInfo(id));
    }

    @ApiOperation("新增分组")
    @PostMapping("/saveGroup")
    public ResultBean saveExhibitGroup(@RequestBody EduSecondClassVenueExhibitGroup group) {
        group.setDeptId(FebsUtil.getTopDeptId());
        eduSecondclassVenueExhibitGroupService.saveGroup(group);
        return ResultBean.buildSuccess();
    }

    @ApiOperation("删除分组")
    @GetMapping("/delGroup")
    public ResultBean delGroup(Long id) {
        eduSecondclassVenueExhibitGroupService.delGroup(id);
        return ResultBean.buildSuccess();
    }
}
