package cn.xluobo.business.sys.admin.controller;


import com.ruoyi.system.domain.resp.RespTreeSelect;
import com.ruoyi.system.service.impl.BusinessSysDeptService;
import com.ruoyi.core.api.APIResponse;
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.List;

/**
 * <p>
 * 部门表 前端控制器
 * </p>
 *
 * @author zhangby
 * @since 2020-01-18
 */
@RestController
@RequestMapping("/api/system/dept")
public class ISysDeptController {

    @Autowired
    private BusinessSysDeptService sysDeptService;



    /**
     * 前端select
     *
     * @return
     */
    @GetMapping("/list/treeSelect")
    public APIResponse treeSelect() {
        return sysDeptService.treeSelect();
    }


    /**
     * 校区列表
     *
     * @return
     */
    @GetMapping("/list/campusList")
    public APIResponse campusList() {
        List<RespTreeSelect> respTreeSelects = sysDeptService.campusList();
        return APIResponse.toAPIResponse(respTreeSelects);
    }

    /**
     * 可选校区类型
     * 如果拥有全部校区权限，返回全部校区 部分校区
     * 否二 返回 部分校区
     *
     * @return
     */
    @GetMapping("/list/campusSelect")
    public APIResponse campusSelect() {
        List<RespTreeSelect> respTreeSelects = sysDeptService.campusSelect();
        return APIResponse.toAPIResponse(respTreeSelects);
    }


}
