mirror of https://github.com/elunez/eladmin
字典支持多选删除
parent
9f33cc07bc
commit
4054ac7bc8
|
@ -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> ids){
|
||||
dictService.delete(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
|
@ -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 ids /
|
||||
*/
|
||||
void delete(Long id);
|
||||
void delete(Set<Long> ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue