首页统计去除删除数据;门户资源添加格式查询

This commit is contained in:
cjw 2024-06-27 10:00:06 +08:00
parent 516a6aa641
commit 5a1c3a7c14
3 changed files with 88 additions and 16 deletions

View File

@ -51,5 +51,11 @@ public class SysOssTextbookBo extends BaseEntity {
private String orderByColumn; private String orderByColumn;
private String isAsc; private String isAsc;
/**
* 格式后缀门户查询使用
* 1PPT 2WORD 3PDF 4图片 5音频 6视频 7其他
*/
private Integer formatSuffix;
} }

View File

@ -28,6 +28,7 @@ import org.dromara.system.service.ISysOssTextbookService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@ -75,14 +76,24 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
@Override @Override
public TableDataInfo<SysOssTextbookVo> queryAwaitPageList(SysOssTextbookBo bo, PageQuery pageQuery) { public TableDataInfo<SysOssTextbookVo> queryAwaitPageList(SysOssTextbookBo bo, PageQuery pageQuery) {
QueryWrapper<SysOssTextbook> wrapper = Wrappers.query(); QueryWrapper<SysOssTextbook> wrapper = Wrappers.query();
wrapper.le("ot.status", 0) wrapper.le("ot.status", 0)
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix()) .eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix())
.like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName()) .like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName())
.and(ObjectUtil.isNotNull(bo.getFormatSuffix()), w -> {
List<SysCatalogTextbook> list = catalogService.selectList(new LambdaQueryWrapper<SysCatalogTextbook>()
.select(SysCatalogTextbook::getCatalogId)
.apply(DataBaseHelper.findInSet(bo.getCatalogId(), "ancestors")));
List<Long> ids = StreamUtils.toList(list, SysCatalogTextbook::getCatalogId);
ids.add(bo.getCatalogId());
w.in("ot.catalog_id", ids);
})
.orderByDesc("ot.create_time"); .orderByDesc("ot.create_time");
Page<SysOssTextbookVo> result = baseMapper.selectPageAwaitList(pageQuery.build(), wrapper); Page<SysOssTextbookVo> result = baseMapper.selectPageAwaitList(pageQuery.build(), wrapper);
return TableDataInfo.build(result); return TableDataInfo.build(result);
} }
/** /**
* 查询符合条件的请填写功能名称列表 * 查询符合条件的请填写功能名称列表
* *
@ -101,12 +112,13 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix()) .eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix())
.like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName()) .like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName())
.and(ObjectUtil.isNotNull(bo.getCatalogId()), w -> { .and(ObjectUtil.isNotNull(bo.getCatalogId()), w -> {
List<SysCatalogTextbook> list = catalogService.selectList(new LambdaQueryWrapper<SysCatalogTextbook>() Integer format = bo.getFormatSuffix();
.select(SysCatalogTextbook::getCatalogId) List<String> list = processFormatSuffixQuery(format);
.apply(DataBaseHelper.findInSet(bo.getCatalogId(), "ancestors"))); if (7 == format) {
List<Long> ids = StreamUtils.toList(list, SysCatalogTextbook::getCatalogId); w.notIn("ot.file_suffix", list);
ids.add(bo.getCatalogId()); } else {
w.in("ot.catalog_id", ids); w.in("ot.file_suffix", list);
}
}); });
String orderByColumn = bo.getOrderByColumn(); String orderByColumn = bo.getOrderByColumn();
if (StringUtils.isNotEmpty(orderByColumn)) { if (StringUtils.isNotEmpty(orderByColumn)) {
@ -266,4 +278,60 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
ossService.preview(ossTextbook.getOssId(), response); ossService.preview(ossTextbook.getOssId(), response);
baseMapper.addPreviewNum(id); baseMapper.addPreviewNum(id);
} }
private List<String> processFormatSuffixQuery(int format) {
List<String> list = new ArrayList<>(18);
switch (format) {
case 1 -> {
list.add(".ppt");
list.add(".pptx");
}
case 2 -> {
list.add(".doc");
list.add(".docx");
}
case 3 -> list.add(".pdf");
case 4 -> {
list.add(".jpg");
list.add(".png");
list.add(".jpeg");
list.add(".gif");
list.add(".bmp");
}
case 5 -> {
list.add(".mp3");
list.add(".wma");
}
case 6 -> {
list.add(".mp4");
list.add(".mov");
list.add(".wmv");
list.add(".flv");
list.add(".avi");
list.add(".mkv");
}
case 7 -> {
list.add(".ppt");
list.add(".pptx");
list.add(".doc");
list.add(".docx");
list.add(".pdf");
list.add(".jpg");
list.add(".png");
list.add(".jpeg");
list.add(".gif");
list.add(".bmp");
list.add(".mp3");
list.add(".wma");
list.add(".mp4");
list.add(".mov");
list.add(".wmv");
list.add(".flv");
list.add(".avi");
list.add(".mkv");
}
}
return list;
}
} }

View File

@ -57,20 +57,18 @@
from (select download_num as value, from (select download_num as value,
CONCAT(file_path, '/', file_name) as name CONCAT(file_path, '/', file_name) as name
from sys_oss_resource from sys_oss_resource
<where> where status = 1
<if test="tenantId != null and tenantId != ''"> <if test="tenantId != null and tenantId != ''">
and tenant_id = #{tenantId} and tenant_id = #{tenantId}
</if> </if>
</where>
union all union all
select download_num as value, select download_num as value,
CONCAT(file_path, '/', file_name) as name CONCAT(file_path, '/', file_name) as name
from sys_oss_textbook from sys_oss_textbook
<where> where status = 1
<if test="tenantId != null and tenantId != ''"> <if test="tenantId != null and tenantId != ''">
and tenant_id = #{tenantId} and tenant_id = #{tenantId}
</if> </if>
</where>
) t ) t
order by t.value desc order by t.value desc
limit 10 limit 10