zqy
2024-06-23 a69aafe60ce001834b981778f12fd74d4af77e23
ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZfDoctorShareController.java
@@ -3,13 +3,17 @@
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.domain.ShareMore;
import com.ruoyi.domain.ZfDoctor;
import com.ruoyi.domain.ZfDoctorDownload;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZfDoctorDownloadService;
import com.ruoyi.service.ZfDoctorService;
import com.ruoyi.service.ZfDoctorShareService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/ZfDoctorShare")
@@ -17,6 +21,14 @@
    @Resource
    ZfDoctorShareService zfDoctorShareService;
    @Resource
    ZfDoctorService zfDoctorService;
    @Resource
    ZInfoUserService zInfoUserService;
    @Resource
    ZfDoctorDownloadService zfDoctorDownloadService;
    /**
     * 分享数据
     */
@@ -37,9 +49,9 @@
    /**
     * 用户自己查看别人分享的数据和分享人
     */
    @PostMapping("/getInfoByShareId")
    public AjaxResult empowerGetInfo2(@RequestBody Long shareId){
        return zfDoctorShareService.listByUserId(shareId);
    @GetMapping("/getInfoByShareId")
    public AjaxResult empowerGetInfo2(){
        return zfDoctorShareService.listByUserId();
    }
    /**
     * 根据userId和shareId收回已经授权给那些人
@@ -49,5 +61,29 @@
        return zfDoctorShareService.deleteZa(zfDoctor);
    }
    /**
     * 下载分享的数据
     */
    @PostMapping("/downloadDate")
    public AjaxResult ifDownLoad(@RequestBody ZfDoctorDownload zfDoctorDownload){
        return zfDoctorDownloadService.addData(zfDoctorDownload);
    }
    /**
     * 展示下载分享的数据
     */
    @GetMapping("/all")
    public List<ZfDoctor> data(ZfDoctorDownload zfDoctorDownload){
        List<ZfDoctorDownload> as = zfDoctorDownloadService.selectDoctorList(zfDoctorDownload);
        List<ZfDoctor> bs = new ArrayList<>();
        for (ZfDoctorDownload a: as) {
            if (zfDoctorService.getById(a.getDownloadContent()) != null) {
                ZfDoctor ds = zfDoctorService.getById(a.getDownloadContent());
                ds.setShareId(a.getShareId());
                bs.add(ds);
            }
        }
        return bs;
    }
}