树形接口优化;资源目录添加类型以便区分
This commit is contained in:
parent
c71757101b
commit
3d1c9bc618
|
@ -1,7 +1,9 @@
|
|||
package org.dromara.system.controller.portal;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
@ -11,6 +13,7 @@ import org.dromara.system.domain.bo.*;
|
|||
import org.dromara.system.domain.vo.*;
|
||||
import org.dromara.system.service.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
@ -58,6 +61,17 @@ public class PortalController extends BaseController {
|
|||
public TableDataInfo<SysHomeShowVo> showList(SysHomeShowBo bo, PageQuery pageQuery) {
|
||||
return sysHomeShowService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
/**
|
||||
* 获取学校名师详细信息
|
||||
*
|
||||
* @param showId 主键
|
||||
*/
|
||||
@SaCheckPermission("home:show:query")
|
||||
@GetMapping("/show/{showId}")
|
||||
public R<SysHomeShowVo> getShowInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long showId) {
|
||||
return R.ok(sysHomeShowService.queryById(showId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询学校动态列表
|
||||
|
@ -67,6 +81,17 @@ public class PortalController extends BaseController {
|
|||
public TableDataInfo<SysHomeTrendVo> trendList(SysHomeTrendBo bo, PageQuery pageQuery) {
|
||||
return sysHomeTrendService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
/**
|
||||
* 获取学校动态详细信息
|
||||
*
|
||||
* @param trendId 主键
|
||||
*/
|
||||
@SaIgnore
|
||||
@GetMapping("/trend/{trendId}")
|
||||
public R<SysHomeTrendVo> getTrendInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long trendId) {
|
||||
return R.ok(sysHomeTrendService.queryById(trendId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -93,8 +118,8 @@ public class PortalController extends BaseController {
|
|||
*/
|
||||
@SaIgnore
|
||||
@GetMapping("/textbook/catalog/list")
|
||||
public R<List<Tree<Long>>> list() {
|
||||
List<Tree<Long>> trees = textbookService.buildTreeSelect();
|
||||
public R<List<Tree<Long>>> list(SysCatalogTextbookBo bo) {
|
||||
List<Tree<Long>> trees = textbookService.buildTreeSelect(bo);
|
||||
return R.ok(trees);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,11 @@ public class SysCatalogResource extends TenantEntity {
|
|||
*/
|
||||
private Long orderNum;
|
||||
|
||||
/**
|
||||
* 1主目录,2资源,3目录
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 封面
|
||||
*/
|
||||
|
|
|
@ -47,6 +47,11 @@ public class SysCatalogResourceBo extends BaseEntity {
|
|||
*/
|
||||
private Long orderNum;
|
||||
|
||||
/**
|
||||
* 1主目录,2资源,3目录
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 封面
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,6 @@ public class SysCatalogTextbookBo extends BaseEntity {
|
|||
/**
|
||||
* 1暂定,2学段,3年级,4学科,5版本,6教材,7目录
|
||||
*/
|
||||
@NotNull(message = "1暂定,2学段,3年级,4学科,5版本,6教材,7目录不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Integer type;
|
||||
|
||||
|
||||
|
|
|
@ -24,37 +24,36 @@ public class SysCatalogResourceVo implements Serializable {
|
|||
/**
|
||||
* 目录id
|
||||
*/
|
||||
//@ExcelProperty(value = "目录id")
|
||||
private Long catalogId;
|
||||
|
||||
/**
|
||||
* 父目录id
|
||||
*/
|
||||
//@ExcelProperty(value = "父目录id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 祖级列表
|
||||
*/
|
||||
//@ExcelProperty(value = "祖级列表")
|
||||
private String ancestors;
|
||||
|
||||
/**
|
||||
* 目录名称
|
||||
*/
|
||||
//@ExcelProperty(value = "目录名称")
|
||||
private String catalogName;
|
||||
|
||||
/**
|
||||
* 显示顺序
|
||||
*/
|
||||
//@ExcelProperty(value = "显示顺序")
|
||||
private Long orderNum;
|
||||
|
||||
/**
|
||||
* 1主目录,2资源,3目录
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 封面
|
||||
*/
|
||||
//@ExcelProperty(value = "封面")
|
||||
private Long cover;
|
||||
/**
|
||||
* 资源数量
|
||||
|
|
|
@ -53,7 +53,7 @@ public class SysCatalogTextbookVo implements Serializable {
|
|||
private Long orderNum;
|
||||
|
||||
/**
|
||||
* 1暂定,2学段,3年级,4学科,5版本,6教材,7目录
|
||||
* 1主目录,2学段,3年级,4学科,5版本,6教材,7目录
|
||||
*/
|
||||
//@ExcelProperty(value = "1暂定,2学段,3年级,4学科,5版本,6教材,7目录")
|
||||
private Integer type;
|
||||
|
|
|
@ -119,5 +119,5 @@ public interface ISysCatalogTextbookService {
|
|||
*/
|
||||
//List<Tree<Long>> buildCatalogTreeSelect(List<SysCatalogTextbookVo> catalogs);
|
||||
|
||||
List<Tree<Long>> buildTreeSelect();
|
||||
List<Tree<Long>> buildTreeSelect(SysCatalogTextbookBo bo);
|
||||
}
|
||||
|
|
|
@ -96,6 +96,12 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
|
|||
SysCatalogResource info = baseMapper.selectById(bo.getParentId());
|
||||
SysCatalogResource add = MapstructUtils.convert(bo, SysCatalogResource.class);
|
||||
add.setAncestors(info.getAncestors() + StringUtils.SEPARATOR + add.getParentId());
|
||||
String[] split = StringUtils.split(add.getAncestors(), StringUtils.SEPARATOR);
|
||||
if (split.length < 3) {
|
||||
add.setType(split.length);
|
||||
} else {
|
||||
add.setType(3);
|
||||
}
|
||||
return baseMapper.insert(add) > 0;
|
||||
}
|
||||
|
||||
|
@ -159,6 +165,7 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
|
|||
return ossResourceMapper.exists(new LambdaQueryWrapper<SysOssResource>()
|
||||
.eq(SysOssResource::getCatalogId, catalogId));
|
||||
}
|
||||
|
||||
@Cacheable(cacheNames = CacheNames.SYS_CATALOG_RESOURCE, key = "#catalogId")
|
||||
@Override
|
||||
public SysCatalogResourceVo selectCatalogById(Long catalogId) {
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.dromara.common.redis.utils.CacheUtils;
|
|||
import org.dromara.system.domain.SysCatalogTextbook;
|
||||
import org.dromara.system.domain.SysOssTextbook;
|
||||
import org.dromara.system.domain.bo.SysCatalogTextbookBo;
|
||||
import org.dromara.system.domain.bo.SysOssResourceBo;
|
||||
import org.dromara.system.domain.vo.SysCatalogTextbookVo;
|
||||
import org.dromara.system.mapper.SysCatalogTextbookMapper;
|
||||
import org.dromara.system.mapper.SysOssTextbookMapper;
|
||||
|
@ -197,9 +198,7 @@ public class SysCatalogTextbookServiceImpl implements ISysCatalogTextbookService
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<Tree<Long>> buildTreeSelect() {
|
||||
SysCatalogTextbookBo bo = new SysCatalogTextbookBo();
|
||||
bo.setType(4);
|
||||
public List<Tree<Long>> buildTreeSelect(SysCatalogTextbookBo bo) {
|
||||
LambdaQueryWrapper<SysCatalogTextbook> lqw = buildQueryWrapper(bo);
|
||||
List<SysCatalogTextbookVo> voList = baseMapper.selectVoList(lqw);
|
||||
return buildCatalogTreeSelect(voList);
|
||||
|
|
Loading…
Reference in New Issue