package com.ruoyi.approve.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.approve.bean.dto.FinReimbursementDto;
import com.ruoyi.approve.bean.vo.FinReimbursementVo;
import com.ruoyi.approve.service.FinReimbursementService;
import com.ruoyi.framework.web.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
*
* 报销单主表 前端控制器
*
*
* @author 芯导软件(江苏)有限公司
* @since 2026-05-21 09:56:15
*/
@RestController
@RequestMapping("/finReimbursement")
@Tag(name = "报销单主表", description = "报销单主表")
@AllArgsConstructor
public class FinReimbursementController {
private final FinReimbursementService finReimbursementService;
@GetMapping("/listPage")
@Operation(summary = "分页查询")
public R listPage(Page page, FinReimbursementDto finReimbursementDto) {
return R.ok(finReimbursementService.listPage(finReimbursementDto, page));
}
@PostMapping("/save")
@Operation(summary = "保存")
public R save(@RequestBody FinReimbursementDto finReimbursementDto) {
return R.ok(finReimbursementService.add(finReimbursementDto));
}
@GetMapping("/detail")
@Operation(summary = "详情")
public R detail(Long id) {
return R.ok(finReimbursementService.detail(id));
}
@PostMapping("/update")
@Operation(summary = "修改")
public R update(@RequestBody FinReimbursementDto finReimbursementDto) {
return R.ok(finReimbursementService.update(finReimbursementDto));
}
@DeleteMapping("/delete")
@Operation(summary = "删除")
public R delete(@RequestBody List ids) {
return R.ok(finReimbursementService.delete(ids));
}
@PostMapping("/export")
@Operation(summary = "导出费用报销数据")
public void export(HttpServletResponse response, FinReimbursementDto finReimbursementDto) {
List list = finReimbursementService.list(finReimbursementDto);
ExcelUtil util = new ExcelUtil(FinReimbursementVo.class);
util.exportExcel(response, list, "费用报销数据");
}
}