package com.yida.data.school.leave.controller.h5;

import com.yida.data.common.core.common.ResultBean;
import com.yida.data.school.dto.leave.ListStudentRequestDetailDTO;
import com.yida.data.school.leave.service.EduLeaveRequestService;
import com.yida.data.school.vo.leave.CountRequestVO;
import com.yida.data.school.vo.leave.LeaveRequestDetailVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "请假-前台")
@RequiredArgsConstructor
@RestController
@RequestMapping("/h5/request/leaveRequest")
public class H5EduLeaveRequestController {

    private final EduLeaveRequestService eduLeaveRequestService;

    @ApiOperation("查询学生请假条(日期去包含交集的记录)")
    @GetMapping("/listStudentRequest")
    public ResultBean<List<LeaveRequestDetailVO>> listStudentLeave(ListStudentRequestDetailDTO dto) {
        return ResultBean.buildSuccess(eduLeaveRequestService.listStudentLeave(dto));
    }

    @ApiOperation("查询请假人数次数")
    @GetMapping("/countStudentRequest")
    public ResultBean<CountRequestVO> countStudentRequest(ListStudentRequestDetailDTO dto) {
        return ResultBean.buildSuccess(eduLeaveRequestService.countStudentRequest(dto));
    }
}
