|
|
@@ -0,0 +1,52 @@ |
|
|
|
package com.ningdatech.pmapi.filemanage.manage; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.pmapi.filemanage.model.entity.Documentation; |
|
|
|
import com.ningdatech.pmapi.filemanage.model.param.DocumentationListParam; |
|
|
|
import com.ningdatech.pmapi.filemanage.model.vo.DocumentationVO; |
|
|
|
import com.ningdatech.pmapi.filemanage.service.IDocumentationService; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Classname DocumentationManage |
|
|
|
* @Description |
|
|
|
* @Date 2023/6/6 16:04 |
|
|
|
* @Author PoffyZhang |
|
|
|
*/ |
|
|
|
@Component |
|
|
|
@AllArgsConstructor |
|
|
|
@Slf4j |
|
|
|
public class DocumentationManage { |
|
|
|
|
|
|
|
private final IDocumentationService documentationService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 文档列表 |
|
|
|
* @param param |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public PageVo<DocumentationVO> list(DocumentationListParam param) { |
|
|
|
Page<Documentation> page = param.page(); |
|
|
|
documentationService.page(page, Wrappers.lambdaQuery(Documentation.class) |
|
|
|
.eq(Objects.nonNull(param.getGroupId()), Documentation::getGroupId, param.getGroupId())); |
|
|
|
|
|
|
|
if(0L == page.getTotal()){ |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<DocumentationVO> vos = page.getRecords().stream() |
|
|
|
.map(d -> BeanUtil.copyProperties(d,DocumentationVO.class)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
return PageVo.of(vos,page.getTotal()); |
|
|
|
} |
|
|
|
} |