package com.ruoyi.system.service.impl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.ruoyi.common.basic.PageInfo;
|
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.core.redis.RedisCache;
|
import com.ruoyi.system.mapper.TSysProductIntroductionMapper;
|
import com.ruoyi.system.model.TSysEducationalInfo;
|
import com.ruoyi.system.model.TSysProductIntroduction;
|
import com.ruoyi.system.query.TSysProductIntroductionQuery;
|
import com.ruoyi.system.service.TSysProductIntroductionService;
|
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>
|
* 产品介绍 服务实现类
|
* </p>
|
*
|
* @author xiaochen
|
* @since 2025-08-20
|
*/
|
@Service
|
public class TSysProductIntroductionServiceImpl extends ServiceImpl<TSysProductIntroductionMapper, TSysProductIntroduction> implements TSysProductIntroductionService {
|
|
@Autowired
|
private RedisCache redisCache;
|
|
@Override
|
public PageInfo<TSysProductIntroductionVO> pageList(TSysProductIntroductionQuery query) {
|
PageInfo<TSysProductIntroductionVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
|
List<TSysProductIntroductionVO> list = this.baseMapper.pageList(query,pageInfo);
|
if (CollectionUtils.isEmpty(list)){
|
return pageInfo;
|
}
|
if(query.getRoleType() == 5){
|
Long userId = query.getUserId();
|
for (TSysProductIntroductionVO tSysProductIntroduction : list) {
|
Set<Long> cacheSet = redisCache.getCacheSet(Constants.SYS_PRODUCT_CLICK_COUNT + tSysProductIntroduction.getId());
|
if(cacheSet.contains(userId)){
|
tSysProductIntroduction.setIsView(true);
|
}
|
}
|
}
|
pageInfo.setRecords(list);
|
return pageInfo;
|
}
|
@Override
|
public PageInfo<TSysProductIntroduction> pageListApp(TSysProductIntroductionQuery query) {
|
PageInfo<TSysProductIntroduction> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
|
List<TSysProductIntroduction> list = this.baseMapper.pageListApp(query,pageInfo);
|
pageInfo.setRecords(list);
|
return pageInfo;
|
}
|
}
|