| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.system.model.TErpGoodsType; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.mapper.TSysEducationalInfoMapper; |
| | | import com.ruoyi.system.query.TSysEducationalInfoQuery; |
| | | import com.ruoyi.system.service.TSysEducationalInfoService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.vo.TSysEducationalInfoVO; |
| | | import com.ruoyi.system.vo.TSysProductIntroductionVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TSysEducationalInfoServiceImpl extends ServiceImpl<TSysEducationalInfoMapper, TSysEducationalInfo> implements TSysEducationalInfoService { |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | @Override |
| | | public PageInfo<TSysEducationalInfo> pageList(TSysEducationalInfoQuery query) { |
| | | PageInfo<TSysEducationalInfo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysEducationalInfo> list = this.baseMapper.pageList(query,pageInfo); |
| | | public PageInfo<TSysEducationalInfoVO> pageList(TSysEducationalInfoQuery query) { |
| | | PageInfo<TSysEducationalInfoVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysEducationalInfoVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if (CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | if(query.getRoleType() == 5){ |
| | | Long userId = query.getUserId(); |
| | | for (TSysEducationalInfoVO sysEducationalInfoVO : list) { |
| | | Set<Long> cacheSet = redisCache.getCacheSet(Constants.SYS_EDUCATION_CLICK_COUNT + sysEducationalInfoVO.getId()); |
| | | if(cacheSet.contains(userId)){ |
| | | sysEducationalInfoVO.setIsView(true); |
| | | } |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |