From f0a74544e0ab2ee3d191a3d46bd82a0274d67b6d Mon Sep 17 00:00:00 2001 From: zqy <2522236926@qq.com> Date: 星期二, 25 六月 2024 20:29:26 +0800 Subject: [PATCH] 配偶过滤掉子孙和同性 --- zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java | 4 +--- zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java | 16 ++++++++++++---- ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java | 31 ++++++++++++++++++++++++++++++- zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java | 6 ++++-- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java index c55d099..c5e2f15 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/zhang/ZInfoUserController.java @@ -20,6 +20,7 @@ import com.ruoyi.service.ZInfoUserService; import com.ruoyi.service.ZfFamilyService; import com.ruoyi.service.ZfRoleService; +import com.ruoyi.system.mapper.SysUserMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -27,6 +28,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.websocket.server.PathParam; +import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -56,6 +58,9 @@ @Resource private ZfRoleService zfRoleService; + + @Resource + private SysUserMapper sysUserMapper; // @GetMapping("/all") // public AjaxResult listAll(ZInfoUser zInfoUser){ @@ -199,7 +204,7 @@ // return zInfoUserService.empower(empowerDto); // } /** - * 鏍规嵁鐢ㄦ埛id鍒ゆ柇鏄惁鏄瓙瀛� + * 鏍规嵁鐢ㄦ埛id鍒ゆ柇鏄惁鏄瓙瀛�(uid:杈堝垎楂樼殑id,tpfid:杈堝垎浣庣殑id) */ @GetMapping("/uidAndUJd/{uid}/{tpfid}") public AjaxResult findByUidAndUid(@PathVariable("uid") Long uid,@PathVariable("tpfid") Long tpfid) @@ -207,6 +212,30 @@ return AjaxResult.success(zInfoUserService.findByuid(uid, tpfid)); } /** + * 鏍规嵁鐢ㄦ埛id鍒ゆ柇鏄惁鏄紓鎬� + */ + + @GetMapping("/sex/{uid}/{tpfid}") + public AjaxResult findBySex(@PathVariable("uid") Long uid,@PathVariable("tpfid") Long tpfid) + { + Integer sex = zInfoUserService.getInfoById(tpfid).getSex(); + //sex == 0 -> 鐢� + if (sex == 1){ + sex = 0; + } + else if (sex == 0){ + sex = 1; + } + List<ZInfoUser> zInfoUsers = zInfoUserService.getDataBySex(sex); + List<String> nickName = new ArrayList<>(); + for (ZInfoUser zInfoUser:zInfoUsers) { + if (!zInfoUserService.findByuid(uid, tpfid)){ + nickName.add(zInfoUser.getNickName()); + } + } + return AjaxResult.success(nickName); + } + /** * 瀹舵牴缃� */ @GetMapping("/root") diff --git a/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java b/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java index 6b00818..88d20d7 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java +++ b/zhang-content/src/main/java/com/ruoyi/service/ZInfoUserService.java @@ -21,9 +21,11 @@ public interface ZInfoUserService extends IService<ZInfoUser> { AjaxResult selectInfoList(ZInfoUser zInfoUser, Integer pageNum, Integer pageSize); - Boolean findByuid(Long uid, Long tfid); + Boolean findByuid(Long uid, Long tfid); - public ZInfoUser getInfoBysysId(Long sysid); + List<ZInfoUser> getDataBySex(Integer sex); + + public ZInfoUser getInfoBysysId(Long sysid); AjaxResult getInfoByfid(Long fid); // AjaxResult updateBySysId() diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java index 314d72a..5900b2c 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZInfoUserServiceImpl.java @@ -72,12 +72,12 @@ return false; // System.out.println(tfid); // System.out.println("00000000000---------------"); - ZInfoUser infu = this.getById(tfid); + ZInfoUser infu = this.getById(getInfoById(tfid)); if(infu==null) return false; - if(infu.getFatherId()!=null && uid==infu.getFatherId()) + if(infu.getFatherId()!=null && uid.equals(infu.getFatherId())) return true; - if(infu.getMomId()!=null && uid==infu.getMomId()) + if(infu.getMomId()!=null && uid.equals(infu.getMomId())) return true; return findByuid(uid, infu.getFatherId()) || findByuid(uid, infu.getMomId()); } @@ -91,6 +91,14 @@ return list.get(0); else return null; + } + + @Override + public List<ZInfoUser> getDataBySex(Integer sex){ + LambdaQueryWrapper<ZInfoUser> lqw = new LambdaQueryWrapper<>(); + lqw.eq(ZInfoUser::getSex, sex); + List<ZInfoUser> list = list(lqw); + return list; } @Override @@ -653,7 +661,7 @@ String roleName = zfRoleService.getById(user.getRoleId()).getName(); user.setRoleName(roleName); - System.out.println("dddddddddddddddddddd"); +// System.out.println("dddddddddddddddddddd"); // System.out.println(familyId); // if(familyId!=null&&familyId!=-1) // { diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java index 76e3fa6..2e9a92c 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/ZfDoctorDownloadServiceImpl.java @@ -31,9 +31,6 @@ ZfDoctorShareService zfDoctorShareService; @Resource - ZfDoctorService zfDoctorService; - - @Resource ZInfoUserService zInfoUserService; @Resource @@ -64,6 +61,7 @@ @Override public AjaxResult addData(ZfDoctorDownload zfDoctorDownload) { + zfDoctorDownload.setDownloadId(getUserId()); LambdaQueryWrapper<ZfDoctorDownload> lqw = uniqueCondition(zfDoctorDownload); List<ZfDoctorDownload> list = list(lqw); if (list.size() > 0) { -- Gitblit v1.9.1