package com.zjty.tynotes.attendance.controller;

import com.zjty.tynotes.attendance.entity.ApprovalInformation;
import com.zjty.tynotes.attendance.entity.vo.request.AttenRequest;
import com.zjty.tynotes.attendance.service.AttendanceDetailsService;
import com.zjty.tynotes.misc.config.AutoDocument;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import static org.springframework.http.ResponseEntity.ok;

/**
 * @Author gwj
 * @create 2020/3/25 9:12
 * @des 考勤信息统计
 */
@Api(tags = "考勤模块", protocols = "http")
@RestController
@AutoDocument
@RequestMapping("/attendance/info")
public class AttendanceController {
    @Autowired
    private AttendanceDetailsService attendanceDetailsService;

    @ApiOperation(value = "查询个人考勤信息", response = ApprovalInformation.class)
    @PostMapping("/personnel")
    public ResponseEntity personnel(@RequestBody AttenRequest request){
        return ok(attendanceDetailsService.findPersonnel(request));
    }

    @ApiOperation(value = "查询部门考勤信息", response = ApprovalInformation.class)
    @GetMapping("/department")
    public ResponseEntity department(@RequestBody AttenRequest request){
        return ok(attendanceDetailsService.findDepartment(request));
    }

}
