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
42eff639
Commit
42eff639
authored
Mar 05, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
禅道bug-
1357、所有文件中单个文件的删除功能异常,无法对单个文件进行删除操作
parent
cfea190a
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
136 additions
and
47 deletions
+136
-47
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
+83
-47
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueService.java
+8
-0
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueServiceImpl.java
+7
-0
src/main/java/cn/timer/api/controller/disk/sevice/DiskFilesService.java
+8
-0
src/main/java/cn/timer/api/controller/disk/sevice/DiskFilesServiceImpl.java
+5
-0
src/main/java/cn/timer/api/dao/disk/DiskCatalogueMapper.java
+3
-0
src/main/java/cn/timer/api/dao/disk/DiskFilesMapper.java
+7
-0
src/main/resources/mapping/disk/DiskCatalogueMapper.xml
+5
-0
src/main/resources/mapping/disk/DiskCloudDiskUserMapper.xml
+2
-0
src/main/resources/mapping/disk/DiskFilesMapper.xml
+8
-0
No files found.
src/main/java/cn/timer/api/controller/disk/DiskCatalogueController.java
View file @
42eff639
...
@@ -391,7 +391,7 @@ public class DiskCatalogueController {
...
@@ -391,7 +391,7 @@ public class DiskCatalogueController {
@GetMapping
(
value
=
"/getFileById"
)
@GetMapping
(
value
=
"/getFileById"
)
@ApiOperation
(
value
=
"查看用户文件夹列表"
,
httpMethod
=
"GET"
,
notes
=
"文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperation
(
value
=
"查看用户文件夹列表"
,
httpMethod
=
"GET"
,
notes
=
"文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperationSupport
(
order
=
2
)
@ApiOperationSupport
(
order
=
2
)
public
Result
<
Object
>
getFile
Of
Id
(
@CurrentUser
UserBean
userBean
,
DiskCatalogueParam
diskCatalogueParam
)
{
public
Result
<
Object
>
getFile
By
Id
(
@CurrentUser
UserBean
userBean
,
DiskCatalogueParam
diskCatalogueParam
)
{
diskCatalogueParam
.
setOrgId
(
userBean
.
getOrgCode
());
diskCatalogueParam
.
setOrgId
(
userBean
.
getOrgCode
());
YgglMainEmp
ygglMainEmp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getEmpNum
,
diskCatalogueParam
.
getUserId
()));
YgglMainEmp
ygglMainEmp
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getEmpNum
,
diskCatalogueParam
.
getUserId
()));
// 获取文件夹
// 获取文件夹
...
@@ -445,11 +445,12 @@ public class DiskCatalogueController {
...
@@ -445,11 +445,12 @@ public class DiskCatalogueController {
return
ResultUtil
.
data
(
map
);
return
ResultUtil
.
data
(
map
);
}
}
@GetMapping
(
value
=
"/deleteAlLFile"
)
@GetMapping
(
value
=
"/deleteAlLFile"
)
@ApiOperation
(
value
=
"删除用户下的所有文件夹"
,
httpMethod
=
"GET"
,
notes
=
"文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperation
(
value
=
"删除用户下的所有文件夹"
,
httpMethod
=
"GET"
,
notes
=
"文件夹或共享空间:type=0共享空间,1文件夹"
)
@ApiOperationSupport
(
order
=
2
)
@ApiOperationSupport
(
order
=
2
)
@Log
(
title
=
"删除用户下的所有文件夹"
,
businessType
=
BusinessType
.
OTHER
)
@Log
(
title
=
"删除用户下的所有文件夹"
,
businessType
=
BusinessType
.
OTHER
)
p
rivate
Result
<
Object
>
deleteAlLFile
(
@CurrentUser
UserBean
userBean
,
DiskCatalogueParam
diskCatalogueParam
){
p
ublic
Result
<
Object
>
deleteAlLFile
(
@CurrentUser
UserBean
userBean
,
DiskCatalogueParam
diskCatalogueParam
){
List
<
DiskCatalogue
>
diskCatalogueList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>().
lambda
()
List
<
DiskCatalogue
>
diskCatalogueList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>().
lambda
()
.
eq
(
DiskCatalogue:
:
getCreateUserId
,
diskCatalogueParam
.
getUserId
())
.
eq
(
DiskCatalogue:
:
getCreateUserId
,
diskCatalogueParam
.
getUserId
())
.
eq
(
DiskCatalogue:
:
getParentId
,
0
)
.
eq
(
DiskCatalogue:
:
getParentId
,
0
)
...
@@ -457,57 +458,92 @@ public class DiskCatalogueController {
...
@@ -457,57 +458,92 @@ public class DiskCatalogueController {
if
(
diskCatalogueList
.
size
()<=
0
){
if
(
diskCatalogueList
.
size
()<=
0
){
return
ResultUtil
.
error
(
"该用户下没有文件"
);
return
ResultUtil
.
error
(
"该用户下没有文件"
);
}
}
/*查找ids第一个*/
diskCatalogueList
.
forEach
(
d
->{
diskCatalogueList
.
forEach
(
d
->{
getSubCatalogueList
(
d
.
getId
());
List
<
DiskCatalogue
>
subList
=
diskCatalogueService
.
getSubCatalogueList
(
d
.
getId
().
toString
(),
diskCatalogueParam
.
getUserId
());
//所有的子文件夹
if
(
subList
!=
null
)
{
subList
.
forEach
(
s
->
{
List
<
DiskCatalogueFiles
>
diskCatalogueFilesList
=
DiskCatalogueFiles
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogueFiles
>().
lambda
()
.
eq
(
DiskCatalogueFiles:
:
getCatalogueId
,
s
.
getId
())
.
eq
(
DiskCatalogueFiles:
:
getDeleteFlag
,
0
));
if
(
diskCatalogueFilesList
.
size
()
>
0
)
{
diskFilesService
.
deleteDiskFile
(
diskCatalogueFilesList
.
stream
().
map
(
DiskCatalogueFiles:
:
getFilesId
).
collect
(
Collectors
.
toList
()));
}
});
}
d
.
setDeleteFlag
(
1
);
d
.
setDeleteFlag
(
1
);
d
.
updateById
();
d
.
updateById
();
});
});
return
ResultUtil
.
success
();
return
ResultUtil
.
success
();
}
}
private
void
getSubCatalogueList
(
Integer
id
){
List
<
DiskCatalogue
>
subFileList
=
DiskCatalogue
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogue
>().
lambda
()
.
like
(
DiskCatalogue:
:
getParentId
,
id
)
.
eq
(
DiskCatalogue:
:
getDeleteFlag
,
0
));
subFileList
.
forEach
(
s
->{
if
(
subFileList
.
size
()>
0
){
getSubCatalogueList
(
s
.
getId
());
}
List
<
DiskCatalogueFiles
>
diskCatalogueFilesList
=
DiskCatalogueFiles
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
DiskCatalogueFiles
>().
lambda
()
.
eq
(
DiskCatalogueFiles:
:
getCatalogueId
,
s
.
getId
())
.
eq
(
DiskCatalogueFiles:
:
getDeleteFlag
,
0
));
diskCatalogueFilesList
.
forEach
(
f
->{
DiskFiles
.
builder
().
deleteFlag
(
1
).
build
().
update
(
new
QueryWrapper
<
DiskFiles
>().
lambda
().
eq
(
DiskFiles:
:
getId
,
f
.
getFilesId
()));
f
.
setDeleteFlag
(
1
);
f
.
updateById
();
});
s
.
setDeleteFlag
(
1
);
s
.
updateById
();
});
}
// private void getSubCatalogueList2(Integer id){
// List<DiskCatalogue> subFileList =DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>().lambda()
// .like(DiskCatalogue::getParentId,id)
// .eq(DiskCatalogue::getDeleteFlag,0));
// subFileList.forEach(s->{
// if(subFileList.size()>0){
// getSubCatalogueList(s.getId());
// }
// List<DiskCatalogueFiles> diskCatalogueFilesList = DiskCatalogueFiles.builder().build().selectList(new QueryWrapper<DiskCatalogueFiles>().lambda()
// .eq(DiskCatalogueFiles::getCatalogueId,s.getId())
// .eq(DiskCatalogueFiles::getDeleteFlag,0));
// if(diskCatalogueFilesList!=null) {
// if(diskCatalogueFilesList.size()>0) {
// diskFilesService.deleteDiskFile(diskCatalogueFilesList.stream().map(DiskCatalogueFiles::getFilesId).collect(Collectors.toList()));
// }
// }
//// diskCatalogueFilesList.forEach(f->{
//// DiskFiles.builder().deleteFlag(1).build().update(new QueryWrapper<DiskFiles>().lambda().eq(DiskFiles::getId,f.getFilesId()));
//// });
// s.setDeleteFlag(1);
// s.updateById();
// });
// }
}
}
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueService.java
View file @
42eff639
...
@@ -2,6 +2,7 @@ package cn.timer.api.controller.disk.sevice;
...
@@ -2,6 +2,7 @@ package cn.timer.api.controller.disk.sevice;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -28,6 +29,13 @@ public interface DiskCatalogueService {
...
@@ -28,6 +29,13 @@ public interface DiskCatalogueService {
*/
*/
List
<
DiskCatalogue
>
getDiskCatalogue
(
DiskCatalogueParam
diskCatalogueParam
);
List
<
DiskCatalogue
>
getDiskCatalogue
(
DiskCatalogueParam
diskCatalogueParam
);
/**
* 获取所有子文件夹
* @param ids
* @return
*/
List
<
DiskCatalogue
>
getSubCatalogueList
(
String
ids
,
Integer
userId
);
/**
/**
...
...
src/main/java/cn/timer/api/controller/disk/sevice/DiskCatalogueServiceImpl.java
View file @
42eff639
...
@@ -2,10 +2,12 @@ package cn.timer.api.controller.disk.sevice;
...
@@ -2,10 +2,12 @@ package cn.timer.api.controller.disk.sevice;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogueFiles
;
import
cn.timer.api.bean.disk.DiskCatalogueFiles
;
import
cn.timer.api.bean.disk.DiskFileImage
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.bean.disk.DiskFiles
;
import
cn.timer.api.dao.disk.DiskCatalogueMapper
;
import
cn.timer.api.dao.disk.DiskCatalogueMapper
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
...
@@ -101,6 +103,11 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
...
@@ -101,6 +103,11 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
return
true
;
return
true
;
}
}
@Override
public
List
<
DiskCatalogue
>
getSubCatalogueList
(
String
ids
,
Integer
userId
){
return
diskCatalogueMapper
.
getSubCatalogueList
(
ids
,
userId
);
}
/**
/**
* 递归获取树形结构
* 递归获取树形结构
*
*
...
...
src/main/java/cn/timer/api/controller/disk/sevice/DiskFilesService.java
View file @
42eff639
...
@@ -28,4 +28,12 @@ public interface DiskFilesService {
...
@@ -28,4 +28,12 @@ public interface DiskFilesService {
* @return
* @return
*/
*/
DiskFileCatalogueDto
getFileCount
(
Integer
userId
);
DiskFileCatalogueDto
getFileCount
(
Integer
userId
);
/**
* 删除文件
* @param list
* @return
*/
Integer
deleteDiskFile
(
List
<
Integer
>
list
);
}
}
src/main/java/cn/timer/api/controller/disk/sevice/DiskFilesServiceImpl.java
View file @
42eff639
...
@@ -40,4 +40,9 @@ public class DiskFilesServiceImpl implements DiskFilesService {
...
@@ -40,4 +40,9 @@ public class DiskFilesServiceImpl implements DiskFilesService {
dto
.
setShowSize
(
"1G"
);
dto
.
setShowSize
(
"1G"
);
return
dto
;
return
dto
;
}
}
@Override
public
Integer
deleteDiskFile
(
List
<
Integer
>
list
)
{
return
diskFilesMapper
.
deleteDiskFile
(
list
);
}
}
}
src/main/java/cn/timer/api/dao/disk/DiskCatalogueMapper.java
View file @
42eff639
...
@@ -4,6 +4,8 @@ package cn.timer.api.dao.disk;
...
@@ -4,6 +4,8 @@ package cn.timer.api.dao.disk;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.bean.disk.DiskCatalogue
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
cn.timer.api.dto.disk.DiskCatalogueParam
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
io.swagger.models.auth.In
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
...
@@ -21,4 +23,5 @@ public interface DiskCatalogueMapper extends BaseMapper<DiskCatalogue> {
...
@@ -21,4 +23,5 @@ public interface DiskCatalogueMapper extends BaseMapper<DiskCatalogue> {
List
<
Integer
>
selectIdListById
(
@Param
(
"id"
)
Integer
id
);
List
<
Integer
>
selectIdListById
(
@Param
(
"id"
)
Integer
id
);
List
<
DiskCatalogue
>
getSubCatalogueList
(
@Param
(
"ids"
)
String
ids
,
@Param
(
"userId"
)
Integer
userId
);
}
}
src/main/java/cn/timer/api/dao/disk/DiskFilesMapper.java
View file @
42eff639
...
@@ -35,4 +35,11 @@ public interface DiskFilesMapper extends BaseMapper<DiskFiles> {
...
@@ -35,4 +35,11 @@ public interface DiskFilesMapper extends BaseMapper<DiskFiles> {
*/
*/
DiskFileCatalogueDto
selectFileCount
(
@Param
(
"userId"
)
Integer
userId
);
DiskFileCatalogueDto
selectFileCount
(
@Param
(
"userId"
)
Integer
userId
);
/**
* 删除文件
* @param list
* @return
*/
Integer
deleteDiskFile
(
@Param
(
"list"
)
List
<
Integer
>
list
);
}
}
src/main/resources/mapping/disk/DiskCatalogueMapper.xml
View file @
42eff639
...
@@ -27,4 +27,9 @@
...
@@ -27,4 +27,9 @@
SELECT id FROM disk_catalogue WHERE delete_flag = 0 AND find_in_set(#{id},parent_ids) OR id = #{id}
SELECT id FROM disk_catalogue WHERE delete_flag = 0 AND find_in_set(#{id},parent_ids) OR id = #{id}
</select>
</select>
<select
id=
"getSubCatalogueList"
resultMap=
"BaseResultMap"
>
select d.* from disk_catalogue d
where d.delete_flag = 0 and d.parent_ids like CONCAT(#{ids},'%') and d.create_user_id = #{userId}
</select>
</mapper>
</mapper>
src/main/resources/mapping/disk/DiskCloudDiskUserMapper.xml
View file @
42eff639
...
@@ -20,7 +20,9 @@
...
@@ -20,7 +20,9 @@
SELECT c.*,cdu.id as cloud_disk_user_id,cdu.user_role,cdu.user_power FROM `disk_catalogue` c
SELECT c.*,cdu.id as cloud_disk_user_id,cdu.user_role,cdu.user_power FROM `disk_catalogue` c
LEFT JOIN disk_cloud_disk_user cdu ON c.id=cdu.catalogue_id AND c.id > 0
LEFT JOIN disk_cloud_disk_user cdu ON c.id=cdu.catalogue_id AND c.id > 0
WHERE c.delete_flag=0 AND cdu.delete_flag = 0
WHERE c.delete_flag=0 AND cdu.delete_flag = 0
<if
test=
"param.userId!=null"
>
AND cdu.user_id = #{param.userId}
AND cdu.user_id = #{param.userId}
</if>
AND cdu.org_id = #{param.orgId}
AND cdu.org_id = #{param.orgId}
AND c.parent_id = #{param.parentId}
AND c.parent_id = #{param.parentId}
<if
test=
"param.id != null and param.id != ''"
>
<if
test=
"param.id != null and param.id != ''"
>
...
...
src/main/resources/mapping/disk/DiskFilesMapper.xml
View file @
42eff639
...
@@ -36,4 +36,12 @@
...
@@ -36,4 +36,12 @@
SELECT COALESCE(sum(file_size),0) as countSize FROM `disk_files` where create_user_id = #{userId} AND delete_flag=0
SELECT COALESCE(sum(file_size),0) as countSize FROM `disk_files` where create_user_id = #{userId} AND delete_flag=0
</select>
</select>
<update
id=
"deleteDiskFile"
parameterType=
"java.util.List"
>
update disk_catalogue_files set delete_flag = 1
where id in
<foreach
item=
"item"
index=
"index"
collection=
"list"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</update>
</mapper>
</mapper>
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