package com.yida.data.user.controller.out;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.common.core.entity.system.Dept;
import com.yida.data.common.core.entity.user.EduStaff;
import com.yida.data.user.dto.ListStaffDTO;
import com.yida.data.user.service.EduStaffService;
import com.yida.data.user.vo.StaStaffDistributeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "教师管理（外部使用 不鉴权）")
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/out/staff")
public class OutEduStaffController {

    private final EduStaffService eduStaffService;

    @ApiOperation("查询职工列表")
    @GetMapping("/listStaff")
    public ResultBean<List<EduStaff>> listStaff(ListStaffDTO dto) {
        return ResultBean.buildSuccess(eduStaffService.listStaff(dto));
    }

    @ApiOperation("查询教职工分布情况")
    @GetMapping("/staStaffDistribute")
    public ResultBean<StaStaffDistributeVO> staStaffDistribute(Long[] schoolIds) {
        return ResultBean.buildSuccess(eduStaffService.staStaffDistribute(Arrays.asList(schoolIds)));
    }
}
