package com.qmth.exam.reserve.controller.student;

import com.qmth.boot.api.annotation.Aac;
import com.qmth.boot.api.constant.ApiConstant;
import com.qmth.exam.reserve.bean.category.CategoryInfo;
import com.qmth.exam.reserve.controller.BaseController;
import com.qmth.exam.reserve.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Api(tags = "【考生端】数据分类相关接口")
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/student/category")
@Aac(strict = false, auth = true)
public class CategoryController extends BaseController {

    private static final Logger log = LoggerFactory.getLogger(CategoryController.class);

    @Autowired
    private CategoryService categoryService;

    @ApiOperation(value = "获取数据分类列表（树结构）")
    @PostMapping(value = "/list")
    public List<CategoryInfo> list() {
        return categoryService.getCategoryTreeForStudent(curLoginStudent());
    }

}
