mirror of
https://gitee.com/myxzgzs/boyue-vue-pro.git
synced 2025-08-08 16:32:46 +08:00
!1366 feat: system、infra 模块新增批量删除接口
Merge pull request !1366 from puhui999/master-jdk17
This commit is contained in:
commit
bcd6ed4c4c
@ -122,6 +122,15 @@ public class CodegenController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "批量删除数据库的表和字段定义")
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "tableIds", description = "表编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('infra:codegen:delete')")
|
||||||
|
public CommonResult<Boolean> deleteCodegenList(@RequestParam("tableIds") List<Long> tableIds) {
|
||||||
|
codegenService.deleteCodegenList(tableIds);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "预览生成代码")
|
@Operation(summary = "预览生成代码")
|
||||||
@GetMapping("/preview")
|
@GetMapping("/preview")
|
||||||
@Parameter(name = "tableId", description = "表编号", required = true, example = "1024")
|
@Parameter(name = "tableId", description = "表编号", required = true, example = "1024")
|
||||||
|
@ -62,6 +62,15 @@ public class ConfigController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除参数配置")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('infra:config:delete')")
|
||||||
|
public CommonResult<Boolean> deleteConfigList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
configService.deleteConfigList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/get")
|
@GetMapping(value = "/get")
|
||||||
@Operation(summary = "获得参数配置")
|
@Operation(summary = "获得参数配置")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@ -52,6 +52,15 @@ public class DataSourceConfigController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除数据源配置")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('infra:data-source-config:delete')")
|
||||||
|
public CommonResult<Boolean> deleteDataSourceConfigList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
dataSourceConfigService.deleteDataSourceConfigList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得数据源配置")
|
@Operation(summary = "获得数据源配置")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@ -17,6 +17,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 文件配置")
|
@Tag(name = "管理后台 - 文件配置")
|
||||||
@ -60,6 +62,15 @@ public class FileConfigController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除文件配置")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('infra:file-config:delete')")
|
||||||
|
public CommonResult<Boolean> deleteFileConfigList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
fileConfigService.deleteFileConfigList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得文件配置")
|
@Operation(summary = "获得文件配置")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@ -26,6 +26,8 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.module.infra.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
import static cn.iocoder.yudao.module.infra.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
||||||
|
|
||||||
@ -75,6 +77,15 @@ public class FileController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除文件")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('infra:file:delete')")
|
||||||
|
public CommonResult<Boolean> deleteFileList(@RequestParam("ids") List<Long> ids) throws Exception {
|
||||||
|
fileService.deleteFileList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/{configId}/get/**")
|
@GetMapping("/{configId}/get/**")
|
||||||
@PermitAll
|
@PermitAll
|
||||||
@TenantIgnore
|
@TenantIgnore
|
||||||
|
@ -81,6 +81,16 @@ public class JobController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除定时任务")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('infra:job:delete')")
|
||||||
|
public CommonResult<Boolean> deleteJobList(@RequestParam("ids") List<Long> ids)
|
||||||
|
throws SchedulerException {
|
||||||
|
jobService.deleteJobList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping("/trigger")
|
@PutMapping("/trigger")
|
||||||
@Operation(summary = "触发定时任务")
|
@Operation(summary = "触发定时任务")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@ -48,6 +48,13 @@ public interface CodegenService {
|
|||||||
*/
|
*/
|
||||||
void deleteCodegen(Long tableId);
|
void deleteCodegen(Long tableId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据库的表和字段定义
|
||||||
|
*
|
||||||
|
* @param tableIds 数据编号列表
|
||||||
|
*/
|
||||||
|
void deleteCodegenList(List<Long> tableIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得表定义列表
|
* 获得表定义列表
|
||||||
*
|
*
|
||||||
|
@ -222,6 +222,25 @@ public class CodegenServiceImpl implements CodegenService {
|
|||||||
codegenColumnMapper.deleteListByTableId(tableId);
|
codegenColumnMapper.deleteListByTableId(tableId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteCodegenList(List<Long> tableIds) {
|
||||||
|
if (CollUtil.isEmpty(tableIds)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验是否都存在
|
||||||
|
List<CodegenTableDO> tables = codegenTableMapper.selectByIds(tableIds);
|
||||||
|
if (tables.size() != tableIds.size()) {
|
||||||
|
throw exception(CODEGEN_TABLE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除 table 表定义
|
||||||
|
codegenTableMapper.deleteByIds(tableIds);
|
||||||
|
// 批量删除 column 字段定义
|
||||||
|
tableIds.forEach(tableId -> codegenColumnMapper.deleteListByTableId(tableId));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CodegenTableDO> getCodegenTableList(Long dataSourceConfigId) {
|
public List<CodegenTableDO> getCodegenTableList(Long dataSourceConfigId) {
|
||||||
return codegenTableMapper.selectListByDataSourceConfigId(dataSourceConfigId);
|
return codegenTableMapper.selectListByDataSourceConfigId(dataSourceConfigId);
|
||||||
|
@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
|||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 参数配置 Service 接口
|
* 参数配置 Service 接口
|
||||||
*
|
*
|
||||||
@ -35,6 +37,13 @@ public interface ConfigService {
|
|||||||
*/
|
*/
|
||||||
void deleteConfig(Long id);
|
void deleteConfig(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除参数配置
|
||||||
|
*
|
||||||
|
* @param ids 配置编号列表
|
||||||
|
*/
|
||||||
|
void deleteConfigList(List<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得参数配置
|
* 获得参数配置
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.config;
|
package cn.iocoder.yudao.module.infra.service.config;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
||||||
@ -13,6 +14,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
@ -63,6 +66,28 @@ public class ConfigServiceImpl implements ConfigService {
|
|||||||
configMapper.deleteById(id);
|
configMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteConfigList(List<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 校验配置存在
|
||||||
|
List<ConfigDO> configs = configMapper.selectByIds(ids);
|
||||||
|
if (configs.size() != ids.size()) {
|
||||||
|
throw exception(CONFIG_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验是否有内置配置
|
||||||
|
for (ConfigDO config : configs) {
|
||||||
|
if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) {
|
||||||
|
throw exception(CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除
|
||||||
|
configMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigDO getConfig(Long id) {
|
public ConfigDO getConfig(Long id) {
|
||||||
return configMapper.selectById(id);
|
return configMapper.selectById(id);
|
||||||
|
@ -35,6 +35,13 @@ public interface DataSourceConfigService {
|
|||||||
*/
|
*/
|
||||||
void deleteDataSourceConfig(Long id);
|
void deleteDataSourceConfig(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除数据源配置
|
||||||
|
*
|
||||||
|
* @param ids 编号列表
|
||||||
|
*/
|
||||||
|
void deleteDataSourceConfigList(List<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得数据源配置
|
* 获得数据源配置
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.db;
|
package cn.iocoder.yudao.module.infra.service.db;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.util.JdbcUtils;
|
import cn.iocoder.yudao.framework.mybatis.core.util.JdbcUtils;
|
||||||
import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
|
import cn.iocoder.yudao.module.infra.controller.admin.db.vo.DataSourceConfigSaveReqVO;
|
||||||
@ -63,6 +64,17 @@ public class DataSourceConfigServiceImpl implements DataSourceConfigService {
|
|||||||
dataSourceConfigMapper.deleteById(id);
|
dataSourceConfigMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDataSourceConfigList(List<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 校验存在
|
||||||
|
ids.forEach(this::validateDataSourceConfigExists);
|
||||||
|
// 批量删除
|
||||||
|
dataSourceConfigMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
private void validateDataSourceConfigExists(Long id) {
|
private void validateDataSourceConfigExists(Long id) {
|
||||||
if (dataSourceConfigMapper.selectById(id) == null) {
|
if (dataSourceConfigMapper.selectById(id) == null) {
|
||||||
throw exception(DATA_SOURCE_CONFIG_NOT_EXISTS);
|
throw exception(DATA_SOURCE_CONFIG_NOT_EXISTS);
|
||||||
|
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO;
|
|||||||
import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
|
import cn.iocoder.yudao.module.infra.framework.file.core.client.FileClient;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件配置 Service 接口
|
* 文件配置 Service 接口
|
||||||
*
|
*
|
||||||
@ -43,6 +45,13 @@ public interface FileConfigService {
|
|||||||
*/
|
*/
|
||||||
void deleteFileConfig(Long id);
|
void deleteFileConfig(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除文件配置
|
||||||
|
*
|
||||||
|
* @param ids 编号列表
|
||||||
|
*/
|
||||||
|
void deleteFileConfigList(List<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得文件配置
|
* 获得文件配置
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.file;
|
package cn.iocoder.yudao.module.infra.service.file;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.io.resource.ResourceUtil;
|
import cn.hutool.core.io.resource.ResourceUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
@ -25,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -134,6 +136,34 @@ public class FileConfigServiceImpl implements FileConfigService {
|
|||||||
clearCache(id, null);
|
clearCache(id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteFileConfigList(List<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验存在
|
||||||
|
List<FileConfigDO> configs = fileConfigMapper.selectByIds(ids);
|
||||||
|
if (configs.size() != ids.size()) {
|
||||||
|
throw exception(FILE_CONFIG_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验是否有主配置
|
||||||
|
for (FileConfigDO config : configs) {
|
||||||
|
if (Boolean.TRUE.equals(config.getMaster())) {
|
||||||
|
throw exception(FILE_CONFIG_DELETE_FAIL_MASTER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除
|
||||||
|
fileConfigMapper.deleteByIds(ids);
|
||||||
|
|
||||||
|
// 清空缓存
|
||||||
|
for (Long id : ids) {
|
||||||
|
clearCache(id, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清空指定文件配置
|
* 清空指定文件配置
|
||||||
*
|
*
|
||||||
|
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.infra.controller.admin.file.vo.file.FilePresigned
|
|||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件 Service 接口
|
* 文件 Service 接口
|
||||||
*
|
*
|
||||||
@ -59,6 +61,13 @@ public interface FileService {
|
|||||||
*/
|
*/
|
||||||
void deleteFile(Long id) throws Exception;
|
void deleteFile(Long id) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除文件
|
||||||
|
*
|
||||||
|
* @param ids 编号列表
|
||||||
|
*/
|
||||||
|
void deleteFileList(List<Long> ids) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得文件内容
|
* 获得文件内容
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.file;
|
package cn.iocoder.yudao.module.infra.service.file;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
@ -20,6 +21,10 @@ import jakarta.annotation.Resource;
|
|||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.hutool.core.date.DatePattern.PURE_DATE_PATTERN;
|
import static cn.hutool.core.date.DatePattern.PURE_DATE_PATTERN;
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_NOT_EXISTS;
|
||||||
@ -156,6 +161,36 @@ public class FileServiceImpl implements FileService {
|
|||||||
fileMapper.deleteById(id);
|
fileMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteFileList(List<Long> ids) throws Exception {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验存在
|
||||||
|
List<FileDO> files = fileMapper.selectByIds(ids);
|
||||||
|
if (files.size() != ids.size()) {
|
||||||
|
throw exception(FILE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 按照配置分组,批量删除
|
||||||
|
Map<Long, List<FileDO>> configFiles = files.stream()
|
||||||
|
.collect(Collectors.groupingBy(FileDO::getConfigId));
|
||||||
|
for (Map.Entry<Long, List<FileDO>> entry : configFiles.entrySet()) {
|
||||||
|
// 获取客户端
|
||||||
|
FileClient client = fileConfigService.getFileClient(entry.getKey());
|
||||||
|
Assert.notNull(client, "客户端({}) 不能为空", entry.getKey());
|
||||||
|
|
||||||
|
// 批量删除文件
|
||||||
|
for (FileDO file : entry.getValue()) {
|
||||||
|
client.delete(file.getPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除记录
|
||||||
|
fileMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
private FileDO validateFileExists(Long id) {
|
private FileDO validateFileExists(Long id) {
|
||||||
FileDO fileDO = fileMapper.selectById(id);
|
FileDO fileDO = fileMapper.selectById(id);
|
||||||
if (fileDO == null) {
|
if (fileDO == null) {
|
||||||
|
@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO;
|
|||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.quartz.SchedulerException;
|
import org.quartz.SchedulerException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定时任务 Service 接口
|
* 定时任务 Service 接口
|
||||||
*
|
*
|
||||||
@ -58,6 +60,13 @@ public interface JobService {
|
|||||||
*/
|
*/
|
||||||
void deleteJob(Long id) throws SchedulerException;
|
void deleteJob(Long id) throws SchedulerException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除定时任务
|
||||||
|
*
|
||||||
|
* @param ids 编号列表
|
||||||
|
*/
|
||||||
|
void deleteJobList(List<Long> ids) throws SchedulerException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得定时任务
|
* 获得定时任务
|
||||||
*
|
*
|
||||||
|
@ -169,6 +169,28 @@ public class JobServiceImpl implements JobService {
|
|||||||
schedulerManager.deleteJob(job.getHandlerName());
|
schedulerManager.deleteJob(job.getHandlerName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteJobList(List<Long> ids) throws SchedulerException {
|
||||||
|
if (ids == null || ids.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 校验存在
|
||||||
|
List<JobDO> jobs = jobMapper.selectByIds(ids);
|
||||||
|
if (jobs.size() != ids.size()) {
|
||||||
|
throw exception(JOB_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除
|
||||||
|
jobMapper.deleteByIds(ids);
|
||||||
|
|
||||||
|
// 删除 Job 到 Quartz 中
|
||||||
|
for (JobDO job : jobs) {
|
||||||
|
schedulerManager.deleteJob(job.getHandlerName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private JobDO validateJobExists(Long id) {
|
private JobDO validateJobExists(Long id) {
|
||||||
JobDO job = jobMapper.selectById(id);
|
JobDO job = jobMapper.selectById(id);
|
||||||
if (job == null) {
|
if (job == null) {
|
||||||
|
@ -58,11 +58,20 @@ public class DictDataController {
|
|||||||
@Operation(summary = "删除字典数据")
|
@Operation(summary = "删除字典数据")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||||
public CommonResult<Boolean> deleteDictData(Long id) {
|
public CommonResult<Boolean> deleteDictData(@RequestParam("id") Long id) {
|
||||||
dictDataService.deleteDictData(id);
|
dictDataService.deleteDictData(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除字典数据")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||||
|
public CommonResult<Boolean> deleteDictDataList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
dictDataService.deleteDictDataList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping(value = {"/list-all-simple", "simple-list"})
|
@GetMapping(value = {"/list-all-simple", "simple-list"})
|
||||||
@Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地")
|
@Operation(summary = "获得全部字典数据列表", description = "一般用于管理后台缓存字典数据在本地")
|
||||||
// 无需添加权限认证,因为前端全局都需要
|
// 无需添加权限认证,因为前端全局都需要
|
||||||
@ -73,7 +82,7 @@ public class DictDataController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "/获得字典类型的分页列表")
|
@Operation(summary = "获得字典类型的分页")
|
||||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||||
public CommonResult<PageResult<DictDataRespVO>> getDictTypePage(@Valid DictDataPageReqVO pageReqVO) {
|
public CommonResult<PageResult<DictDataRespVO>> getDictTypePage(@Valid DictDataPageReqVO pageReqVO) {
|
||||||
PageResult<DictDataDO> pageResult = dictDataService.getDictDataPage(pageReqVO);
|
PageResult<DictDataDO> pageResult = dictDataService.getDictDataPage(pageReqVO);
|
||||||
|
@ -62,6 +62,15 @@ public class DictTypeController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除字典类型")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||||
|
public CommonResult<Boolean> deleteDictTypeList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
dictTypeService.deleteDictTypeList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得字典类型的分页列表")
|
@Operation(summary = "获得字典类型的分页列表")
|
||||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||||
|
@ -12,12 +12,12 @@ import cn.iocoder.yudao.module.system.service.permission.MenuService;
|
|||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -57,6 +57,15 @@ public class MenuController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除菜单")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:menu:delete')")
|
||||||
|
public CommonResult<Boolean> deleteMenuList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
menuService.deleteMenuList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获取菜单列表", description = "用于【菜单管理】界面")
|
@Operation(summary = "获取菜单列表", description = "用于【菜单管理】界面")
|
||||||
@PreAuthorize("@ss.hasPermission('system:menu:query')")
|
@PreAuthorize("@ss.hasPermission('system:menu:query')")
|
||||||
|
@ -7,7 +7,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.*;
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleRespVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@ -61,6 +63,15 @@ public class RoleController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Operation(summary = "批量删除角色")
|
||||||
|
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:role:delete')")
|
||||||
|
public CommonResult<Boolean> deleteRoleList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
roleService.deleteRoleList(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得角色信息")
|
@Operation(summary = "获得角色信息")
|
||||||
@PreAuthorize("@ss.hasPermission('system:role:query')")
|
@PreAuthorize("@ss.hasPermission('system:role:query')")
|
||||||
|
@ -38,6 +38,13 @@ public interface PostService {
|
|||||||
*/
|
*/
|
||||||
void deletePost(Long id);
|
void deletePost(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除岗位信息
|
||||||
|
*
|
||||||
|
* @param ids 岗位编号数组
|
||||||
|
*/
|
||||||
|
void deletePostList(List<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得岗位列表
|
* 获得岗位列表
|
||||||
*
|
*
|
||||||
|
@ -8,10 +8,10 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqV
|
|||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.PostDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.dept.PostMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.dept.PostMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -58,10 +58,16 @@ public class PostServiceImpl implements PostService {
|
|||||||
public void deletePost(Long id) {
|
public void deletePost(Long id) {
|
||||||
// 校验是否存在
|
// 校验是否存在
|
||||||
validatePostExists(id);
|
validatePostExists(id);
|
||||||
// 删除部门
|
// 删除岗位
|
||||||
postMapper.deleteById(id);
|
postMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deletePostList(List<Long> ids) {
|
||||||
|
// 删除岗位
|
||||||
|
postMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
private void validatePostForCreateOrUpdate(Long id, String name, String code) {
|
private void validatePostForCreateOrUpdate(Long id, String name, String code) {
|
||||||
// 校验自己存在
|
// 校验自己存在
|
||||||
validatePostExists(id);
|
validatePostExists(id);
|
||||||
|
@ -38,6 +38,13 @@ public interface DictDataService {
|
|||||||
*/
|
*/
|
||||||
void deleteDictData(Long id);
|
void deleteDictData(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典数据
|
||||||
|
*
|
||||||
|
* @param ids 字典数据编号列表
|
||||||
|
*/
|
||||||
|
void deleteDictDataList(List<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得字典数据列表
|
* 获得字典数据列表
|
||||||
*
|
*
|
||||||
|
@ -98,6 +98,18 @@ public class DictDataServiceImpl implements DictDataService {
|
|||||||
dictDataMapper.deleteById(id);
|
dictDataMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDictDataList(List<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 校验是否存在
|
||||||
|
ids.forEach(this::validateDictDataExists);
|
||||||
|
|
||||||
|
// 批量删除字典数据
|
||||||
|
dictDataMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getDictDataCountByDictType(String dictType) {
|
public long getDictDataCountByDictType(String dictType) {
|
||||||
return dictDataMapper.selectCountByDictType(dictType);
|
return dictDataMapper.selectCountByDictType(dictType);
|
||||||
|
@ -36,6 +36,13 @@ public interface DictTypeService {
|
|||||||
*/
|
*/
|
||||||
void deleteDictType(Long id);
|
void deleteDictType(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除字典类型
|
||||||
|
*
|
||||||
|
* @param ids 字典类型编号列表
|
||||||
|
*/
|
||||||
|
void deleteDictTypeList(List<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得字典类型分页列表
|
* 获得字典类型分页列表
|
||||||
*
|
*
|
||||||
|
@ -9,9 +9,9 @@ import cn.iocoder.yudao.module.system.controller.admin.dict.vo.type.DictTypeSave
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.dict.DictTypeMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.dict.DictTypeMapper;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -87,6 +87,27 @@ public class DictTypeServiceImpl implements DictTypeService {
|
|||||||
dictTypeMapper.updateToDelete(id, LocalDateTime.now());
|
dictTypeMapper.updateToDelete(id, LocalDateTime.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDictTypeList(List<Long> ids) {
|
||||||
|
if (ids == null || ids.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 校验是否存在
|
||||||
|
ids.forEach(this::validateDictTypeExists);
|
||||||
|
|
||||||
|
// 校验是否有字典数据
|
||||||
|
List<DictTypeDO> dictTypes = dictTypeMapper.selectByIds(ids);
|
||||||
|
for (DictTypeDO dictType : dictTypes) {
|
||||||
|
if (dictDataService.getDictDataCountByDictType(dictType.getType()) > 0) {
|
||||||
|
throw exception(DICT_TYPE_HAS_CHILDREN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除字典类型
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
ids.forEach(id -> dictTypeMapper.updateToDelete(id, now));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DictTypeDO> getDictTypeList() {
|
public List<DictTypeDO> getDictTypeList() {
|
||||||
return dictTypeMapper.selectList();
|
return dictTypeMapper.selectList();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.permission;
|
package cn.iocoder.yudao.module.system.service.permission;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuSaveVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuListReqVO;
|
||||||
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.menu.MenuSaveVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -36,6 +36,13 @@ public interface MenuService {
|
|||||||
*/
|
*/
|
||||||
void deleteMenu(Long id);
|
void deleteMenu(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除菜单
|
||||||
|
*
|
||||||
|
* @param ids 菜单编号数组
|
||||||
|
*/
|
||||||
|
void deleteMenuList(List<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得所有菜单列表
|
* 获得所有菜单列表
|
||||||
*
|
*
|
||||||
|
@ -104,6 +104,31 @@ public class MenuServiceImpl implements MenuService {
|
|||||||
permissionService.processMenuDeleted(id);
|
permissionService.processMenuDeleted(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@CacheEvict(value = RedisKeyConstants.PERMISSION_MENU_ID_LIST, allEntries = true)
|
||||||
|
public void deleteMenuList(List<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 校验是否还有子菜单
|
||||||
|
for (Long id : ids) {
|
||||||
|
if (menuMapper.selectCountByParentId(id) > 0) {
|
||||||
|
throw exception(MENU_EXISTS_CHILDREN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 校验删除的菜单是否存在
|
||||||
|
List<MenuDO> menus = menuMapper.selectByIds(ids);
|
||||||
|
if (menus.size() != ids.size()) {
|
||||||
|
throw exception(MENU_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标记删除
|
||||||
|
menuMapper.deleteByIds(ids);
|
||||||
|
// 删除授予给角色的权限
|
||||||
|
ids.forEach(id -> permissionService.processMenuDeleted(id));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MenuDO> getMenuList() {
|
public List<MenuDO> getMenuList() {
|
||||||
return menuMapper.selectList();
|
return menuMapper.selectList();
|
||||||
|
@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -40,6 +40,13 @@ public interface RoleService {
|
|||||||
*/
|
*/
|
||||||
void deleteRole(Long id);
|
void deleteRole(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除角色
|
||||||
|
*
|
||||||
|
* @param ids 角色编号数组
|
||||||
|
*/
|
||||||
|
void deleteRoleList(List<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置角色的数据权限
|
* 设置角色的数据权限
|
||||||
*
|
*
|
||||||
|
@ -122,6 +122,21 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
LogRecordContext.putVariable("role", role);
|
LogRecordContext.putVariable("role", role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteRoleList(List<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 1. 校验是否可以更新
|
||||||
|
ids.forEach(this::validateRoleForUpdate);
|
||||||
|
|
||||||
|
// 2.1 标记删除
|
||||||
|
roleMapper.deleteByIds(ids);
|
||||||
|
// 2.2 删除相关数据
|
||||||
|
ids.forEach(id -> permissionService.processRoleDeleted(id));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验角色的唯一字段是否重复
|
* 校验角色的唯一字段是否重复
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user