package cn.iocoder.yudao.module.course.controller.admin;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.course.service.SchoolCommissionService;
import cn.iocoder.yudao.module.course.vo.SchoolCommissionVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 提成记录")
@RestController
@RequestMapping("/drive/school-commission")
@Validated
public class SchoolCommissionController {

    @Resource
    private SchoolCommissionService schoolCommissionService;

    /**
     * 分页查询教练提成记录
     *
     * @param pageReqVO {@link SchoolCommissionVO}
     * @param pageNo    分页参数
     * @param pageSize  分页参数
     * @return cn.iocoder.yudao.framework.common.pojo.CommonResult<com.baomidou.mybatisplus.core.metadata.IPage < ?>>
     * @author PQZ
     * @date 13:59 2025/2/19
     **/
    @GetMapping("/page")
    @Operation(summary = "获得提成记录分页")
    public CommonResult<IPage<?>> getSchoolCommissionPage(SchoolCommissionVO pageReqVO,
                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        Page<SchoolCommissionVO> page = new Page<>(pageNo, pageSize);
        return success(schoolCommissionService.queryPage(page, pageReqVO));
    }

    @PostMapping("/create")
    @Operation(summary = "创建提成记录")
    public CommonResult<Boolean> createSchoolCommission(@Valid @RequestBody SchoolCommissionVO createReqVO) {
        return success(schoolCommissionService.createSchoolCommission(createReqVO));
    }



//    @GetMapping("/get")
//    @Operation(summary = "获得提成记录")
//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
//    @PreAuthorize("@ss.hasPermission('drive:school-commission:query')")
//    public CommonResult<SchoolCommissionVO> getSchoolCommission(@RequestParam("id") String id) {
////        SchoolCommissionDO schoolCommission = schoolCommissionService.getSchoolCommission(id);
//        return success(BeanUtils.toBean(schoolCommission, SchoolCommissionRespVO.class));
//    }
//


}
