|  |  | 
 |  |  | import com.ruoyi.common.enums.BusinessType; | 
 |  |  | import com.ruoyi.common.exception.base.BaseException; | 
 |  |  | import com.ruoyi.common.utils.poi.ExcelUtil; | 
 |  |  | import com.ruoyi.project.domain.ServiceDonatecompletioninfo; | 
 |  |  | import com.ruoyi.project.domain.ServiceDonatecomporgan; | 
 |  |  | import com.ruoyi.project.service.IServiceDonatecomporganService; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.commons.collections4.CollectionUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.security.access.prepost.PreAuthorize; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import java.util.Arrays; | 
 |  |  | 
 |  |  |      * 查询捐献器官移植列表 | 
 |  |  |      */ | 
 |  |  |     @ApiOperation("查询捐献器官移植列表") | 
 |  |  |     @PreAuthorize("@ss.hasPermi('project:donatecomporgan:list')") | 
 |  |  |     // // @PreAuthorize("@ss.hasPermi('project:donatecomporgan:list')") | 
 |  |  |     @GetMapping("/list") | 
 |  |  |     public TableDataInfo list(ServiceDonatecomporgan serviceDonatecomporgan) { | 
 |  |  |         startPage(); | 
 |  |  | 
 |  |  |      * 导出捐献器官移植列表 | 
 |  |  |      */ | 
 |  |  |     @ApiOperation("导出捐献器官移植列表") | 
 |  |  |     @PreAuthorize("@ss.hasPermi('project:donatecomporgan:export')") | 
 |  |  |     // // @PreAuthorize("@ss.hasPermi('project:donatecomporgan:export')") | 
 |  |  |     @Log(title = "捐献器官移植", businessType = BusinessType.EXPORT) | 
 |  |  |     @GetMapping("/export") | 
 |  |  |     public AjaxResult export(ServiceDonatecomporgan serviceDonatecomporgan) { | 
 |  |  | 
 |  |  |      * 获取捐献器官移植详细信息 | 
 |  |  |      */ | 
 |  |  |     @ApiOperation("获取捐献器官移植详细信息") | 
 |  |  |     @PreAuthorize("@ss.hasPermi('project:donatecomporgan:query')") | 
 |  |  |     // // @PreAuthorize("@ss.hasPermi('project:donatecomporgan:query')") | 
 |  |  |     @GetMapping(value = "/{id}") | 
 |  |  |     public AjaxResult getInfo(@PathVariable("id") Long id) { | 
 |  |  |         return AjaxResult.success(serviceDonatecomporganService.getById(id)); | 
 |  |  | 
 |  |  |      * 新增捐献器官移植 | 
 |  |  |      */ | 
 |  |  |     @ApiOperation("新增捐献器官移植") | 
 |  |  |     @PreAuthorize("@ss.hasPermi('project:donatecomporgan:add')") | 
 |  |  |     // // @PreAuthorize("@ss.hasPermi('project:donatecomporgan:add')") | 
 |  |  |     @Log(title = "捐献器官移植", businessType = BusinessType.INSERT) | 
 |  |  |     @PostMapping("/add") | 
 |  |  |     @RepeatSubmit | 
 |  |  | 
 |  |  |      * 修改捐献器官移植 | 
 |  |  |      */ | 
 |  |  |     @ApiOperation("修改捐献器官移植") | 
 |  |  |     @PreAuthorize("@ss.hasPermi('project:donatecomporgan:edit')") | 
 |  |  |     // // @PreAuthorize("@ss.hasPermi('project:donatecomporgan:edit')") | 
 |  |  |     @Log(title = "捐献器官移植", businessType = BusinessType.UPDATE) | 
 |  |  |     @PostMapping("/edit") | 
 |  |  |     @RepeatSubmit | 
 |  |  | 
 |  |  |      * 删除捐献器官移植 | 
 |  |  |      */ | 
 |  |  |     @ApiOperation("删除捐献器官移植") | 
 |  |  |     @PreAuthorize("@ss.hasPermi('project:donatecomporgan:remove')") | 
 |  |  |     // // @PreAuthorize("@ss.hasPermi('project:donatecomporgan:remove')") | 
 |  |  |     @Log(title = "捐献器官移植", businessType = BusinessType.DELETE) | 
 |  |  |     @GetMapping("/remove/{ids}") | 
 |  |  |     public AjaxResult remove(@PathVariable Long[] ids) { | 
 |  |  |         return toAjax(serviceDonatecomporganService.removeByIds(Arrays.asList(ids))); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @RepeatSubmit | 
 |  |  |     @ApiOperation("新增或修改捐献器官移植") | 
 |  |  |     @Log(title = "捐献完成", businessType = BusinessType.UPDATE) | 
 |  |  |     @PostMapping("/saveOrUpdateDonatecomporgan") | 
 |  |  |     public AjaxResult saveOrUpdateDonatecomporgan(@RequestBody List<ServiceDonatecomporgan> serviceDonatecomporganList) { | 
 |  |  |         if (CollectionUtils.isEmpty(serviceDonatecomporganList)) { | 
 |  |  | 
 |  |  |         Boolean i = null; | 
 |  |  |         for (ServiceDonatecomporgan serviceDonatecompletion : serviceDonatecomporganList) { | 
 |  |  |             log.info("捐献器官移植id是否为空 : {},基础表的id为 : {}", serviceDonatecompletion.getId(), serviceDonatecompletion.getInfoid()); | 
 |  |  |             if (serviceDonatecompletion.getId() == null) { | 
 |  |  |             ServiceDonatecomporgan sd = new ServiceDonatecomporgan(); | 
 |  |  |             sd.setInfoid(serviceDonatecompletion.getInfoid()); | 
 |  |  |             sd.setOrganno(serviceDonatecompletion.getOrganno()); | 
 |  |  |             sd.setDel_flag(0); | 
 |  |  |             List<ServiceDonatecomporgan> serviceDonatecomporgans = serviceDonatecomporganService.queryList(sd); | 
 |  |  |             if (serviceDonatecompletion.getId() == null && CollectionUtils.isEmpty(serviceDonatecomporgans)) { | 
 |  |  |                 i = serviceDonatecomporganService.save(serviceDonatecompletion); | 
 |  |  |             } else { | 
 |  |  |                 serviceDonatecompletion.setId(serviceDonatecomporgans.get(0).getId()); | 
 |  |  |                 i = serviceDonatecomporganService.updateById(serviceDonatecompletion); | 
 |  |  |             } | 
 |  |  |         } |