Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro
# Conflicts: # pom.xml # sql/oracle/ruoyi-vue-pro.sql # sql/sqlserver/ruoyi-vue-pro.sql # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTemplateController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notice/NoticeController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oauth2/OAuth2ClientController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/oauth2/OAuth2TokenController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsChannelController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsTemplateController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/socail/SocialClientController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantPackageController.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountServiceImpl.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTemplateService.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTemplateServiceImpl.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/notice/NoticeServiceImpl.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateService.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateServiceImpl.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/oauth2/OAuth2ClientService.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/oauth2/OAuth2ClientServiceImpl.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelService.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateService.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImpl.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantPackageService.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantPackageServiceImpl.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java # yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java
This commit is contained in:
@@ -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 javax.annotation.Resource;
|
||||
import javax.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 javax.annotation.Resource;
|
||||
import javax.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 javax.annotation.Resource;
|
||||
import javax.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 javax.annotation.Resource;
|
||||
import javax.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 javax.annotation.Resource;
|
||||
import javax.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")
|
||||
|
@@ -119,23 +119,15 @@ public class OAuth2OpenController {
|
||||
grantType, scopes, redirectUri);
|
||||
|
||||
// 2. 根据授权模式,获取访问令牌
|
||||
OAuth2AccessTokenDO accessTokenDO;
|
||||
switch (grantTypeEnum) {
|
||||
case AUTHORIZATION_CODE:
|
||||
accessTokenDO = oauth2GrantService.grantAuthorizationCodeForAccessToken(client.getClientId(), code, redirectUri, state);
|
||||
break;
|
||||
case PASSWORD:
|
||||
accessTokenDO = oauth2GrantService.grantPassword(username, password, client.getClientId(), scopes);
|
||||
break;
|
||||
case CLIENT_CREDENTIALS:
|
||||
accessTokenDO = oauth2GrantService.grantClientCredentials(client.getClientId(), scopes);
|
||||
break;
|
||||
case REFRESH_TOKEN:
|
||||
accessTokenDO = oauth2GrantService.grantRefreshToken(refreshToken, client.getClientId());
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("未知授权类型:" + grantType);
|
||||
}
|
||||
OAuth2AccessTokenDO accessTokenDO = switch (grantTypeEnum) {
|
||||
// TODO @xingyu:这里改了,可能会影响 jdk8 版本哈;
|
||||
case AUTHORIZATION_CODE ->
|
||||
oauth2GrantService.grantAuthorizationCodeForAccessToken(client.getClientId(), code, redirectUri, state);
|
||||
case PASSWORD -> oauth2GrantService.grantPassword(username, password, client.getClientId(), scopes);
|
||||
case CLIENT_CREDENTIALS -> oauth2GrantService.grantClientCredentials(client.getClientId(), scopes);
|
||||
case REFRESH_TOKEN -> oauth2GrantService.grantRefreshToken(refreshToken, client.getClientId());
|
||||
default -> throw new IllegalArgumentException("未知授权类型:" + grantType);
|
||||
};
|
||||
Assert.notNull(accessTokenDO, "访问令牌不能为空"); // 防御性检查
|
||||
return success(OAuth2OpenConvert.INSTANCE.convert(accessTokenDO));
|
||||
}
|
||||
|
@@ -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 javax.annotation.Resource;
|
||||
import javax.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 javax.annotation.Resource;
|
||||
import javax.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 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 javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
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")
|
||||
|
@@ -13,12 +13,13 @@ import cn.iocoder.yudao.module.system.service.social.SocialClientService;
|
||||
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 javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@@ -57,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 javax.annotation.Resource;
|
||||
import javax.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')")
|
||||
|
@@ -159,7 +159,7 @@ public class DeptServiceImpl implements DeptService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return deptMapper.selectBatchIds(ids);
|
||||
return deptMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -113,7 +113,7 @@ public class PostServiceImpl implements PostService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return postMapper.selectBatchIds(ids);
|
||||
return postMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,7 +137,7 @@ public class PostServiceImpl implements PostService {
|
||||
return;
|
||||
}
|
||||
// 获得岗位信息
|
||||
List<PostDO> posts = postMapper.selectBatchIds(ids);
|
||||
List<PostDO> posts = postMapper.selectByIds(ids);
|
||||
Map<Long, PostDO> postMap = convertMap(posts, PostDO::getId);
|
||||
// 校验
|
||||
ids.forEach(id -> {
|
||||
|
@@ -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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -38,6 +38,13 @@ public interface MailAccountService {
|
||||
*/
|
||||
void deleteMailAccount(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除邮箱账号
|
||||
*
|
||||
* @param ids 编号列表
|
||||
*/
|
||||
void deleteMailAccountList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取邮箱账号信息
|
||||
*
|
||||
|
@@ -7,13 +7,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 javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -69,6 +69,21 @@ public class MailAccountServiceImpl implements MailAccountService {
|
||||
mailAccountMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(value = RedisKeyConstants.MAIL_ACCOUNT,
|
||||
allEntries = true) // allEntries 清空所有缓存,因为 Spring Cache 不支持按照 ids 批量删除
|
||||
public void deleteMailAccountList(List<Long> ids) {
|
||||
// 1. 校验是否存在关联模版
|
||||
for (Long id : ids) {
|
||||
if (mailTemplateService.getMailTemplateCountByAccountId(id) > 0) {
|
||||
throw exception(MAIL_ACCOUNT_RELATE_TEMPLATE_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 批量删除
|
||||
mailAccountMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateMailAccountExists(Long id) {
|
||||
if (mailAccountMapper.selectById(id) == null) {
|
||||
throw exception(MAIL_ACCOUNT_NOT_EXISTS);
|
||||
|
@@ -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 javax.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);
|
||||
|
||||
/**
|
||||
* 获取邮件模版
|
||||
*
|
||||
|
@@ -11,14 +11,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 javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -97,6 +97,13 @@ 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) {
|
||||
mailTemplateMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateMailTemplateExists(Long id) {
|
||||
if (mailTemplateMapper.selectById(id) == null) {
|
||||
throw exception(MAIL_TEMPLATE_NOT_EXISTS);
|
||||
@@ -125,14 +132,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);
|
||||
|
||||
/**
|
||||
* 获得通知公告分页列表
|
||||
*
|
||||
|
@@ -7,9 +7,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 javax.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 +50,11 @@ public class NoticeServiceImpl implements NoticeService {
|
||||
noticeMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteNoticeList(List<Long> ids) {
|
||||
noticeMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<NoticeDO> getNoticePage(NoticePageReqVO reqVO) {
|
||||
return noticeMapper.selectPage(reqVO);
|
||||
|
@@ -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 javax.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);
|
||||
|
||||
/**
|
||||
* 获得站内信模版
|
||||
*
|
||||
|
@@ -10,13 +10,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 javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -85,6 +85,13 @@ 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) {
|
||||
notifyTemplateMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
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 javax.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 javax.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,6 +73,13 @@ 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) {
|
||||
oauth2ClientMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateOAuth2ClientExists(Long id) {
|
||||
if (oauth2ClientMapper.selectById(id) == null) {
|
||||
throw exception(OAUTH2_CLIENT_NOT_EXISTS);
|
||||
|
@@ -187,7 +187,7 @@ public class MenuServiceImpl implements MenuService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return menuMapper.selectBatchIds(ids);
|
||||
return menuMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -200,7 +200,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return roleMapper.selectBatchIds(ids);
|
||||
return roleMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -236,7 +236,7 @@ public class RoleServiceImpl implements RoleService {
|
||||
return;
|
||||
}
|
||||
// 获得角色信息
|
||||
List<RoleDO> roles = roleMapper.selectBatchIds(ids);
|
||||
List<RoleDO> roles = roleMapper.selectByIds(ids);
|
||||
Map<Long, RoleDO> roleMap = convertMap(roles, RoleDO::getId);
|
||||
// 校验
|
||||
ids.forEach(id -> {
|
||||
|
@@ -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 javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -39,6 +39,13 @@ public interface SmsChannelService {
|
||||
*/
|
||||
void deleteSmsChannel(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除短信渠道
|
||||
*
|
||||
* @param ids 编号数组
|
||||
*/
|
||||
void deleteSmsChannelList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得短信渠道
|
||||
*
|
||||
|
@@ -65,6 +65,19 @@ public class SmsChannelServiceImpl implements SmsChannelService {
|
||||
smsChannelMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSmsChannelList(List<Long> ids) {
|
||||
// 1. 校验是否有在使用该账号的模版
|
||||
ids.forEach(id -> {
|
||||
if (smsTemplateService.getSmsTemplateCountByChannelId(id) > 0) {
|
||||
throw exception(SMS_CHANNEL_HAS_CHILDREN);
|
||||
}
|
||||
});
|
||||
|
||||
// 2. 批量删除
|
||||
smsChannelMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private SmsChannelDO validateSmsChannelExists(Long id) {
|
||||
SmsChannelDO channel = smsChannelMapper.selectById(id);
|
||||
if (channel == null) {
|
||||
|
@@ -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 javax.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);
|
||||
|
||||
/**
|
||||
* 获得短信模板
|
||||
*
|
||||
|
@@ -7,22 +7,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 javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -100,6 +100,13 @@ 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) {
|
||||
smsTemplateMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateSmsTemplateExists(Long id) {
|
||||
if (smsTemplateMapper.selectById(id) == null) {
|
||||
throw exception(SMS_TEMPLATE_NOT_EXISTS);
|
||||
|
@@ -134,6 +134,13 @@ public interface SocialClientService {
|
||||
*/
|
||||
void deleteSocialClient(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除社交客户端
|
||||
*
|
||||
* @param ids 编号数组
|
||||
*/
|
||||
void deleteSocialClientList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得社交客户端
|
||||
*
|
||||
|
@@ -264,9 +264,9 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
public WxMaPhoneNumberInfo getWxMaPhoneNumberInfo(Integer userType, String phoneCode) {
|
||||
WxMaService service = getWxMaService(userType);
|
||||
try {
|
||||
return service.getUserService().getPhoneNoInfo(phoneCode);
|
||||
return service.getUserService().getPhoneNumber(phoneCode);
|
||||
} catch (WxErrorException e) {
|
||||
log.error("[getPhoneNoInfo][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e);
|
||||
log.error("[getPhoneNumber][userType({}) phoneCode({}) 获得手机号失败]", userType, phoneCode, e);
|
||||
throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_PHONE_CODE_ERROR);
|
||||
}
|
||||
}
|
||||
@@ -468,6 +468,11 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
socialClientMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSocialClientList(List<Long> ids) {
|
||||
socialClientMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validateSocialClientExists(Long id) {
|
||||
if (socialClientMapper.selectById(id) == null) {
|
||||
throw exception(SOCIAL_CLIENT_NOT_EXISTS);
|
||||
@@ -476,7 +481,6 @@ public class SocialClientServiceImpl implements SocialClientService {
|
||||
|
||||
/**
|
||||
* 校验社交应用是否重复,需要保证 userType + socialType 唯一
|
||||
*
|
||||
* 原因是,不同端(userType)选择某个社交登录(socialType)时,需要通过 {@link #buildAuthRequest(Integer, Integer)} 构建对应的请求
|
||||
*
|
||||
* @param id 编号
|
||||
|
@@ -54,7 +54,7 @@ public class SocialUserServiceImpl implements SocialUserService {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
// 获得社交用户
|
||||
return socialUserMapper.selectBatchIds(convertSet(socialUserBinds, SocialUserBindDO::getSocialUserId));
|
||||
return socialUserMapper.selectByIds(convertSet(socialUserBinds, SocialUserBindDO::getSocialUserId));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -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 javax.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 javax.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) {
|
||||
// 1. 校验是否有租户正在使用该套餐
|
||||
for (Long id : ids) {
|
||||
if (tenantService.getTenantCountByPackageId(id) > 0) {
|
||||
throw exception(TENANT_PACKAGE_USED);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 批量删除
|
||||
tenantPackageMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private TenantPackageDO validateTenantPackageExists(Long id) {
|
||||
TenantPackageDO tenantPackage = tenantPackageMapper.selectById(id);
|
||||
if (tenantPackage == null) {
|
||||
|
@@ -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 javax.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 javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@@ -225,6 +225,15 @@ public class TenantServiceImpl implements TenantService {
|
||||
tenantMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTenantList(List<Long> ids) {
|
||||
// 1. 校验存在
|
||||
ids.forEach(this::validateUpdateTenant);
|
||||
|
||||
// 2. 批量删除
|
||||
tenantMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private TenantDO validateUpdateTenant(Long id) {
|
||||
TenantDO tenant = tenantMapper.selectById(id);
|
||||
if (tenant == null) {
|
||||
|
@@ -95,6 +95,13 @@ public interface AdminUserService {
|
||||
*/
|
||||
void deleteUser(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户
|
||||
*
|
||||
* @param ids 用户编号数组
|
||||
*/
|
||||
void deleteUserList(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
|
@@ -248,6 +248,19 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
LogRecordContext.putVariable("user", user);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteUserList(List<Long> ids) {
|
||||
// 1. 批量删除用户
|
||||
userMapper.deleteByIds(ids);
|
||||
|
||||
// 2. 批量删除用户关联数据
|
||||
ids.forEach(id -> {
|
||||
permissionService.processUserDeleted(id);
|
||||
userPostMapper.deleteByUserId(id);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminUserDO getUserByUsername(String username) {
|
||||
return userMapper.selectByUsername(username);
|
||||
@@ -290,7 +303,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return userMapper.selectBatchIds(userIds);
|
||||
return userMapper.selectByIds(userIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -298,7 +311,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return userMapper.selectBatchIds(ids);
|
||||
return userMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -307,7 +320,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
return;
|
||||
}
|
||||
// 获得岗位信息
|
||||
List<AdminUserDO> users = userMapper.selectBatchIds(ids);
|
||||
List<AdminUserDO> users = userMapper.selectByIds(ids);
|
||||
Map<Long, AdminUserDO> userMap = CollectionUtils.convertMap(users, AdminUserDO::getId);
|
||||
// 校验
|
||||
ids.forEach(id -> {
|
||||
|
@@ -275,7 +275,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest {
|
||||
WxMaUserService userService = mock(WxMaUserService.class);
|
||||
when(wxMaService.getUserService()).thenReturn(userService);
|
||||
WxMaPhoneNumberInfo phoneNumber = randomPojo(WxMaPhoneNumberInfo.class);
|
||||
when(userService.getPhoneNoInfo(eq(phoneCode))).thenReturn(phoneNumber);
|
||||
when(userService.getPhoneNumber(eq(phoneCode))).thenReturn(phoneNumber);
|
||||
|
||||
// 调用
|
||||
WxMaPhoneNumberInfo result = socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode);
|
||||
@@ -292,7 +292,7 @@ public class SocialClientServiceImplTest extends BaseDbUnitTest {
|
||||
WxMaUserService userService = mock(WxMaUserService.class);
|
||||
when(wxMaService.getUserService()).thenReturn(userService);
|
||||
WxErrorException wxErrorException = new WxErrorException(new NullPointerException());
|
||||
when(userService.getPhoneNoInfo(eq(phoneCode))).thenThrow(wxErrorException);
|
||||
when(userService.getPhoneNumber(eq(phoneCode))).thenThrow(wxErrorException);
|
||||
|
||||
// 调用并断言异常
|
||||
assertServiceException(() -> socialClientService.getWxMaPhoneNumberInfo(userType, phoneCode),
|
||||
|
Reference in New Issue
Block a user