package com.ruoyi.web.controller.zhang;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.utils.ServletUtils;
|
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.*;
|
|
import javax.annotation.Resource;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import static com.ruoyi.common.core.page.TableSupport.PAGE_NUM;
|
import static com.ruoyi.common.core.page.TableSupport.PAGE_SIZE;
|
|
@RestController
|
@RequestMapping("/ZfDoctorShare")
|
public class ZfDoctorShareController extends BaseController {
|
@Resource
|
ZfDoctorShareService zfDoctorShareService;
|
|
@Resource
|
ZfDoctorService zfDoctorService;
|
|
@Resource
|
ZInfoUserService zInfoUserService;
|
|
@Resource
|
ZfDoctorDownloadService zfDoctorDownloadService;
|
/**
|
* 分享数据
|
*/
|
@PostMapping("/share")
|
public AjaxResult share(@RequestBody ShareMore zfDoctor){
|
return zfDoctorShareService.saveZa(zfDoctor);
|
}
|
|
/**
|
* 根据UserId和分享人shareId查看已经授权给那些人那些数据
|
*/
|
@PostMapping("/getInfoByUserId")
|
public AjaxResult empowerGetInfo(@RequestBody ShareMore zfDoctor){
|
Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
|
return zfDoctorService.selectListById(zfDoctorShareService.listByFidAid(zfDoctor),pageNum,pageSize);
|
}
|
|
/**
|
* 用户自己查看别人分享的数据和分享人
|
*/
|
@GetMapping("/getInfoByShareId")
|
public AjaxResult empowerGetInfo2(){
|
return zfDoctorShareService.listUserId();
|
}
|
/**
|
* 根据userId和shareId收回已经授权给那些人
|
*/
|
@PostMapping("/deleteInfoByUserId")
|
public AjaxResult deleteEmpower(@RequestBody ShareMore zfDoctor){
|
return zfDoctorShareService.deleteZa(zfDoctor);
|
}
|
|
/**
|
* 下载分享的数据
|
*/
|
@PostMapping("/downloadDate")
|
public AjaxResult ifDownLoad(@RequestBody ZfDoctorDownload zfDoctorDownload){
|
return zfDoctorDownloadService.addData(zfDoctorDownload);
|
}
|
|
/**
|
* 展示下载分享的数据
|
*/
|
@GetMapping("/all")
|
public List<ZfDoctor> data(ZfDoctorDownload zfDoctorDownload){
|
Integer pageNum = Convert.toInt(ServletUtils.getParameter(PAGE_NUM), 1);
|
Integer pageSize = Convert.toInt(ServletUtils.getParameter(PAGE_SIZE), 10);
|
List<ZfDoctorDownload> as = zfDoctorDownloadService.selectDoctorList(zfDoctorDownload,pageNum,pageSize);
|
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;
|
}
|
|
}
|