package com.xunwang.education.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.xunwang.servicebase.utils.R;
import com.xunwang.education.service.CoursePriceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Long
 * @since 2022-11-16
 */
@ApiSupport(author = "Long")
@Api("课程价格相关接口")
@RestController
@RequestMapping("/education/course-price")
public class CoursePriceController {

    @Autowired
    private CoursePriceService coursePriceService;

    /**
     * 获取课程树形结构
     * 获取课程价格对应关系
     *
     * @return
     */
    @ApiOperationSupport(author = "Long")
    @ApiOperation("获取课程树形和价格对应关系")
    @GetMapping("treeAndPrice")
    public R getTreeCourse() {
        Map<String, Object> treeAndPrice = coursePriceService.getTreeAndPrice();
        return R.ok().data(treeAndPrice);
    }

}

