package com.ruoyi.staff.controller; import com.baomidou.mybatisplus.core.metadata.IPage; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.compensationperformance.pojo.CompensationPerformance; import com.ruoyi.framework.aspectj.lang.annotation.Log; import com.ruoyi.framework.aspectj.lang.enums.BusinessType; import com.ruoyi.framework.web.controller.BaseController; import com.ruoyi.framework.web.domain.R; import com.ruoyi.staff.dto.SaveStaffSchedulingDto; import com.ruoyi.staff.dto.StaffSchedulingDto; import com.ruoyi.staff.service.StaffSchedulingService; import com.ruoyi.staff.vo.SearchSchedulingVo; import lombok.RequiredArgsConstructor; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import jakarta.servlet.http.HttpServletResponse; import java.util.List; /** * 排班 * @author buhuazhen * @date 2025/9/3 * @email 3038525872@qq.com */ @RestController @RequestMapping("/staff/staffScheduling") @RequiredArgsConstructor public class StaffSchedulingController extends BaseController { private final StaffSchedulingService staffSchedulingService; @PostMapping("/listPage") public R listPage(@RequestBody SearchSchedulingVo vo){ return R.ok(staffSchedulingService.listPage(vo)); } @PostMapping("/save") public R save(@RequestBody @Validated SaveStaffSchedulingDto saveStaffSchedulingDto){ staffSchedulingService.saveStaffScheduling(saveStaffSchedulingDto); return R.ok(); } @DeleteMapping("/delByIds") public R delByIds(@RequestBody List ids){ staffSchedulingService.removeByIds(ids); return R.ok(); } @DeleteMapping("/del/{id}") public R del(@PathVariable("id") Integer id){ staffSchedulingService.removeById(id); return R.ok(); } /** * 获取当前用户最新排班记录 */ @GetMapping("/getCurrentUserLatestScheduling") public R getCurrentUserLatestScheduling(){ return R.ok(staffSchedulingService.getCurrentUserLatestScheduling()); } @Log(title = "导出人员排班列表", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response ) { SearchSchedulingVo vo = new SearchSchedulingVo(); vo.setCurrent(-1); vo.setSize(-1); IPage list = staffSchedulingService.listPage(vo); ExcelUtil util = new ExcelUtil(StaffSchedulingDto.class); util.exportExcel(response, list.getRecords(), "导出人员排班列表"); } }