Commit 4054ac7b authored by Elune's avatar Elune
Browse files

字典支持多选删除

parent 9f33cc07
......@@ -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);
}
}
\ No newline at end of file
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment