package com.fjhx.oa.controller.schedule;

import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.oa.entity.schedule.vo.ScheduleInfoVo;
import com.fjhx.oa.entity.schedule.dto.ScheduleInfoSelectDto;
import com.fjhx.oa.entity.schedule.dto.ScheduleInfoDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.oa.service.schedule.ScheduleInfoService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


/**
 * <p>
 * 日程信息表 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-04-03
 */
@RestController
@RequestMapping("/scheduleInfo")
public class ScheduleInfoController {

    @Autowired
    private ScheduleInfoService scheduleInfoService;

    /**
     * 日程信息表分页
     */
    @PostMapping("/page")
    public Page<ScheduleInfoVo> page(@RequestBody ScheduleInfoSelectDto dto) {
        return scheduleInfoService.getPage(dto);
    }

    /**
     * 日程信息表明细
     */
    @PostMapping("/detail")
    public ScheduleInfoVo detail(@RequestBody BaseSelectDto dto) {
        return scheduleInfoService.detail(dto.getId());
    }

    /**
     * 日程信息表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody ScheduleInfoDto scheduleInfoDto) {
        scheduleInfoService.add(scheduleInfoDto);
    }

    /**
     * 日程信息表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody ScheduleInfoDto scheduleInfoDto) {
        scheduleInfoService.edit(scheduleInfoDto);
    }

    /**
     * 日程信息表删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        scheduleInfoService.delete(dto.getId());
    }

    /**
     * 我的日程
     */
    @PostMapping("/mySchedule")
    public List<ScheduleInfoVo> mySchedule(@RequestBody ScheduleInfoSelectDto dto){
        return scheduleInfoService.mySchedule(dto);
    }

}
