package com.yh.saas.plugin.yiliangyiyun.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.ClockInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.LeaveInfo;
import com.yh.saas.plugin.yiliangyiyun.service.ILeaveInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 记录请假信息 前端控制器
 * </p>
 *
 * @author Gdc
 * @since 2022-06-22
 */
@RestController
@RequestMapping("/leaveInfo")
public class LeaveInfoController {
    @Autowired
    private ILeaveInfoService leaveInfoService;

    /**
     * 添加请假信息
     *
     * @param leaveInfo
     * @return
     */
    @PostMapping("/api/addLeave")
    public String addLeave(@RequestBody LeaveInfo leaveInfo) {
        return leaveInfoService.addLeave(leaveInfo);
    }
    /**
     * 请假记录查询
     *
     * @param leaveInfo
     * @return
     */
    @GetMapping("/selectLeaveInfo")
    public Page<LeaveInfo> selectLeaveInfo(LeaveInfo leaveInfo) {
        return leaveInfoService.selectLeaveInfo(leaveInfo);
    }
    /**
     * 请假记录查询(PC)
     *
     * @param leaveInfo
     * @return
     */
    @GetMapping("/selectLeaveInfoPc")
    public Page<LeaveInfo> selectLeaveInfoPc(LeaveInfo leaveInfo) {
        return leaveInfoService.selectLeaveInfoPc(leaveInfo);
    }
    /**
     * 查看请假信息
     *
     * @param id
     * @return
     */
    @GetMapping("/getLeaveInfo")
    public LeaveInfo getLeaveInfo(@RequestParam String id) {
        return leaveInfoService.getLeaveInfo(id);
    }
}

