feige
2024-10-18 98cd4713254614381ede8fa42d0820a3ffc1d53e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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){
        System.out.println("===========");
        return marrySelfService.updateData(marryInfoDto);
    }
 
    //导出
    @PostMapping("/export")
    public void export(HttpServletResponse response){
        MarryInfoDto data = (MarryInfoDto)marrySelfService.getInfo().get("data");
        List<MarryInfoDto> marryInfoDtos = new ArrayList<>();
        marryInfoDtos.add(data);
        ExcelUtil<MarryInfoDto> util = new ExcelUtil<>(MarryInfoDto.class);
        util.exportExcel(response, marryInfoDtos, "个人婚姻数据");
    }
}