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

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 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 java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -75,14 +76,24 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
@Override
public TableDataInfo<SysOssTextbookVo> queryAwaitPageList(SysOssTextbookBo bo, PageQuery pageQuery) {
QueryWrapper<SysOssTextbook> wrapper = Wrappers.query();
wrapper.le("ot.status", 0)
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix())
.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");
Page<SysOssTextbookVo> result = baseMapper.selectPageAwaitList(pageQuery.build(), wrapper);
return TableDataInfo.build(result);
}
/**
* 查询符合条件的请填写功能名称列表
*
@ -101,12 +112,13 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix())
.like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName())
.and(ObjectUtil.isNotNull(bo.getCatalogId()), 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);
Integer format = bo.getFormatSuffix();
List<String> list = processFormatSuffixQuery(format);
if (7 == format) {
w.notIn("ot.file_suffix", list);
} else {
w.in("ot.file_suffix", list);
}
});
String orderByColumn = bo.getOrderByColumn();
if (StringUtils.isNotEmpty(orderByColumn)) {
@ -266,4 +278,60 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
ossService.preview(ossTextbook.getOssId(), response);
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,
CONCAT(file_path, '/', file_name) as name
from sys_oss_resource
<where>
where status = 1
<if test="tenantId != null and tenantId != ''">
and tenant_id = #{tenantId}
</if>
</where>
union all
select download_num as value,
CONCAT(file_path, '/', file_name) as name
from sys_oss_textbook
<where>
where status = 1
<if test="tenantId != null and tenantId != ''">
and tenant_id = #{tenantId}
</if>
</where>
) t
order by t.value desc
limit 10