Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
096ad6bf
Commit
096ad6bf
authored
Dec 29, 2021
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.我的文件文件夹或共享空间列表接口
parent
f319827f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueService.java
+1
-1
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueServiceImpl.java
+34
-2
No files found.
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueService.java
View file @
096ad6bf
...
...
@@ -14,7 +14,7 @@ public interface DiskCatalogueService {
/**
* 文件文件夹或共享空间列表
* @param orgId
* @param
U
serId
* @param
u
serId
* @param type
* @return
*/
...
...
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueServiceImpl.java
View file @
096ad6bf
package
cn
.
timer
.
api
.
controller
.
disk
.
sevice
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogueFiles
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
...
...
@@ -17,8 +20,12 @@ import java.util.stream.Collectors;
*/
@Service
public
class
DiskCatalogueServiceImpl
implements
DiskCatalogueService
{
//所有文件夹
private
static
List
<
DiskCatalogue
>
treeList
=
new
ArrayList
<>();
//所有文件
private
static
List
<
DiskFiles
>
filesList
=
new
ArrayList
<>();
//所有文件夹ID
private
static
Map
<
Integer
,
List
<
DiskCatalogueFiles
>>
map
=
new
HashMap
<
Integer
,
List
<
DiskCatalogueFiles
>>();
@Override
public
List
<
DiskCatalogue
>
getDiskCatalogueList
(
Integer
orgId
,
Integer
userId
,
Integer
type
)
{
...
...
@@ -26,7 +33,25 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
.
lambda
().
eq
(
DiskCatalogue:
:
getOrgId
,
orgId
)
.
eq
(
DiskCatalogue:
:
getCreateUserId
,
userId
)
.
eq
(
DiskCatalogue:
:
getType
,
type
)
.
eq
(
DiskCatalogue:
:
getDeleteFlag
,
0
)
);
if
(
treeList
.
size
()
==
0
)
{
return
treeList
;
}
filesList
=
DiskFiles
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskFiles
>()
.
lambda
().
eq
(
DiskFiles:
:
getCreateUserId
,
userId
)
.
eq
(
DiskFiles:
:
getDeleteFlag
,
0
)
);
List
<
DiskCatalogueFiles
>
diskCatalogueFilesList
=
DiskCatalogueFiles
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogueFiles
>()
.
lambda
().
in
(
DiskCatalogueFiles:
:
getCatalogueId
,
treeList
.
stream
().
map
(
item
->
item
.
getId
()).
collect
(
Collectors
.
toList
()))
.
eq
(
DiskCatalogueFiles:
:
getDeleteFlag
,
0
)
);
//根据CatalogueId分组
map
=
diskCatalogueFilesList
.
stream
().
collect
(
Collectors
.
groupingBy
(
DiskCatalogueFiles:
:
getCatalogueId
));
List
<
DiskCatalogue
>
list
=
treeList
.
stream
().
filter
(
s
->
s
.
getParentId
()
==
0
).
collect
(
Collectors
.
toList
());
return
getTree
(
list
);
...
...
@@ -56,6 +81,13 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
*/
public
static
DiskCatalogue
recursiveTree
(
Integer
cid
)
{
DiskCatalogue
node
=
getMenuById
(
cid
);
//填充文件夹下所有文件
List
<
DiskCatalogueFiles
>
diskCatalogueFilesList
=
(
List
<
DiskCatalogueFiles
>)
map
.
get
(
cid
);
if
(!
CollectionUtils
.
isEmpty
(
diskCatalogueFilesList
))
{
List
<
Integer
>
ids
=
diskCatalogueFilesList
.
stream
().
map
(
item
->
item
.
getFilesId
()).
collect
(
Collectors
.
toList
());
List
<
DiskFiles
>
diskFilesList
=
filesList
.
stream
().
filter
(
item
->
ids
.
contains
(
item
.
getId
())).
collect
(
Collectors
.
toList
());
node
.
setDiskFilesList
(
diskFilesList
);
}
List
<
DiskCatalogue
>
childTreeNodes
=
getChildTreeById
(
cid
);
for
(
DiskCatalogue
child
:
childTreeNodes
)
{
DiskCatalogue
n
=
recursiveTree
(
child
.
getId
());
...
...
@@ -94,7 +126,7 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
}
/**
* 根据父节点CID获取所有
了
节点
* 根据父节点CID获取所有
子
节点
*/
public
static
List
<
DiskCatalogue
>
getChildTreeById
(
Integer
cid
)
{
List
<
DiskCatalogue
>
list
=
new
ArrayList
<>();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment