package com.ym.mec.web.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
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 com.ym.mec.biz.dal.entity.MusicGroupOrganizationCourseSettings;
import com.ym.mec.biz.dal.page.CourseSettingQueryInfo;
import com.ym.mec.biz.service.MusicGroupOrganizationCourseSettingsService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.HttpResponseResult;
import com.ym.mec.common.page.PageInfo;

@RequestMapping("musicGroupOrganizationCourseSettings")
@Api(tags = "收费方式设置")
@RestController
public class MusicGroupOrganizationCourseSettingsController extends BaseController {
    @Autowired
    private MusicGroupOrganizationCourseSettingsService musicGroupOrganizationCourseSettingsService;

    @ApiOperation(value = "获取收费方式设置列表")
    @GetMapping("/queryPage")
    @PreAuthorize("@pcs.hasPermissions('musicGroupOrganizationCourseSettings/queryPage')")
    public HttpResponseResult<PageInfo<MusicGroupOrganizationCourseSettings>> queryPage(CourseSettingQueryInfo queryInfo) {
        return succeed(musicGroupOrganizationCourseSettingsService.queryPage(queryInfo));
    }

    @ApiOperation(value = "收费方式添加")
    @PostMapping("/add")
    @PreAuthorize("@pcs.hasPermissions('musicGroupOrganizationCourseSettings/add')")
    public HttpResponseResult<MusicGroupOrganizationCourseSettings> add(@RequestBody MusicGroupOrganizationCourseSettings musicGroupOrganizationCourseSettings) {
        return succeed(musicGroupOrganizationCourseSettingsService.addSetting(musicGroupOrganizationCourseSettings));
    }

    @ApiOperation(value = "删除收费方式设置")
    @PostMapping("/delSetting")
    @PreAuthorize("@pcs.hasPermissions('musicGroupOrganizationCourseSettings/delSetting')")
    public HttpResponseResult<MusicGroupOrganizationCourseSettings> delSetting(Integer id) {
        return succeed(musicGroupOrganizationCourseSettingsService.delSetting(id));
    }

    @ApiOperation(value = "修改收费方式")
    @PostMapping("/update")
    @PreAuthorize("@pcs.hasPermissions('musicGroupOrganizationCourseSettings/update')")
    public HttpResponseResult<MusicGroupOrganizationCourseSettings> update(@RequestBody MusicGroupOrganizationCourseSettings musicGroupOrganizationCourseSettings) {
        return succeed(musicGroupOrganizationCourseSettingsService.updateSetting(musicGroupOrganizationCourseSettings));
    }

}
