Pre Merge pull request !1363 from puhui999/master-jdk17
This commit is contained in:
commit
65e0746188
|
@ -13,11 +13,11 @@ import cn.iocoder.yudao.module.system.service.mail.MailAccountService;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
@ -54,6 +54,15 @@ public class MailAccountController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除邮箱账号")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-account:delete')")
|
||||
public CommonResult<Boolean> deleteMailAccountList(@RequestParam("ids") List<Long> ids) {
|
||||
mailAccountService.deleteMailAccountList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得邮箱账号")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -10,11 +10,11 @@ import cn.iocoder.yudao.module.system.service.mail.MailTemplateService;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
@ -54,6 +54,15 @@ public class MailTemplateController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除邮件模版")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:mail-template:delete')")
|
||||
public CommonResult<Boolean> deleteMailTemplateList(@RequestParam("ids") List<Long> ids) {
|
||||
mailTempleService.deleteMailTemplateList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得邮件模版")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -14,12 +14,13 @@ import cn.iocoder.yudao.module.system.service.notice.NoticeService;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
@ -60,6 +61,15 @@ public class NoticeController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除通知公告")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:notice:delete')")
|
||||
public CommonResult<Boolean> deleteNoticeList(@RequestParam("ids") List<Long> ids) {
|
||||
noticeService.deleteNoticeList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获取通知公告列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:notice:query')")
|
||||
|
|
|
@ -4,19 +4,23 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateSendReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
|
||||
import cn.iocoder.yudao.module.system.service.notify.NotifySendService;
|
||||
import cn.iocoder.yudao.module.system.service.notify.NotifyTemplateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
@ -56,6 +60,15 @@ public class NotifyTemplateController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除站内信模版")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:notify-template:delete')")
|
||||
public CommonResult<Boolean> deleteNotifyTemplateList(@RequestParam("ids") List<Long> ids) {
|
||||
notifyTemplateService.deleteNotifyTemplateList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得站内信模版")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -11,12 +11,13 @@ import cn.iocoder.yudao.module.system.service.oauth2.OAuth2ClientService;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
@ -53,6 +54,15 @@ public class OAuth2ClientController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@Operation(summary = "批量删除 OAuth2 客户端")
|
||||
@PreAuthorize("@ss.hasPermission('system:oauth2-client:delete')")
|
||||
public CommonResult<Boolean> deleteOAuth2ClientList(@RequestParam("ids") List<Long> ids) {
|
||||
oAuth2ClientService.deleteOAuth2ClientList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得 OAuth2 客户端")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -12,11 +12,12 @@ import cn.iocoder.yudao.module.system.service.oauth2.OAuth2TokenService;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
@ -47,4 +48,14 @@ public class OAuth2TokenController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Operation(summary = "批量删除访问令牌")
|
||||
@Parameter(name = "accessTokens", description = "访问令牌数组", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('system:oauth2-token:delete')")
|
||||
public CommonResult<Boolean> deleteAccessTokenList(@RequestParam("accessTokens") List<String> accessTokens) {
|
||||
accessTokens.forEach(accessToken ->
|
||||
authService.logout(accessToken, LoginLogTypeEnum.LOGOUT_DELETE.getType()));
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,11 +12,11 @@ import cn.iocoder.yudao.module.system.service.sms.SmsChannelService;
|
|||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -54,6 +54,15 @@ public class SmsChannelController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@Operation(summary = "批量删除短信渠道")
|
||||
@PreAuthorize("@ss.hasPermission('system:sms-channel:delete')")
|
||||
public CommonResult<Boolean> deleteSmsChannelList(@RequestParam("ids") List<Long> ids) {
|
||||
smsChannelService.deleteSmsChannelList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得短信渠道")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -1,24 +1,27 @@
|
|||
package cn.iocoder.yudao.module.system.controller.admin.sms;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO;
|
||||
import cn.iocoder.yudao.module.system.service.sms.SmsTemplateService;
|
||||
import cn.iocoder.yudao.module.system.service.sms.SmsSendService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSendReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO;
|
||||
import cn.iocoder.yudao.module.system.service.sms.SmsSendService;
|
||||
import cn.iocoder.yudao.module.system.service.sms.SmsTemplateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -59,6 +62,15 @@ public class SmsTemplateController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@Operation(summary = "批量删除短信模板")
|
||||
@PreAuthorize("@ss.hasPermission('system:sms-template:delete')")
|
||||
public CommonResult<Boolean> deleteSmsTemplateList(@RequestParam("ids") List<Long> ids) {
|
||||
smsTemplateService.deleteSmsTemplateList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得短信模板")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -19,6 +19,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 社交客户端")
|
||||
|
@ -56,6 +58,15 @@ public class SocialClientController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@Operation(summary = "批量删除社交客户端")
|
||||
@PreAuthorize("@ss.hasPermission('system:social-client:delete')")
|
||||
public CommonResult<Boolean> deleteSocialClientList(@RequestParam("ids") List<Long> ids) {
|
||||
socialClientService.deleteSocialClientList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得社交客户端")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -95,6 +95,15 @@ public class TenantController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@Operation(summary = "批量删除租户")
|
||||
@PreAuthorize("@ss.hasPermission('system:tenant:delete')")
|
||||
public CommonResult<Boolean> deleteTenantList(@RequestParam("ids") List<Long> ids) {
|
||||
tenantService.deleteTenantList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得租户")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -4,18 +4,21 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.TenantPackagePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.TenantPackageRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.TenantPackageSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.TenantPackageSimpleRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.TenantPackageService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
@ -53,6 +56,15 @@ public class TenantPackageController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@Operation(summary = "批量删除租户套餐")
|
||||
@PreAuthorize("@ss.hasPermission('system:tenant-package:delete')")
|
||||
public CommonResult<Boolean> deleteTenantPackageList(@RequestParam("ids") List<Long> ids) {
|
||||
tenantPackageService.deleteTenantPackageList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得租户套餐")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
|
|
@ -71,6 +71,15 @@ public class UserController {
|
|||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true)
|
||||
@Operation(summary = "批量删除用户")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:delete')")
|
||||
public CommonResult<Boolean> deleteUserList(@RequestParam("ids") List<Long> ids) {
|
||||
userService.deleteUserList(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-password")
|
||||
@Operation(summary = "重置用户密码")
|
||||
@PreAuthorize("@ss.hasPermission('system:user:update-password')")
|
||||
|
|
|
@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,13 @@ public interface MailAccountService {
|
|||
*/
|
||||
void deleteMailAccount(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除邮箱账号
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteMailAccountList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取邮箱账号信息
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.system.service.mail;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
||||
|
@ -7,13 +8,13 @@ import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccou
|
|||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailAccountMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
@ -69,12 +70,41 @@ public class MailAccountServiceImpl implements MailAccountService {
|
|||
mailAccountMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = RedisKeyConstants.MAIL_ACCOUNT, allEntries = true)
|
||||
public void deleteMailAccountList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验是否存在
|
||||
validateMailAccountsExists(ids);
|
||||
// 校验是否存在关联模版
|
||||
for (Long id : ids) {
|
||||
if (mailTemplateService.getMailTemplateCountByAccountId(id) > 0) {
|
||||
throw exception(MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS);
|
||||
}
|
||||
}
|
||||
// 批量删除
|
||||
mailAccountMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateMailAccountExists(Long id) {
|
||||
if (mailAccountMapper.selectById(id) == null) {
|
||||
throw exception(MAIL_ACCOUNT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateMailAccountsExists(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
List<MailAccountDO> accounts = mailAccountMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(accounts) || accounts.size() != ids.size()) {
|
||||
throw exception(MAIL_ACCOUNT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MailAccountDO getMailAccount(Long id) {
|
||||
return mailAccountMapper.selectById(id);
|
||||
|
|
|
@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -39,6 +39,13 @@ public interface MailTemplateService {
|
|||
*/
|
||||
void deleteMailTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除邮件模版
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteMailTemplateList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取邮件模版
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.system.service.mail;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
@ -11,14 +12,14 @@ import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
|
|||
import cn.iocoder.yudao.module.system.dal.mysql.mail.MailTemplateMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -97,12 +98,36 @@ public class MailTemplateServiceImpl implements MailTemplateService {
|
|||
mailTemplateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = RedisKeyConstants.MAIL_TEMPLATE,
|
||||
allEntries = true) // allEntries 清空所有缓存,因为 id 不是直接的缓存 code,不好清理
|
||||
public void deleteMailTemplateList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
validateMailTemplatesExists(ids);
|
||||
// 批量删除
|
||||
mailTemplateMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateMailTemplateExists(Long id) {
|
||||
if (mailTemplateMapper.selectById(id) == null) {
|
||||
throw exception(MAIL_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateMailTemplatesExists(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
List<MailTemplateDO> templates = mailTemplateMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(templates) || templates.size() != ids.size()) {
|
||||
throw exception(MAIL_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MailTemplateDO getMailTemplate(Long id) {return mailTemplateMapper.selectById(id);}
|
||||
|
||||
|
@ -125,14 +150,19 @@ public class MailTemplateServiceImpl implements MailTemplateService {
|
|||
return StrUtil.format(content, params);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public List<String> parseTemplateContentParams(String content) {
|
||||
return ReUtil.findAllGroup1(PATTERN_PARAMS, content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getMailTemplateCountByAccountId(Long accountId) {
|
||||
return mailTemplateMapper.selectCountByAccountId(accountId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得邮件模板中的参数,形如 {key}
|
||||
*
|
||||
* @param content 内容
|
||||
* @return 参数列表
|
||||
*/
|
||||
private List<String> parseTemplateContentParams(String content) {
|
||||
return ReUtil.findAllGroup1(PATTERN_PARAMS, content);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO
|
|||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 通知公告 Service 接口
|
||||
*/
|
||||
|
@ -32,6 +34,13 @@ public interface NoticeService {
|
|||
*/
|
||||
void deleteNotice(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除通知公告
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteNoticeList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得通知公告分页列表
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.system.service.notice;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO;
|
||||
|
@ -7,9 +8,10 @@ import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeSaveReqVO
|
|||
import cn.iocoder.yudao.module.system.dal.dataobject.notice.NoticeDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.notice.NoticeMapper;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTICE_NOT_FOUND;
|
||||
|
@ -49,6 +51,14 @@ public class NoticeServiceImpl implements NoticeService {
|
|||
noticeMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteNoticeList(List<Long> ids) {
|
||||
// 校验是否存在
|
||||
validateNoticesExists(ids);
|
||||
// 批量删除通知公告
|
||||
noticeMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<NoticeDO> getNoticePage(NoticePageReqVO reqVO) {
|
||||
return noticeMapper.selectPage(reqVO);
|
||||
|
@ -70,4 +80,15 @@ public class NoticeServiceImpl implements NoticeService {
|
|||
}
|
||||
}
|
||||
|
||||
private void validateNoticesExists(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
List<NoticeDO> notices = noticeMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(notices) || notices.size() != ids.size()) {
|
||||
throw exception(NOTICE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,8 +4,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -37,6 +38,13 @@ public interface NotifyTemplateService {
|
|||
*/
|
||||
void deleteNotifyTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除站内信模版
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteNotifyTemplateList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得站内信模版
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.system.service.notify;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
@ -10,13 +11,13 @@ import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
|
|||
import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyTemplateMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -85,6 +86,27 @@ public class NotifyTemplateServiceImpl implements NotifyTemplateService {
|
|||
notifyTemplateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = RedisKeyConstants.NOTIFY_TEMPLATE,
|
||||
allEntries = true) // allEntries 清空所有缓存,因为 id 不是直接的缓存 code,不好清理
|
||||
public void deleteNotifyTemplateList(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateNotifyTemplatesExists(ids);
|
||||
// 批量删除
|
||||
notifyTemplateMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateNotifyTemplatesExists(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
List<NotifyTemplateDO> templates = notifyTemplateMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(templates) || templates.size() != ids.size()) {
|
||||
throw exception(NOTIFY_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateNotifyTemplateExists(Long id) {
|
||||
if (notifyTemplateMapper.selectById(id) == null) {
|
||||
throw exception(NOTIFY_TEMPLATE_NOT_EXISTS);
|
||||
|
|
|
@ -4,9 +4,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.system.controller.admin.oauth2.vo.client.OAuth2ClientPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.oauth2.vo.client.OAuth2ClientSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ClientDO;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OAuth2.0 Client Service 接口
|
||||
|
@ -39,6 +40,13 @@ public interface OAuth2ClientService {
|
|||
*/
|
||||
void deleteOAuth2Client(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除 OAuth2 客户端
|
||||
*
|
||||
* @param ids 编号数组
|
||||
*/
|
||||
void deleteOAuth2ClientList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得 OAuth2 客户端
|
||||
*
|
||||
|
|
|
@ -14,14 +14,15 @@ import cn.iocoder.yudao.module.system.dal.dataobject.oauth2.OAuth2ClientDO;
|
|||
import cn.iocoder.yudao.module.system.dal.mysql.oauth2.OAuth2ClientMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
@ -72,12 +73,32 @@ public class OAuth2ClientServiceImpl implements OAuth2ClientService {
|
|||
oauth2ClientMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = RedisKeyConstants.OAUTH_CLIENT,
|
||||
allEntries = true) // allEntries 清空所有缓存,因为 id 不是直接的缓存 key,不好清理
|
||||
public void deleteOAuth2ClientList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
validateOAuth2ClientBatchExists(ids);
|
||||
// 批量删除
|
||||
oauth2ClientMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateOAuth2ClientExists(Long id) {
|
||||
if (oauth2ClientMapper.selectById(id) == null) {
|
||||
throw exception(OAUTH2_CLIENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateOAuth2ClientBatchExists(List<Long> ids) {
|
||||
List<OAuth2ClientDO> clients = oauth2ClientMapper.selectByIds(ids);
|
||||
if (clients.size() != ids.size()) {
|
||||
throw exception(OAUTH2_CLIENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void validateClientIdExists(Long id, String clientId) {
|
||||
OAuth2ClientDO client = oauth2ClientMapper.selectByClientId(clientId);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package cn.iocoder.yudao.module.system.service.sms;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClient;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO;
|
||||
|
||||
import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClient;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -39,6 +39,13 @@ public interface SmsChannelService {
|
|||
*/
|
||||
void deleteSmsChannel(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除短信渠道
|
||||
*
|
||||
* @param ids 编号数组
|
||||
*/
|
||||
void deleteSmsChannelList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得短信渠道
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.system.service.sms;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO;
|
||||
|
@ -65,6 +66,23 @@ public class SmsChannelServiceImpl implements SmsChannelService {
|
|||
smsChannelMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSmsChannelList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
validateSmsChannelBatchExists(ids);
|
||||
// 校验是否有在使用该账号的模版
|
||||
for (Long id : ids) {
|
||||
if (smsTemplateService.getSmsTemplateCountByChannelId(id) > 0) {
|
||||
throw exception(SMS_CHANNEL_HAS_CHILDREN);
|
||||
}
|
||||
}
|
||||
// 批量删除
|
||||
smsChannelMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private SmsChannelDO validateSmsChannelExists(Long id) {
|
||||
SmsChannelDO channel = smsChannelMapper.selectById(id);
|
||||
if (channel == null) {
|
||||
|
@ -73,6 +91,13 @@ public class SmsChannelServiceImpl implements SmsChannelService {
|
|||
return channel;
|
||||
}
|
||||
|
||||
private void validateSmsChannelBatchExists(List<Long> ids) {
|
||||
List<SmsChannelDO> channels = smsChannelMapper.selectByIds(ids);
|
||||
if (channels.size() != ids.size()) {
|
||||
throw exception(SMS_CHANNEL_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsChannelDO getSmsChannel(Long id) {
|
||||
return smsChannelMapper.selectById(id);
|
||||
|
|
|
@ -4,8 +4,9 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +39,13 @@ public interface SmsTemplateService {
|
|||
*/
|
||||
void deleteSmsTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除短信模板
|
||||
*
|
||||
* @param ids 编号数组
|
||||
*/
|
||||
void deleteSmsTemplateList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得短信模板
|
||||
*
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.system.service.sms;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
|
@ -7,22 +8,22 @@ import cn.hutool.core.util.StrUtil;
|
|||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClient;
|
||||
import cn.iocoder.yudao.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import cn.iocoder.yudao.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.sms.SmsTemplateMapper;
|
||||
import cn.iocoder.yudao.module.system.dal.redis.RedisKeyConstants;
|
||||
import cn.iocoder.yudao.module.system.framework.sms.core.client.SmsClient;
|
||||
import cn.iocoder.yudao.module.system.framework.sms.core.client.dto.SmsTemplateRespDTO;
|
||||
import cn.iocoder.yudao.module.system.framework.sms.core.enums.SmsTemplateAuditStatusEnum;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
@ -100,12 +101,32 @@ public class SmsTemplateServiceImpl implements SmsTemplateService {
|
|||
smsTemplateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = RedisKeyConstants.SMS_TEMPLATE,
|
||||
allEntries = true) // allEntries 清空所有缓存,因为 id 不是直接的缓存 code,不好清理
|
||||
public void deleteSmsTemplateList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
validateSmsTemplateListExists(ids);
|
||||
// 批量删除
|
||||
smsTemplateMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateSmsTemplateExists(Long id) {
|
||||
if (smsTemplateMapper.selectById(id) == null) {
|
||||
throw exception(SMS_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateSmsTemplateListExists(List<Long> ids) {
|
||||
List<SmsTemplateDO> templates = smsTemplateMapper.selectByIds(ids);
|
||||
if (templates.size() != ids.size()) {
|
||||
throw exception(SMS_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SmsTemplateDO getSmsTemplate(Long id) {
|
||||
return smsTemplateMapper.selectById(id);
|
||||
|
|
|
@ -134,6 +134,13 @@ public interface SocialClientService {
|
|||
*/
|
||||
void deleteSocialClient(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除社交客户端
|
||||
*
|
||||
* @param ids 编号数组
|
||||
*/
|
||||
void deleteSocialClientList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得社交客户端
|
||||
*
|
||||
|
|
|
@ -466,12 +466,30 @@ public class SocialClientServiceImpl implements SocialClientService {
|
|||
socialClientMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSocialClientList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
validateSocialClientBatchExists(ids);
|
||||
// 批量删除
|
||||
socialClientMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateSocialClientExists(Long id) {
|
||||
if (socialClientMapper.selectById(id) == null) {
|
||||
throw exception(SOCIAL_CLIENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateSocialClientBatchExists(List<Long> ids) {
|
||||
List<SocialClientDO> clients = socialClientMapper.selectByIds(ids);
|
||||
if (clients.size() != ids.size()) {
|
||||
throw exception(SOCIAL_CLIENT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验社交应用是否重复,需要保证 userType + socialType 唯一
|
||||
* 原因是,不同端(userType)选择某个社交登录(socialType)时,需要通过 {@link #buildAuthRequest(Integer, Integer)} 构建对应的请求
|
||||
|
|
|
@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.TenantPackagePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.packages.TenantPackageSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -37,6 +37,13 @@ public interface TenantPackageService {
|
|||
*/
|
||||
void deleteTenantPackage(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除租户套餐
|
||||
*
|
||||
* @param ids 编号数组
|
||||
*/
|
||||
void deleteTenantPackageList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得租户套餐
|
||||
*
|
||||
|
|
|
@ -12,11 +12,11 @@ import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantPackageDO;
|
|||
import cn.iocoder.yudao.module.system.dal.mysql.tenant.TenantPackageMapper;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
@ -76,6 +76,19 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
|||
tenantPackageMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTenantPackageList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
ids.forEach(this::validateTenantPackageExists);
|
||||
// 校验正在使用
|
||||
validateTenantUsedBatch(ids);
|
||||
// 批量删除
|
||||
tenantPackageMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private TenantPackageDO validateTenantPackageExists(Long id) {
|
||||
TenantPackageDO tenantPackage = tenantPackageMapper.selectById(id);
|
||||
if (tenantPackage == null) {
|
||||
|
@ -90,6 +103,20 @@ public class TenantPackageServiceImpl implements TenantPackageService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验租户套餐是否被使用 - 批量
|
||||
*
|
||||
* @param ids 租户套餐编号数组
|
||||
*/
|
||||
private void validateTenantUsedBatch(List<Long> ids) {
|
||||
// 查询是否有租户正在使用该套餐
|
||||
for (Long id : ids) {
|
||||
if (tenantService.getTenantCountByPackageId(id) > 0) {
|
||||
throw exception(TENANT_PACKAGE_USED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantPackageDO getTenantPackage(Long id) {
|
||||
return tenantPackageMapper.selectById(id);
|
||||
|
|
|
@ -7,8 +7,8 @@ import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.tenant.TenantSa
|
|||
import cn.iocoder.yudao.module.system.dal.dataobject.tenant.TenantDO;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.handler.TenantInfoHandler;
|
||||
import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -49,6 +49,13 @@ public interface TenantService {
|
|||
*/
|
||||
void deleteTenant(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除租户
|
||||
*
|
||||
* @param ids 编号数组
|
||||
*/
|
||||
void deleteTenantList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得租户
|
||||
*
|
||||
|
|
|
@ -31,13 +31,13 @@ import cn.iocoder.yudao.module.system.service.tenant.handler.TenantInfoHandler;
|
|||
import cn.iocoder.yudao.module.system.service.tenant.handler.TenantMenuHandler;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
@ -225,6 +225,17 @@ public class TenantServiceImpl implements TenantService {
|
|||
tenantMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTenantList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 校验存在
|
||||
validateUpdateTenantBatch(ids);
|
||||
// 批量删除
|
||||
tenantMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private TenantDO validateUpdateTenant(Long id) {
|
||||
TenantDO tenant = tenantMapper.selectById(id);
|
||||
if (tenant == null) {
|
||||
|
@ -237,6 +248,26 @@ public class TenantServiceImpl implements TenantService {
|
|||
return tenant;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验租户是否可以更新 - 批量
|
||||
*
|
||||
* @param ids 租户编号数组
|
||||
*/
|
||||
private void validateUpdateTenantBatch(List<Long> ids) {
|
||||
// 查询租户
|
||||
List<TenantDO> tenants = tenantMapper.selectByIds(ids);
|
||||
if (tenants.size() != ids.size()) {
|
||||
throw exception(TENANT_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 校验是否有系统内置租户
|
||||
tenants.forEach(tenant -> {
|
||||
if (isSystemTenant(tenant)) {
|
||||
throw exception(TENANT_CAN_NOT_UPDATE_SYSTEM);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantDO getTenant(Long id) {
|
||||
return tenantMapper.selectById(id);
|
||||
|
|
|
@ -95,6 +95,13 @@ public interface AdminUserService {
|
|||
*/
|
||||
void deleteUser(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
*
|
||||
* @param ids 用户编号数组
|
||||
*/
|
||||
void deleteUserList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
|
|
|
@ -248,6 +248,28 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||
LogRecordContext.putVariable("user", user);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteUserList(List<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
// 1. 校验用户存在
|
||||
List<AdminUserDO> users = userMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(users)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. 批量删除用户
|
||||
userMapper.deleteByIds(ids);
|
||||
|
||||
// 3. 批量删除用户关联数据
|
||||
ids.forEach(id -> {
|
||||
permissionService.processUserDeleted(id);
|
||||
userPostMapper.deleteByUserId(id);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminUserDO getUserByUsername(String username) {
|
||||
return userMapper.selectByUsername(username);
|
||||
|
|
Loading…
Reference in New Issue