Compare commits
No commits in common. "5a3874a748ce973576ca5f63c3b818ff3da8d4df" and "5f0c7ce8615ebd1342cc66cc825a6b7cd89a70ff" have entirely different histories.
5a3874a748
...
5f0c7ce861
|
|
@ -2,8 +2,6 @@ package com.electromagnetic.industry.software.manage.pojo.req;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FileInfoQueryDTO {
|
public class FileInfoQueryDTO {
|
||||||
|
|
||||||
|
|
@ -67,9 +65,4 @@ public class FileInfoQueryDTO {
|
||||||
* 状态(0-未发布 1-已发布 2-占用)
|
* 状态(0-未发布 1-已发布 2-占用)
|
||||||
*/
|
*/
|
||||||
private Integer dataStatus;
|
private Integer dataStatus;
|
||||||
|
|
||||||
/**
|
|
||||||
* 标签查询ID列表
|
|
||||||
*/
|
|
||||||
private List<String> tagIds;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.electromagnetic.industry.software.manage.service;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.electromagnetic.industry.software.common.pojo.TreeNode;
|
import com.electromagnetic.industry.software.common.pojo.TreeNode;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileTagInfo;
|
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.TagListVO;
|
import com.electromagnetic.industry.software.manage.pojo.resp.TagListVO;
|
||||||
|
|
||||||
import javax.swing.text.html.HTML;
|
import javax.swing.text.html.HTML;
|
||||||
|
|
@ -70,5 +69,5 @@ public interface EdTagLibraryService extends IService<EdTagLibrary> {
|
||||||
* 获取所有标签
|
* 获取所有标签
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<FileTagInfo> listAllTags();
|
List<EdTagLibrary> listAllTags();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,4 @@ public interface FileTagRelationService extends IService<FileTagRelation> {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<FileTagInfo> getFileTags (String fileId);
|
List<FileTagInfo> getFileTags (String fileId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据标签id获取文件id
|
|
||||||
* @param tagIds
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
List<String> getFileIdsByTagIds(List<String> tagIds);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
throw new PermissionDeniedException();
|
throw new PermissionDeniedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
LambdaQueryWrapper<EdFileInfo> queryWrapper = Wrappers.lambdaQuery(EdFileInfo.class)
|
||||||
.select(EdFileInfo.class, file -> !file.getColumn().equals("file_content"))
|
.select(EdFileInfo.class, file -> !file.getColumn().equals("file_content"))
|
||||||
.eq(EdFileInfo::getSaveStatus, EleDataSaveStatusEnum.SUCCESS.code)
|
.eq(EdFileInfo::getSaveStatus, EleDataSaveStatusEnum.SUCCESS.code)
|
||||||
|
|
@ -141,16 +142,6 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
.or()
|
.or()
|
||||||
.like(EdFileInfo::getFileContent, pars.getKeyword()));
|
.like(EdFileInfo::getFileContent, pars.getKeyword()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理 tagIds 查询
|
|
||||||
if (!pars.getTagIds().isEmpty()) {
|
|
||||||
List<String> fileIdsWithTags = fileTagRelationService.getFileIdsByTagIds(pars.getTagIds());
|
|
||||||
if (fileIdsWithTags.isEmpty()) {
|
|
||||||
return ElectromagneticResultUtil.success(new RespPageVO<>(0, new ArrayList<>()));
|
|
||||||
}
|
|
||||||
queryWrapper.in(EdFileInfo::getId, fileIdsWithTags);
|
|
||||||
}
|
|
||||||
|
|
||||||
Page<EdFileInfo> edFileInfoPage = this.baseMapper.selectPage(new Page<>(pars.getPageNum(), pars.getPageSize()), queryWrapper);
|
Page<EdFileInfo> edFileInfoPage = this.baseMapper.selectPage(new Page<>(pars.getPageNum(), pars.getPageSize()), queryWrapper);
|
||||||
long total = edFileInfoPage.getTotal();
|
long total = edFileInfoPage.getTotal();
|
||||||
List<FileInfoVO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileInfoVO.class);
|
List<FileInfoVO> records = BeanUtil.copyToList(edFileInfoPage.getRecords(), FileInfoVO.class);
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import com.electromagnetic.industry.software.common.util.IdWorker;
|
||||||
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
import com.electromagnetic.industry.software.common.util.UserThreadLocal;
|
||||||
import com.electromagnetic.industry.software.manage.mapper.EdTagLibraryMapper;
|
import com.electromagnetic.industry.software.manage.mapper.EdTagLibraryMapper;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
import com.electromagnetic.industry.software.manage.pojo.models.EdTagLibrary;
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.FileTagInfo;
|
|
||||||
import com.electromagnetic.industry.software.manage.pojo.resp.TagListVO;
|
import com.electromagnetic.industry.software.manage.pojo.resp.TagListVO;
|
||||||
import com.electromagnetic.industry.software.manage.service.EdTagLibraryService;
|
import com.electromagnetic.industry.software.manage.service.EdTagLibraryService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
@ -307,16 +306,11 @@ public class EdTagLibraryServiceImpl extends ServiceImpl<EdTagLibraryMapper, EdT
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<FileTagInfo> listAllTags() {
|
public List<EdTagLibrary> listAllTags() {
|
||||||
LambdaQueryWrapper<EdTagLibrary> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<EdTagLibrary> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
queryWrapper.eq(EdTagLibrary::getIsPublished, PublishEnum.PUBLISHED.getCode())
|
queryWrapper.eq(EdTagLibrary::getIsPublished, PublishEnum.PUBLISHED.getCode())
|
||||||
.eq(EdTagLibrary::getType, TagTypeEnum.TAG.getCode());
|
.eq(EdTagLibrary::getType, TagTypeEnum.TAG.getCode());
|
||||||
return this.list(queryWrapper).stream()
|
return this.list(queryWrapper);
|
||||||
.map(tag -> {
|
|
||||||
FileTagInfo info = new FileTagInfo();
|
|
||||||
BeanUtils.copyProperties(tag, info);
|
|
||||||
return info;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class FileTagRelationServiceImpl extends ServiceImpl<FileTagRelationMapper, FileTagRelation> implements FileTagRelationService {
|
public class FileTagRelationServiceImpl extends ServiceImpl<FileTagRelationMapper, FileTagRelation> implements FileTagRelationService {
|
||||||
|
|
@ -85,20 +84,4 @@ public class FileTagRelationServiceImpl extends ServiceImpl<FileTagRelationMappe
|
||||||
UserThreadLocal.setSuccessInfo("", "", "获取了标签数据");
|
UserThreadLocal.setSuccessInfo("", "", "获取了标签数据");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据 tagIds 获取文件 ID 列表
|
|
||||||
* @param tagIds
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<String> getFileIdsByTagIds(List<String> tagIds) {
|
|
||||||
LambdaQueryWrapper<FileTagRelation> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.in(FileTagRelation::getTagId, tagIds);
|
|
||||||
List<FileTagRelation> relations = this.list(queryWrapper);
|
|
||||||
return relations.stream()
|
|
||||||
.map(FileTagRelation::getFileId)
|
|
||||||
.distinct()
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue