Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
4054ac7b
Commit
4054ac7b
authored
Mar 09, 2020
by
Elune
Browse files
字典支持多选删除
parent
9f33cc07
Changes
3
Hide whitespace changes
Inline
Side-by-side
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/DictController.java
View file @
4054ac7b
...
...
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.Set
;
/**
* @author Zheng Jie
...
...
@@ -80,10 +81,10 @@ public class DictController {
@Log
(
"删除字典"
)
@ApiOperation
(
"删除字典"
)
@DeleteMapping
(
value
=
"/{id}"
)
@DeleteMapping
@PreAuthorize
(
"@el.check('dict:del')"
)
public
ResponseEntity
<
Object
>
delete
(
@
PathVariable
Long
id
){
dictService
.
delete
(
id
);
public
ResponseEntity
<
Object
>
delete
(
@
RequestBody
Set
<
Long
>
id
s
){
dictService
.
delete
(
id
s
);
return
new
ResponseEntity
<>(
HttpStatus
.
OK
);
}
}
\ No newline at end of file
eladmin-system/src/main/java/me/zhengjie/modules/system/service/DictService.java
View file @
4054ac7b
...
...
@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletResponse;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
/**
* @author Zheng Jie
...
...
@@ -53,9 +54,9 @@ public interface DictService {
/**
* 删除
* @param id /
* @param id
s
/
*/
void
delete
(
Long
id
);
void
delete
(
Set
<
Long
>
id
s
);
/**
* 导出数据
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/service/impl/DictServiceImpl.java
View file @
4054ac7b
...
...
@@ -23,10 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* @author Zheng Jie
...
...
@@ -87,8 +84,10 @@ public class DictServiceImpl implements DictService {
@Override
@CacheEvict
(
allEntries
=
true
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
delete
(
Long
id
)
{
dictRepository
.
deleteById
(
id
);
public
void
delete
(
Set
<
Long
>
ids
)
{
for
(
Long
id
:
ids
)
{
dictRepository
.
deleteById
(
id
);
}
}
@Override
...
...
Write
Preview
Supports
Markdown
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