feige
2025-06-23 082ba3d3cd975f182425448bcea3a9166b70980b
zhang-content/src/main/java/com/ruoyi/service/impl/ZSecretServiceImpl.java
@@ -10,8 +10,11 @@
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.domain.ZInfoUser;
import com.ruoyi.domain.ZSecret;
import com.ruoyi.domain.ZfEvent;
import com.ruoyi.mapper.ZSecretMapper;
import com.ruoyi.service.ZInfoUserService;
import com.ruoyi.service.ZSecretService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -23,6 +26,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -38,6 +42,8 @@
    @Autowired
    ZSecretServiceImpl zSecretService;
    @Autowired
    ZInfoUserService zInfoUserService;
    @Resource
    ZSecretMapper zSecretMapper;
@@ -69,7 +75,24 @@
                .orderByDesc(ZSecret::getCreateTime);
        return lqw;
    }
    private LambdaQueryWrapper<ZSecret> buildConditionSec(ZSecret zSecret, List<Long> userIds) {
        LambdaQueryWrapper<ZSecret> lqw = new LambdaQueryWrapper<>();
     //   lqw.eq(userId != null, ZSecret::getUserId, userId)
        lqw.in(ZSecret::getUserId,userIds)
                .like(StringUtils.isNotEmpty(zSecret.getType()), ZSecret::getType, zSecret.getType())
                .like(StringUtils.isNotEmpty(zSecret.getAccNo()), ZSecret::getAccNo, zSecret.getAccNo())
                .like(StringUtils.isNotEmpty(zSecret.getRemark()), ZSecret::getRemark, zSecret.getRemark())
                .like(StringUtils.isNotEmpty(zSecret.getLocation()), ZSecret::getLocation, zSecret.getLocation())
                .eq(zSecret.getIsFinger()!=null,ZSecret::getIsFinger,zSecret.getIsFinger())
                .eq(zSecret.getIsPrivate()!=null,ZSecret::getIsPrivate,zSecret.getIsPrivate())
                .le(zSecret.getValidityDate()!=null, ZSecret::getValidityDate, zSecret.getValidityDate())
                .eq(zSecret.getIsFace()!=null,ZSecret::getIsFace,zSecret.getIsFace())
                .between(zSecret.getHappenStartTime() != null && zSecret.getHappenEndTime() != null, ZSecret::getHappenTime, zSecret.getHappenStartTime(), zSecret.getHappenEndTime())
                .orderByDesc(ZSecret::getCreateTime);
        return lqw;
    }
    /**
     * 分页查找
     */
@@ -77,7 +100,19 @@
    public AjaxResult selectDataList(ZSecret zSecret, Integer pageNum, Integer pageSize) {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        Long userId = user.getUserId();
        LambdaQueryWrapper<ZSecret> lqw = buildCondition(zSecret, userId);
        //根据userId查询到infouser的uaid
        ZInfoUser zInfoUser = zInfoUserService.getInfoBysysId(userId);
        //拿到所有的sysid
        List<Long> fms = zInfoUserService.findByUaidToFaid(zInfoUser.getUaid()).stream().map(ZInfoUser::getSysId).collect(Collectors.toList());
        LambdaQueryWrapper<ZSecret> lqw;
        if(!fms.isEmpty())
            lqw = buildConditionSec(zSecret, fms);
        else
            lqw = buildCondition(zSecret, userId);
        Page<ZSecret> pageBean = new Page<>(pageNum, pageSize);
        Page<ZSecret> pageResult = page(pageBean, lqw);