From 082ba3d3cd975f182425448bcea3a9166b70980b Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期一, 23 六月 2025 20:12:38 +0800 Subject: [PATCH] 修改了个人模块几个模块可以共享数据了 --- zhang-content/src/main/java/com/ruoyi/service/impl/PhyscialServiceImpl.java | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 deletions(-) diff --git a/zhang-content/src/main/java/com/ruoyi/service/impl/PhyscialServiceImpl.java b/zhang-content/src/main/java/com/ruoyi/service/impl/PhyscialServiceImpl.java index 51d6c68..a45550a 100644 --- a/zhang-content/src/main/java/com/ruoyi/service/impl/PhyscialServiceImpl.java +++ b/zhang-content/src/main/java/com/ruoyi/service/impl/PhyscialServiceImpl.java @@ -10,8 +10,11 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.domain.Physcial; +import com.ruoyi.domain.ZInfoUser; +import com.ruoyi.domain.ZYearInfo; import com.ruoyi.mapper.PhyscialMapper; import com.ruoyi.service.PhyscialService; +import com.ruoyi.service.ZInfoUserService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -22,6 +25,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.stream.Collectors; /** * <p> @@ -36,7 +40,8 @@ public class PhyscialServiceImpl extends ServiceImpl<PhyscialMapper, Physcial> implements PhyscialService { @Autowired PhyscialServiceImpl physcialService; - + @Autowired + ZInfoUserService zInfoUserService; private LambdaQueryWrapper<Physcial> uniqueCondition(Physcial physcial) { LambdaQueryWrapper<Physcial> lqw = new LambdaQueryWrapper<>(); lqw.eq(StringUtils.isNotEmpty(physcial.getReport()), Physcial::getReport, physcial.getReport()) @@ -53,7 +58,14 @@ .orderByDesc(Physcial::getCreateTime); return lqw; } - + private LambdaQueryWrapper<Physcial> buildConditionSec(Physcial physcial, List<Long> userId) { + LambdaQueryWrapper<Physcial> lqw = new LambdaQueryWrapper<>(); + lqw.in(Physcial::getUid, userId) + .like(StringUtils.isNotEmpty(physcial.getReport()), Physcial::getReport, physcial.getReport()) + .between(physcial.getHappenStartTime() != null && physcial.getHappenEndTime() != null, Physcial::getHappenTime, physcial.getHappenStartTime(), physcial.getHappenEndTime()) + .orderByDesc(Physcial::getCreateTime); + return lqw; + } /** * 鍒嗛〉鏌ユ壘 */ @@ -61,8 +73,15 @@ public AjaxResult selectDataList(Physcial physcial, Integer pageNum, Integer pageSize) { SysUser user = SecurityUtils.getLoginUser().getUser(); Long userId = user.getUserId(); - LambdaQueryWrapper<Physcial> lqw = buildCondition(physcial, userId); - + //鏍规嵁userId鏌ヨ鍒癷nfouser鐨剈aid + ZInfoUser zInfoUser = zInfoUserService.getInfoBysysId(userId); + //鎷垮埌鎵�鏈夌殑sysid + List<Long> fms = zInfoUserService.findByUaidToFaid(zInfoUser.getUaid()).stream().map(ZInfoUser::getSysId).collect(Collectors.toList()); + LambdaQueryWrapper<Physcial> lqw; + if(!fms.isEmpty()) + lqw = buildConditionSec(physcial, fms); + else + lqw = buildCondition(physcial, userId); Page<Physcial> pageBean = new Page<>(pageNum, pageSize); Page<Physcial> pageResult = page(pageBean, lqw); -- Gitblit v1.9.1