Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liqin
chnmuseum-party
Commits
6b7782fc
Commit
6b7782fc
authored
Jun 04, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
限制展板分类和视频分类在使用时不能被删除
parent
516e9bd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
4 deletions
+21
-4
ExhibitionBoardCatController.java
...um/party/web/controller/ExhibitionBoardCatController.java
+12
-2
VideoContentCatController.java
...useum/party/web/controller/VideoContentCatController.java
+9
-2
No files found.
src/main/java/cn/chnmuseum/party/web/controller/ExhibitionBoardCatController.java
View file @
6b7782fc
...
...
@@ -13,6 +13,7 @@ import cn.chnmuseum.party.web.controller.base.BaseController;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
...
...
@@ -202,15 +203,24 @@ public class ExhibitionBoardCatController extends BaseController {
})
@MethodLog
(
operModule
=
OperModule
.
DISPLAYCLASSIFY
,
operType
=
OperType
.
DELETE
)
public
Map
<
String
,
Object
>
deleteExhibitionBoardCat
(
@PathVariable
(
"id"
)
String
id
)
{
this
.
exhibitionBoardCatService
.
removeById
(
id
);
// 该展板在被使用时,不能被删除
LambdaUpdateWrapper
<
CopyrightOwnerBoardCat
>
copyrightOwnerBoardCatLambdaUpdateWrapper
=
Wrappers
.<
CopyrightOwnerBoardCat
>
lambdaUpdate
().
eq
(
CopyrightOwnerBoardCat:
:
getBoardCatId
,
id
);
List
<
CopyrightOwnerBoardCat
>
list
=
this
.
copyrightOwnerBoardCatService
.
list
(
copyrightOwnerBoardCatLambdaUpdateWrapper
);
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
return
getFailResult
(
"该展板分类正在被使用,不能删除!"
);
}
// 删除展板分类信息
this
.
exhibitionBoardCatService
.
removeById
(
id
);
// 删除版权方展板分类信息
this
.
copyrightOwnerBoardCatService
.
remove
(
copyrightOwnerBoardCatLambdaUpdateWrapper
);
final
LambdaQueryWrapper
<
ExhibitionBoard
>
exhibitionBoardLambdaQueryWrapper
=
Wrappers
.<
ExhibitionBoard
>
lambdaQuery
().
eq
(
ExhibitionBoard:
:
getExhibitionBoardCatId
,
id
).
select
(
ExhibitionBoard:
:
getId
);
final
List
<
String
>
exhibitionBoardIdList
=
this
.
exhibitionBoardService
.
listObjs
(
exhibitionBoardLambdaQueryWrapper
,
Object:
:
toString
);
if
(
exhibitionBoardIdList
!=
null
&&
!
exhibitionBoardIdList
.
isEmpty
())
{
// 删除该展板分类下得展板信息
this
.
exhibitionBoardService
.
removeByIds
(
exhibitionBoardIdList
);
// 删除该展板
this
.
assetService
.
remove
(
Wrappers
.<
Asset
>
lambdaUpdate
().
in
(
Asset:
:
getRefItemId
,
exhibitionBoardIdList
));
final
LambdaQueryWrapper
<
LearningContentBoard
>
learningContentBoardLambdaQueryWrapper
=
Wrappers
.<
LearningContentBoard
>
lambdaQuery
().
in
(
LearningContentBoard:
:
getExhibitionBoardCatId
,
exhibitionBoardIdList
);
...
...
src/main/java/cn/chnmuseum/party/web/controller/VideoContentCatController.java
View file @
6b7782fc
...
...
@@ -8,6 +8,7 @@ import cn.chnmuseum.party.common.vo.GenericPageParam;
import
cn.chnmuseum.party.model.*
;
import
cn.chnmuseum.party.service.*
;
import
cn.chnmuseum.party.web.controller.base.BaseController
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
...
@@ -182,9 +183,15 @@ public class VideoContentCatController extends BaseController {
})
@MethodLog
(
operModule
=
OperModule
.
VIDEOCLASSIFY
,
operType
=
OperType
.
DELETE
)
public
Map
<
String
,
Object
>
deleteVideoContentCat
(
@PathVariable
(
"id"
)
String
id
)
{
this
.
videoContentCatService
.
removeById
(
id
);
// 该视频分类正在被使用时,不能被删除
final
LambdaUpdateWrapper
<
CopyrightOwnerVideoContentCat
>
updateWrapper1
=
Wrappers
.<
CopyrightOwnerVideoContentCat
>
lambdaUpdate
().
eq
(
CopyrightOwnerVideoContentCat:
:
getVideoContentCatId
,
id
);
List
<
CopyrightOwnerVideoContentCat
>
list
=
this
.
copyrightOwnerVideoContentCatService
.
list
(
updateWrapper1
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
return
getFailResult
(
"该视频分类正在被使用,不能删除"
);
}
// 删除视频分类信息
this
.
videoContentCatService
.
removeById
(
id
);
// 删除版权方和视频分类对应信息
this
.
copyrightOwnerVideoContentCatService
.
remove
(
updateWrapper1
);
final
LambdaQueryWrapper
<
VideoContent
>
lambdaQueryWrapper
=
Wrappers
.<
VideoContent
>
lambdaQuery
().
eq
(
VideoContent:
:
getVideoContentCatId
,
id
).
select
(
VideoContent:
:
getId
);
...
...
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