liusheng
2023-12-25 2b7ad68415a5bced753fa76699fa16ee3142859b
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateorganController.java
@@ -7,8 +7,10 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.project.domain.ServiceDonatecomporgan;
import com.ruoyi.project.domain.ServiceDonateorgan;
import com.ruoyi.project.domain.ServiceDonateorganVO;
import com.ruoyi.project.domain.ServiceOrganallocation;
@@ -18,6 +20,7 @@
import com.ruoyi.project.service.IServiceOrganallocationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
@@ -31,6 +34,7 @@
 * @author ruoyi
 * @date 2021-11-10
 */
@Slf4j
@Api("捐献器官管理")
@RestController
@RequestMapping("/project/donateorgan")
@@ -280,5 +284,24 @@
        return AjaxResult.success(serviceDonateorganService.getOrganCount(timeVO));
    }
    @RepeatSubmit
    @ApiOperation("新增或修改捐献器官管理")
    @Log(title = "捐献完成", businessType = BusinessType.UPDATE)
    @PostMapping("/saveOrUpdateDonateorgan")
    public AjaxResult saveOrUpdateDonateorgan(@RequestBody List<ServiceDonateorgan> serviceDonateorganList) {
        if (CollectionUtils.isEmpty(serviceDonateorganList)) {
            throw new BaseException("请检查需要新增或修改的捐献器官管理参数是否完整");
        }
        Boolean i = null;
        for (ServiceDonateorgan serviceDonateorgan : serviceDonateorganList) {
            log.info("捐献器官移植id是否为空 : {},基础表的id为 : {}", serviceDonateorgan.getId(), serviceDonateorgan.getInfoid());
            if (serviceDonateorgan.getId() == null) {
                i = serviceDonateorganService.save(serviceDonateorgan);
            } else {
                i = serviceDonateorganService.updateById(serviceDonateorgan);
            }
        }
        return toAjax(i);
    }
}