package com.ruoyi.web.controller.zhang; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.ZfDoctor; import com.ruoyi.domain.dto.MarryInfoDto; import com.ruoyi.service.MarrySelfService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; import java.util.List; /** * @Author Jinquan_Ou * @Description * @Date 2023-08-07 21:26 * @Version 1.0.0 **/ @RestController @RequestMapping("/marrySelf") public class MarrySelfController { @Resource MarrySelfService marrySelfService; //获取所有信息 @GetMapping() public AjaxResult getInfo(){ return marrySelfService.getInfo(); } //新增或修改基本信息 @PostMapping() public AjaxResult updateData(@RequestBody MarryInfoDto marryInfoDto){ return marrySelfService.updateData(marryInfoDto); } //导出 @PostMapping("/export") public void export(HttpServletResponse response){ MarryInfoDto data = (MarryInfoDto)marrySelfService.getInfo().get("data"); List marryInfoDtos = new ArrayList<>(); marryInfoDtos.add(data); ExcelUtil util = new ExcelUtil<>(MarryInfoDto.class); util.exportExcel(response, marryInfoDtos, "个人婚姻数据"); } }