This commit is contained in:
ls
2024-11-18 23:07:30 +08:00
parent 3a34ee483a
commit c349ac4c4d
6 changed files with 34 additions and 8 deletions

View File

@@ -230,7 +230,7 @@ jeecg:
#webapp文件路径
webapp: /opt/webapp
shiro:
excludeUrls: /database/experimentDoc/**,/sys/common/upload,/sys/common/download,/sys/user/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
excludeUrls: /library/documentLibrary/home,/database/experimentDoc/**,/sys/common/upload,/sys/common/download,/sys/user/**,/test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置
oss:
accessKey: ??

View File

@@ -61,6 +61,7 @@ public class DocumentLibraryController extends JeecgController<DocumentLibrary,
home.setRecently(documentVisitHistoryService.getRecently(userByName.getId()));
home.setTotal(documentLibraryService.getTotal());
home.setToday(documentLibraryService.getToday());
home.setCategory(documentLibraryService.getCategory());
return Result.OK(home);
}

View File

@@ -10,6 +10,7 @@ import lombok.Setter;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @author lise
@@ -21,13 +22,16 @@ public class DocumentHome implements Serializable {
private static final long serialVersionUID = 1L;
@Schema(description = "我的收藏")
private List<DocumentFavorites> favorite;
private List<DocumentFavorites> favorite;
@Schema(description = "最新文档")
private List<DocumentLibrary> latest;
private List<DocumentLibrary> latest;
@Schema(description = "最近访问")
private List<DocumentLibrary> recently;
private List<DocumentLibrary> recently;
@Schema(description = "文档总计")
private Long total;
private Long total;
@Schema(description = "今日新增")
private Long today;
private Long today;
@Schema(description = "分类文档")
private Map<String, List<DocumentLibrary>> category;
}

View File

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.database.entity.DocumentLibrary;
import java.util.List;
import java.util.Map;
/**
* @Description: 知识库
@@ -18,4 +19,7 @@ public interface IDocumentLibraryService extends IService<DocumentLibrary> {
Long getTotal();
Long getToday();
Map<String, List<DocumentLibrary>> getCategory();
}

View File

@@ -28,6 +28,7 @@ public class DocumentFavoritesServiceImpl extends ServiceImpl<DocumentFavoritesM
public List<DocumentFavorites> getTopFavoritesByUserId(String userId) {
LambdaQueryWrapper<DocumentFavorites> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DocumentFavorites::getUserId, userId);
queryWrapper.orderByDesc(DocumentFavorites::getCreateTime);
Page<DocumentFavorites> page = new Page<>(1, 10);
List<DocumentFavorites> list = list(page, queryWrapper);
return list;

View File

@@ -10,8 +10,7 @@ import org.jeecg.modules.database.mapper.DocumentLibraryMapper;
import org.jeecg.modules.database.service.IDocumentLibraryService;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* @Description: 知识库
@@ -42,4 +41,21 @@ public class DocumentLibraryServiceImpl extends ServiceImpl<DocumentLibraryMappe
DateUtils.formatDate(new Date(), "yyyy-MM-dd"));
return count(queryWrapper);
}
@Override
public Map<String, List<DocumentLibrary>> getCategory() {
LambdaQueryWrapper<DocumentLibrary> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.isNull(DocumentLibrary::getParentId);
queryWrapper.eq(DocumentLibrary::getType, "FOLDER");
List<DocumentLibrary> folderList = list(queryWrapper);
Map<String, List<DocumentLibrary>> map = new HashMap<>();
folderList.forEach(folder -> {
LambdaQueryWrapper<DocumentLibrary> queryWrapper1 = new LambdaQueryWrapper<>();
queryWrapper1.eq(DocumentLibrary::getParentId, folder.getId());
queryWrapper1.eq(DocumentLibrary::getType, "DOCUMENT");
queryWrapper1.orderByDesc(DocumentLibrary::getCreateTime);
map.put(folder.getTitle(), list(queryWrapper1));
});
return map;
}
}