liusheng
3 天以前 9ff5a9b1a3ce92b7bf4fcd3a8fdabbb1739cfe4b
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package com.ruoyi.web.controller.project;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.annotation.UniqueCheck;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.PageUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.project.domain.ServiceDonateorganBase;
import com.ruoyi.project.domain.vo.ServiceDonateorganBaseVO;
import com.ruoyi.project.domain.dto.DonateorganBaseInfoDTO;
import com.ruoyi.project.domain.vo.DonateorganBaseInfoVO;
import com.ruoyi.project.service.IServiceDonateorganBaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
 
import java.util.Arrays;
import java.util.List;
import java.util.Map;
 
/**
 * 捐献器官分配基础Controller
 *
 * @author ls
 * @date 2026-01-17
 */
@Api(description = "捐献器官分配基础")
@RestController
@RequestMapping("/project/donateorganBase")
public class ServiceDonateorganBaseController extends BaseController {
    @Autowired
    private IServiceDonateorganBaseService serviceDonateorganBaseService;
 
 
//    /**
//     * 查询捐献器官分配基础列表
//     */
//    @ApiOperation("查询捐献器官分配基础列表")
//// @PreAuthorize("@ss.hasPermi('project:base:list')")
//    @PostMapping("/list")
//    public Map<String, Object> list(@RequestBody ServiceDonateorganBase serviceDonateorganBase) {
//        Page<ServiceDonateorganBase> list = serviceDonateorganBaseService.queryList(serviceDonateorganBase);
//        return getDataTable(list.getRecords(), (int) list.getTotal());
//    }
 
    /**
     * 查询捐献器官分配基础列表
     */
    @ApiOperation("查询器官分配基础列表")
    @PostMapping("/list")
    public Map<String, Object> list(@RequestBody ServiceDonateorganBase serviceDonateorganBase) {
        Page<ServiceDonateorganBase> list = serviceDonateorganBaseService.queryList(serviceDonateorganBase);
        return getDataTable(list.getRecords(), (int) list.getTotal());
    }
 
 
    @ApiOperation("查询捐献器官分配基础列表")
    @PostMapping("/getDonateorganBaseInfoList")
    public Map<String, Object> getDonateorganBaseInfoList(@RequestBody DonateorganBaseInfoVO donateorganBaseInfoVO) {
        Integer offset = PageUtils.getOffset(donateorganBaseInfoVO.getPageNum(), donateorganBaseInfoVO.getPageSize());
        donateorganBaseInfoVO.setPageNum(offset);
        List<DonateorganBaseInfoDTO> donateorganBaseInfoDTOS = serviceDonateorganBaseService.getDonateorganBaseInfoList(donateorganBaseInfoVO);
 
        //获取总数
        donateorganBaseInfoVO.setPageNum(null);
        donateorganBaseInfoVO.setPageSize(null);
        Integer totalCount = 0;
        List<DonateorganBaseInfoDTO> total = serviceDonateorganBaseService.getDonateorganBaseInfoList(donateorganBaseInfoVO);
        if (!CollectionUtils.isEmpty(total)) totalCount = total.size();
 
        return getDataTable(donateorganBaseInfoDTOS, totalCount);
    }
 
    /**
     * 导出捐献器官分配基础列表
     */
    @ApiOperation("导出捐献器官分配基础列表")
    // @PreAuthorize("@ss.hasPermi('project:base:export')")
    @Log(title = "捐献器官分配基础", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ServiceDonateorganBase serviceDonateorganBase) {
        List<ServiceDonateorganBase> list = serviceDonateorganBaseService.exportQueryList(serviceDonateorganBase);
        ExcelUtil<ServiceDonateorganBase> util = new ExcelUtil<ServiceDonateorganBase>(ServiceDonateorganBase.class);
        return util.exportExcel(list, "捐献器官分配基础数据");
    }
 
    /**
     * 获取捐献器官分配基础详细信息
     */
    @ApiOperation("获取捐献器官分配基础详细信息")
    // @PreAuthorize("@ss.hasPermi('project:base:query')")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(serviceDonateorganBaseService.getById(id));
    }
 
 
    /**
     * 新增捐献器官分配基础
     */
    @ApiOperation("新增捐献器官分配基础")
    @UniqueCheck(
            fields = {"infoid"},
            entityClass = ServiceDonateorganBaseVO.class,
            serviceClass = IServiceDonateorganBaseService.class,
            message = "新增伦理审查的infoid已存在,无法保存!"
    )
    @PostMapping("/add")
    @RepeatSubmit
    public AjaxResult add(@RequestBody ServiceDonateorganBaseVO serviceDonateorganBaseVO) {
        return toAjax(serviceDonateorganBaseService.add(serviceDonateorganBaseVO));
    }
 
    /**
     * 修改捐献器官分配基础
     */
    @ApiOperation("修改捐献器官分配基础")
    // @PreAuthorize("@ss.hasPermi('project:base:edit')")
    @Log(title = "捐献器官分配基础", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @RepeatSubmit
    public AjaxResult edit(@RequestBody ServiceDonateorganBaseVO serviceDonateorganBaseVO) {
        return toAjax(serviceDonateorganBaseService.updateByParam(serviceDonateorganBaseVO));
    }
 
    /**
     * 删除捐献器官分配基础
     */
    @ApiOperation("删除捐献器官分配基础")
    // @PreAuthorize("@ss.hasPermi('project:base:remove')")
    @Log(title = "捐献器官分配基础", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(serviceDonateorganBaseService.removeByIds(Arrays.asList(ids)));
    }
}