| | |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.domain.ZHonor; |
| | | import com.ruoyi.domain.ZIdea; |
| | | import com.ruoyi.domain.ZInfoUser; |
| | | import com.ruoyi.mapper.ZIdeaMapper; |
| | | import com.ruoyi.service.ZIdeaService; |
| | | import com.ruoyi.service.ZInfoUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import java.util.Arrays; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired |
| | | ZIdeaServiceImpl zIdeaService; |
| | | |
| | | @Autowired |
| | | ZInfoUserService zInfoUserService; |
| | | private LambdaQueryWrapper<ZIdea> uniqueCondition(ZIdea zIdea) { |
| | | LambdaQueryWrapper<ZIdea> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.eq(StringUtils.isNotEmpty(zIdea.getTitle()), ZIdea::getTitle, zIdea.getTitle()) |
| | |
| | | .orderByDesc(ZIdea::getCreateTime); |
| | | return lqw; |
| | | } |
| | | |
| | | private LambdaQueryWrapper<ZIdea> buildConditionSec(ZIdea zIdea, List<Long> userIds){ |
| | | LambdaQueryWrapper<ZIdea> lqw = new LambdaQueryWrapper<>(); |
| | | lqw.in(ZIdea::getUid, userIds) |
| | | .like(StringUtils.isNotEmpty(zIdea.getTitle()), ZIdea::getTitle, zIdea.getTitle()) |
| | | .like(StringUtils.isNotEmpty(zIdea.getBeneficiary()), ZIdea::getBeneficiary, zIdea.getBeneficiary()) |
| | | .like(StringUtils.isNotEmpty(zIdea.getHeir()), ZIdea::getHeir, zIdea.getHeir()) |
| | | .like(StringUtils.isNotEmpty(zIdea.getDifficulty()), ZIdea::getDifficulty, zIdea.getDifficulty()) |
| | | .like(StringUtils.isNotEmpty(zIdea.getCause()), ZIdea::getCause, zIdea.getCause()) |
| | | .like(zIdea.getIsEffective()!=null, ZIdea::getIsEffective, zIdea.getIsEffective()) |
| | | .between(zIdea.getHappenStartTime() != null && zIdea.getHappenEndTime() != null, ZIdea::getHappenTime, zIdea.getHappenStartTime(), zIdea.getHappenEndTime()) |
| | | .orderByDesc(ZIdea::getCreateTime); |
| | | return lqw; |
| | | } |
| | | /** |
| | | * 分页查找 |
| | | */ |
| | |
| | | public AjaxResult selectDataList(ZIdea zIdea, Integer pageNum, Integer pageSize) { |
| | | SysUser user = SecurityUtils.getLoginUser().getUser(); |
| | | Long userId = user.getUserId(); |
| | | LambdaQueryWrapper<ZIdea> lqw = buildCondition(zIdea, userId); |
| | | |
| | | // LambdaQueryWrapper<ZIdea> lqw = buildCondition(zIdea, 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<ZIdea> lqw; |
| | | if(!fms.isEmpty()) |
| | | lqw = buildConditionSec(zIdea, fms); |
| | | else |
| | | lqw = buildCondition(zIdea, userId); |
| | | Page<ZIdea> pageBean = new Page<>(pageNum, pageSize); |
| | | Page<ZIdea> pageResult = page(pageBean, lqw); |
| | | |