liusheng
2023-10-26 201029ebe1fffdc3335c1bbd60dd6befe0283b7c
ruoyi-admin/src/main/java/com/ruoyi/web/controller/project/ServiceDonateorganController.java
@@ -3,17 +3,19 @@
import java.util.Arrays;
import java.util.List;
import com.ruoyi.project.domain.BaseOrganization;
import com.ruoyi.project.domain.ServiceDonatebaseinfo;
import com.ruoyi.common.utils.bean.DtoConversionUtils;
import com.ruoyi.project.domain.*;
import com.ruoyi.project.domain.vo.DonateOrganVO;
import com.ruoyi.project.domain.vo.NumberOfOrgans;
import com.ruoyi.project.domain.vo.TimeVO;
import com.ruoyi.project.mapper.BaseOrganizationMapper;
import com.ruoyi.project.service.IServiceDonatebaseinfoService;
import com.ruoyi.project.service.IServiceOrganallocationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
@@ -27,7 +29,6 @@
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.project.domain.ServiceDonateorgan;
import com.ruoyi.project.service.IServiceDonateorganService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -45,6 +46,9 @@
    @Autowired
    private IServiceDonateorganService serviceDonateorganService;
    @Autowired
    private IServiceOrganallocationService serviceOrganallocationService;
    /**
     * 查询捐献器官管理列表
@@ -55,6 +59,17 @@
    public TableDataInfo list(ServiceDonateorgan serviceDonateorgan) {
        startPage();
        List<ServiceDonateorgan> list = serviceDonateorganService.queryList(serviceDonateorgan);
        if (!CollectionUtils.isEmpty(list)) {
            List<ServiceDonateorganVO> serviceDonateorganVOS = DtoConversionUtils.sourceToTarget(list, ServiceDonateorganVO.class);
            for (ServiceDonateorganVO serviceDonateorganVO : serviceDonateorganVOS) {
                ServiceOrganallocation serviceOrganallocation = new ServiceOrganallocation();
                serviceOrganallocation.setOrganid(serviceDonateorganVO.getId());
                List<ServiceOrganallocation> serviceOrganallocations = serviceOrganallocationService.selectServiceOrganallocationList(serviceOrganallocation);
                serviceDonateorganVO.setServiceOrganallocations(serviceOrganallocations);
            }
            return getDataTable(serviceDonateorganVOS);
        }
        return getDataTable(list);
    }