feat(新增): 用户配置邮箱和用户配置模板
This commit is contained in:
parent
04a88305de
commit
413365dfd1
|
@ -3,11 +3,11 @@ package cn.bunny.common.generator.generator;
|
|||
import cn.bunny.common.generator.entity.BaseField;
|
||||
import cn.bunny.common.generator.entity.BaseResultMap;
|
||||
import cn.bunny.common.generator.utils.GeneratorCodeUtils;
|
||||
import cn.bunny.dao.dto.system.files.FilesAddDto;
|
||||
import cn.bunny.dao.dto.system.files.FilesDto;
|
||||
import cn.bunny.dao.dto.system.files.FilesUpdateDto;
|
||||
import cn.bunny.dao.entity.system.Files;
|
||||
import cn.bunny.dao.vo.system.files.FilesVo;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateAddDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateUpdateDto;
|
||||
import cn.bunny.dao.entity.system.EmailTemplate;
|
||||
import cn.bunny.dao.vo.system.email.EmailTemplateVo;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.google.common.base.CaseFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
@ -51,11 +51,11 @@ public class WebGeneratorCode {
|
|||
public static String resourceMapperPath = "D:\\MyFolder\\auth-admin\\auth-server-java\\service\\src\\main\\resources\\mapper\\";
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Class<?> originalClass = Files.class;
|
||||
Class<?> dtoClass = FilesDto.class;
|
||||
Class<?> addDtoClass = FilesAddDto.class;
|
||||
Class<?> updateDtoClass = FilesUpdateDto.class;
|
||||
Class<?> voClass = FilesVo.class;
|
||||
Class<?> originalClass = EmailTemplate.class;
|
||||
Class<?> dtoClass = EmailTemplateDto.class;
|
||||
Class<?> addDtoClass = EmailTemplateAddDto.class;
|
||||
Class<?> updateDtoClass = EmailTemplateUpdateDto.class;
|
||||
Class<?> voClass = EmailTemplateVo.class;
|
||||
|
||||
// 设置velocity资源加载器
|
||||
Properties prop = new Properties();
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
<!-- 分页查询${classTitle}内容 -->
|
||||
<select id="selectListByPage" resultType="$type">
|
||||
select <include refid="Base_Column_List"/>
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from $tableName
|
||||
<where>
|
||||
#foreach($field in $pageQueryMap)
|
||||
|
@ -25,7 +26,7 @@
|
|||
</if>
|
||||
#end
|
||||
</where>
|
||||
order by update_time
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<!-- 物理删除${classTitle} -->
|
||||
|
|
|
@ -4,7 +4,7 @@ import { $t } from '@/plugins/i18n';
|
|||
// 表格列
|
||||
export const columns: TableColumnList = [
|
||||
{ type: 'selection', align: 'left' },
|
||||
{ type: 'index', index: (index: number) => index + 1 },
|
||||
{ type: 'index', index: (index: number) => index + 1, label: '序号', width: 60 },
|
||||
{ label: $t('id'), prop: 'id' },
|
||||
#foreach($field in $baseFieldList)
|
||||
// $field.annotation
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.i18n;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -16,14 +17,17 @@ public class I18nAddDto {
|
|||
|
||||
@Schema(name = "keyName", title = "多语言key")
|
||||
@NotBlank(message = "多语言key不能为空")
|
||||
@NotNull(message = "多语言key不能为空")
|
||||
private String keyName;
|
||||
|
||||
@Schema(name = "translation", title = "多语言翻译名称")
|
||||
@NotBlank(message = "多语言翻译名称不能为空")
|
||||
@NotNull(message = "多语言翻译名称不能为空")
|
||||
private String translation;
|
||||
|
||||
@Schema(name = "typeName", title = "多语言类型名称")
|
||||
@NotBlank(message = "多语言类型名称不能为空")
|
||||
@NotNull(message = "多语言类型名称不能为空")
|
||||
private String typeName;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.i18n;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -16,10 +17,11 @@ public class I18nTypeAddDto {
|
|||
|
||||
@Schema(name = "typeName", title = "多语言类型(比如zh,en)")
|
||||
@NotBlank(message = "多语言类型不能为空")
|
||||
@NotNull(message = "多语言类型不能为空")
|
||||
private String typeName;
|
||||
|
||||
@Schema(name = "summary", title = "名称解释(比如中文,英文)")
|
||||
@NotBlank(message = "名称解释不能为空")
|
||||
@NotNull(message = "名称解释不能为空")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "isDefault", title = "是否为默认")
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.i18n;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -15,15 +16,17 @@ import lombok.NoArgsConstructor;
|
|||
public class I18nTypeUpdateDto {
|
||||
|
||||
@Schema(name = "id", title = "主键")
|
||||
@NotBlank(message = "id不能为空")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "typeName", title = "多语言类型(比如zh,en)")
|
||||
@NotBlank(message = "多语言类型不能为空")
|
||||
@NotNull(message = "多语言类型不能为空")
|
||||
private String typeName;
|
||||
|
||||
@Schema(name = "summary", title = "名称解释(比如中文,英文)")
|
||||
@NotBlank(message = "名称解释不能为空")
|
||||
@NotNull(message = "名称解释不能为空")
|
||||
private String summary;
|
||||
|
||||
@Schema(name = "isDefault", title = "是否为默认")
|
||||
|
|
|
@ -21,10 +21,12 @@ public class I18nUpdateDto {
|
|||
|
||||
@Schema(name = "keyName", title = "多语言key")
|
||||
@NotBlank(message = "多语言key不能为空")
|
||||
@NotNull(message = "多语言key不能为空")
|
||||
private String keyName;
|
||||
|
||||
@Schema(name = "translation", title = "多语言翻译名称")
|
||||
@NotBlank(message = "多语言翻译名称不能为空")
|
||||
@NotNull(message = "多语言翻译名称不能为空")
|
||||
private String translation;
|
||||
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.dept;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -22,10 +23,12 @@ public class DeptAddDto {
|
|||
|
||||
@Schema(name = "managerId", title = "管理者")
|
||||
@NotNull(message = "管理者不能为空")
|
||||
@NotEmpty(message = "管理者不能为空")
|
||||
private List<String> manager;
|
||||
|
||||
@Schema(name = "deptName", title = "部门名称")
|
||||
@NotBlank(message = "部门名称不能为空")
|
||||
@NotNull(message = "部门名称不能为空")
|
||||
private String deptName;
|
||||
|
||||
@Schema(name = "summary", title = "部门简介")
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.dept;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -26,10 +27,12 @@ public class DeptUpdateDto {
|
|||
|
||||
@Schema(name = "managerId", title = "管理者")
|
||||
@NotNull(message = "管理者不能为空")
|
||||
@NotEmpty(message = "管理者不能为空")
|
||||
private List<String> manager;
|
||||
|
||||
@Schema(name = "deptName", title = "部门名称")
|
||||
@NotBlank(message = "部门名称不能为空")
|
||||
@NotNull(message = "部门名称不能为空")
|
||||
private String deptName;
|
||||
|
||||
@Schema(name = "summary", title = "部门简介")
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package cn.bunny.dao.dto.system.email;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "EmailTemplateAddDto对象", title = "邮箱模板请求内容", description = "邮箱模板请求内容")
|
||||
public class EmailTemplateAddDto {
|
||||
|
||||
@Schema(name = "templateName", title = "模板名称")
|
||||
@NotBlank(message = "模板名称不能为空")
|
||||
@NotNull(message = "模板名称不能为空")
|
||||
private String templateName;
|
||||
|
||||
@Schema(name = "subject", title = "主题")
|
||||
@NotBlank(message = "主题不能为空")
|
||||
@NotNull(message = "主题不能为空")
|
||||
private String subject;
|
||||
|
||||
@Schema(name = "body", title = "邮件内容")
|
||||
@NotBlank(message = "邮件内容不能为空")
|
||||
@NotNull(message = "邮件内容不能为空")
|
||||
private String body;
|
||||
|
||||
@Schema(name = "type", title = "邮件类型")
|
||||
private String type;
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package cn.bunny.dao.dto.system.email;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -15,17 +14,15 @@ import lombok.NoArgsConstructor;
|
|||
public class EmailTemplateDto {
|
||||
|
||||
@Schema(name = "templateName", title = "模板名称")
|
||||
@NotBlank(message = "模板名称不能为空")
|
||||
private String templateName;
|
||||
|
||||
@Schema(name = "subject", title = "主题")
|
||||
@NotBlank(message = "主题不能为空")
|
||||
private String subject;
|
||||
|
||||
@Schema(name = "body", title = "邮件内容")
|
||||
@NotBlank(message = "邮件内容不能为空")
|
||||
private String body;
|
||||
|
||||
@Schema(name = "type", title = "邮件类型")
|
||||
private String type;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package cn.bunny.dao.dto.system.email;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "EmailTemplateUpdateDto对象", title = "邮箱模板请求内容", description = "邮箱模板请求内容")
|
||||
public class EmailTemplateUpdateDto {
|
||||
|
||||
@Schema(name = "id", title = "主键")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "templateName", title = "模板名称")
|
||||
@NotBlank(message = "模板名称不能为空")
|
||||
@NotNull(message = "模板名称不能为空")
|
||||
private String templateName;
|
||||
|
||||
@Schema(name = "subject", title = "主题")
|
||||
@NotBlank(message = "主题不能为空")
|
||||
@NotNull(message = "主题不能为空")
|
||||
private String subject;
|
||||
|
||||
@Schema(name = "body", title = "邮件内容")
|
||||
@NotBlank(message = "邮件内容不能为空")
|
||||
@NotNull(message = "邮件内容不能为空")
|
||||
private String body;
|
||||
|
||||
@Schema(name = "type", title = "邮件类型")
|
||||
private String type;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package cn.bunny.dao.dto.system.email;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "EmailUsersAddDto对象", title = "邮箱用户发送配置", description = "邮箱用户发送配置管理")
|
||||
public class EmailUsersAddDto {
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
@NotNull(message = "邮箱不能为空")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "emailTemplate", title = "邮件模板")
|
||||
private Long emailTemplate;
|
||||
|
||||
@Schema(name = "password", title = "密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@NotNull(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
@Schema(name = "host", title = "Host地址")
|
||||
@NotBlank(message = "Host地址不能为空")
|
||||
@NotNull(message = "Host地址不能为空")
|
||||
private String host;
|
||||
|
||||
@Schema(name = "port", title = "端口号")
|
||||
@NotNull(message = "端口号不能为空")
|
||||
private Integer port;
|
||||
|
||||
@Schema(name = "smtpAgreement", title = "邮箱协议")
|
||||
private String smtpAgreement;
|
||||
|
||||
@Schema(name = "isDefault", title = "是否为默认邮件")
|
||||
private Boolean isDefault = false;
|
||||
|
||||
}
|
|
@ -1,45 +1,33 @@
|
|||
package cn.bunny.dao.dto.system.email;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 添加邮箱用户
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "EmailUsersDto", title = "邮箱用户发送基础内容", description = "邮箱用户发送基础内容")
|
||||
@Schema(name = "EmailUsersDto对象", title = "邮箱用户发送配置", description = "邮箱用户发送配置管理")
|
||||
public class EmailUsersDto {
|
||||
|
||||
@Schema(name = "id", title = "主键")
|
||||
@NotBlank(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "password", title = "密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
private String password;
|
||||
@Schema(name = "emailTemplate", title = "使用邮件模板")
|
||||
private Long emailTemplate;
|
||||
|
||||
@Schema(name = "host", title = "SMTP服务器")
|
||||
@Schema(name = "host", title = "Host地址")
|
||||
private String host;
|
||||
|
||||
@Schema(name = "port", title = "端口号")
|
||||
@NotNull(message = "端口号不能为空")
|
||||
private Integer port;
|
||||
|
||||
@Schema(name = "smtpAgreement", title = "邮箱协议")
|
||||
private Integer smtpAgreement;
|
||||
private String smtpAgreement;
|
||||
|
||||
@Schema(name = "isDefault", title = "是否为默认邮件")
|
||||
private Boolean isDefault;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
package cn.bunny.dao.dto.system.email;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "EmailUsersUpdateDto对象", title = "邮箱用户发送配置", description = "邮箱用户发送配置管理")
|
||||
public class EmailUsersUpdateDto {
|
||||
|
||||
@Schema(name = "id", title = "主键")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
@NotNull(message = "邮箱不能为空")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "emailTemplate", title = "邮件模板")
|
||||
private Long emailTemplate;
|
||||
|
||||
@Schema(name = "password", title = "密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@NotNull(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
@Schema(name = "host", title = "Host地址")
|
||||
@NotBlank(message = "Host地址不能为空")
|
||||
@NotNull(message = "Host地址不能为空")
|
||||
private String host;
|
||||
|
||||
@Schema(name = "port", title = "端口号")
|
||||
@NotNull(message = "端口号不能为空")
|
||||
private Integer port;
|
||||
|
||||
@Schema(name = "smtpAgreement", title = "邮箱协议")
|
||||
private String smtpAgreement;
|
||||
|
||||
@Schema(name = "isDefault", title = "是否为默认邮件")
|
||||
private Boolean isDefault;
|
||||
|
||||
}
|
|
@ -18,10 +18,11 @@ public class FileUploadDto {
|
|||
|
||||
@Schema(name = "file", title = "文件")
|
||||
@NotNull(message = "文件不能为空")
|
||||
MultipartFile file;
|
||||
private MultipartFile file;
|
||||
|
||||
@Schema(name = "type", title = "文件类型")
|
||||
@NotBlank(message = "文件类型不能为空")
|
||||
String type;
|
||||
@NotNull(message = "文件类型不能为空")
|
||||
private String type;
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.files;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -16,14 +17,17 @@ public class FilesAddDto {
|
|||
|
||||
@Schema(name = "filename", title = "文件的名称")
|
||||
@NotBlank(message = "文件的名称不能为空")
|
||||
@NotNull(message = "文件的名称不能为空")
|
||||
private String filename;
|
||||
|
||||
@Schema(name = "filepath", title = "文件在服务器上的存储路径")
|
||||
@NotBlank(message = "存储路径不能为空")
|
||||
@NotNull(message = "存储路径不能为空")
|
||||
private String filepath;
|
||||
|
||||
@Schema(name = "fileType", title = "文件的MIME类型")
|
||||
@NotBlank(message = "文件类型不能为空")
|
||||
@NotNull(message = "文件类型不能为空")
|
||||
private String fileType;
|
||||
|
||||
@Schema(name = "downloadCount", title = "下载数量")
|
||||
|
|
|
@ -21,14 +21,17 @@ public class FilesUpdateDto {
|
|||
|
||||
@Schema(name = "filename", title = "文件的名称")
|
||||
@NotBlank(message = "文件的名称不能为空")
|
||||
@NotNull(message = "文件的名称不能为空")
|
||||
private String filename;
|
||||
|
||||
@Schema(name = "filepath", title = "文件在服务器上的存储路径")
|
||||
@NotBlank(message = "存储路径不能为空")
|
||||
@NotNull(message = "存储路径不能为空")
|
||||
private String filepath;
|
||||
|
||||
@Schema(name = "fileType", title = "文件的MIME类型")
|
||||
@NotBlank(message = "文件类型不能为空")
|
||||
@NotNull(message = "文件类型不能为空")
|
||||
private String fileType;
|
||||
|
||||
@Schema(name = "downloadCount", title = "下载数量")
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.menuIcon;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -16,10 +17,12 @@ public class MenuIconAddDto {
|
|||
|
||||
@Schema(name = "iconCode", title = "icon类名")
|
||||
@NotBlank(message = "iconCode不能为空")
|
||||
@NotNull(message = "iconCode不能为空")
|
||||
private String iconCode;
|
||||
|
||||
@Schema(name = "iconName", title = "icon 名称")
|
||||
@NotBlank(message = "icon 名称不能为空")
|
||||
@NotNull(message = "icon 名称不能为空")
|
||||
private String iconName;
|
||||
|
||||
}
|
||||
|
|
|
@ -21,10 +21,12 @@ public class MenuIconUpdateDto {
|
|||
|
||||
@Schema(name = "iconCode", title = "icon类名")
|
||||
@NotBlank(message = "iconCode不能为空")
|
||||
@NotNull(message = "iconCode不能为空")
|
||||
private String iconCode;
|
||||
|
||||
@Schema(name = "iconName", title = "icon 名称")
|
||||
@NotBlank(message = "icon 名称不能为空")
|
||||
@NotNull(message = "icon 名称不能为空")
|
||||
private String iconName;
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package cn.bunny.dao.dto.system.rolePower;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -22,6 +23,7 @@ public class AssignPowersToRoleDto {
|
|||
|
||||
@Schema(name = "powerIds", title = "权限id列表")
|
||||
@NotNull(message = "权限id列表不能为空")
|
||||
@NotEmpty(message = "权限id列表不能为空")
|
||||
private List<Long> powerIds;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.rolePower;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -19,10 +20,12 @@ public class PowerAddDto {
|
|||
|
||||
@Schema(name = "parentId", title = "权限编码")
|
||||
@NotBlank(message = "权限编码 不能为空")
|
||||
@NotNull(message = "权限编码 不能为空")
|
||||
private String powerCode;
|
||||
|
||||
@Schema(name = "powerName", title = "权限名称")
|
||||
@NotBlank(message = "权限名称 不能为空")
|
||||
@NotNull(message = "权限名称 不能为空")
|
||||
private String powerName;
|
||||
|
||||
@Schema(name = "requestUrl", title = "请求路径")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package cn.bunny.dao.dto.system.rolePower;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -18,6 +19,7 @@ public class PowerUpdateBatchByParentIdDto {
|
|||
|
||||
@Schema(name = "id", title = "主键")
|
||||
@NotNull(message = "id不能为空")
|
||||
@NotEmpty(message = "id不能为空")
|
||||
private List<Long> ids;
|
||||
|
||||
@Schema(name = "parentId", title = "父级id")
|
||||
|
|
|
@ -24,10 +24,12 @@ public class PowerUpdateDto {
|
|||
|
||||
@Schema(name = "parentId", title = "权限编码")
|
||||
@NotBlank(message = "权限编码 不能为空")
|
||||
@NotNull(message = "权限编码 不能为空")
|
||||
private String powerCode;
|
||||
|
||||
@Schema(name = "powerName", title = "权限名称")
|
||||
@NotBlank(message = "权限名称 不能为空")
|
||||
@NotNull(message = "权限名称 不能为空")
|
||||
private String powerName;
|
||||
|
||||
@Schema(name = "requestUrl", title = "请求路径")
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.rolePower;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -16,10 +17,12 @@ public class RoleAddDto {
|
|||
|
||||
@Schema(name = "roleCode", title = "角色代码")
|
||||
@NotBlank(message = "roleCode 不能为空")
|
||||
@NotNull(message = "roleCode 不能为空")
|
||||
private String roleCode;
|
||||
|
||||
@Schema(name = "description", title = "描述")
|
||||
@NotBlank(message = "description 不能为空")
|
||||
@NotNull(message = "description 不能为空")
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
|
|
@ -21,10 +21,12 @@ public class RoleUpdateDto {
|
|||
|
||||
@Schema(name = "roleCode", title = "角色代码")
|
||||
@NotBlank(message = "roleCode 不能为空")
|
||||
@NotNull(message = "roleCode 不能为空")
|
||||
private String roleCode;
|
||||
|
||||
@Schema(name = "description", title = "描述")
|
||||
@NotBlank(message = "description 不能为空")
|
||||
@NotNull(message = "description 不能为空")
|
||||
private String description;
|
||||
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package cn.bunny.dao.dto.system.router;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -22,6 +23,7 @@ public class AssignRolesToRoutersDto {
|
|||
|
||||
@Schema(name = "roleIds", title = "角色id列表")
|
||||
@NotNull(message = "角色id列表不能为空")
|
||||
@NotEmpty(message = "角色id列表不能为空")
|
||||
private List<Long> roleIds;
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package cn.bunny.dao.dto.system.router;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
@ -17,59 +16,44 @@ import lombok.NoArgsConstructor;
|
|||
@Schema(name = "RouterManageDto对象", title = "路由添加表单", description = "路由添加表单")
|
||||
public class RouterAddDto {
|
||||
|
||||
@ApiModelProperty("菜单类型")
|
||||
@Schema(name = "menuType", title = "菜单类型")
|
||||
@NotNull(message = "菜单类型不能为空")
|
||||
private Integer menuType;
|
||||
|
||||
@ApiModelProperty("父级id")
|
||||
@Schema(name = "parentId", title = "父级id")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty("菜单名称")
|
||||
@Schema(name = "title", title = "路由title")
|
||||
@NotNull(message = "菜单名称不能为空")
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("路由名称")
|
||||
@NotBlank(message = "路由名称不能为空")
|
||||
@Schema(name = "routeName", title = "路由名称")
|
||||
@JsonProperty("name")
|
||||
@NotBlank(message = "路由名称不能为空")
|
||||
@NotNull(message = "路由名称不能为空")
|
||||
private String routeName;
|
||||
|
||||
@ApiModelProperty("在项目中路径")
|
||||
@Schema(name = "path", title = "在项目中路径")
|
||||
@NotBlank(message = "路由路径不能为空")
|
||||
@NotNull(message = "路由路径不能为空")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty("组件位置")
|
||||
@Schema(name = "component", title = "组件位置")
|
||||
private String component;
|
||||
|
||||
@ApiModelProperty("等级")
|
||||
@Schema(name = "routerRank", title = "等级")
|
||||
@JsonProperty("rank")
|
||||
private Integer routerRank = 99;
|
||||
|
||||
@ApiModelProperty("重定向")
|
||||
private String redirect;
|
||||
|
||||
@ApiModelProperty("图标")
|
||||
@Schema(name = "icon", title = "图标")
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty("进入动画")
|
||||
private String enterTransition;
|
||||
|
||||
@ApiModelProperty("退出动画")
|
||||
private String leaveTransition;
|
||||
|
||||
@ApiModelProperty("frame路径")
|
||||
@Schema(name = "frameSrc", title = "frame路径")
|
||||
private String frameSrc;
|
||||
|
||||
@ApiModelProperty("是否隐藏标签")
|
||||
private Boolean hiddenTag = false;
|
||||
|
||||
@ApiModelProperty("是否固定标签")
|
||||
private Boolean fixedTag = false;
|
||||
|
||||
@ApiModelProperty("是否显示")
|
||||
@Schema(name = "visible", title = "是否显示")
|
||||
private Boolean visible = false;
|
||||
|
||||
@ApiModelProperty("是否显示父级")
|
||||
private Boolean showParent = false;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package cn.bunny.dao.dto.system.router;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
@ -17,43 +16,46 @@ import lombok.NoArgsConstructor;
|
|||
@Schema(name = "RouterManageDto对象", title = "路由更新表单", description = "路由更新表单")
|
||||
public class RouterUpdateDto {
|
||||
|
||||
@ApiModelProperty("唯一标识")
|
||||
@Schema(name = "id", title = "唯一标识")
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("菜单类型")
|
||||
@Schema(name = "menuType", title = "菜单类型")
|
||||
@NotNull(message = "菜单类型不能为空")
|
||||
private Integer menuType;
|
||||
|
||||
@ApiModelProperty("父级id")
|
||||
@Schema(name = "parentId", title = "父级id")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty("菜单名称")
|
||||
@Schema(name = "title", title = "路由title")
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@NotNull(message = "菜单名称不能为空")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("路由名称")
|
||||
@NotBlank(message = "路由名称不能为空")
|
||||
@Schema(name = "routeName", title = "路由名称")
|
||||
@JsonProperty("name")
|
||||
@NotBlank(message = "路由名称不能为空")
|
||||
@NotNull(message = "路由名称不能为空")
|
||||
private String routeName;
|
||||
|
||||
@ApiModelProperty("在项目中路径")
|
||||
@Schema(name = "path", title = "在项目中路径")
|
||||
@NotBlank(message = "路由路径不能为空")
|
||||
@NotNull(message = "路由路径不能为空")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty("组件位置")
|
||||
@Schema(name = "component", title = "组件位置")
|
||||
private String component;
|
||||
|
||||
@ApiModelProperty("等级")
|
||||
@Schema(name = "routerRank", title = "等级")
|
||||
@JsonProperty("rank")
|
||||
private Integer routerRank;
|
||||
|
||||
@ApiModelProperty("图标")
|
||||
@Schema(name = "icon", title = "图标")
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty("frame路径")
|
||||
@Schema(name = "frameSrc", title = "frame路径")
|
||||
private String frameSrc;
|
||||
|
||||
@ApiModelProperty("是否显示")
|
||||
@Schema(name = "visible", title = "是否显示")
|
||||
private Boolean visible;
|
||||
}
|
||||
|
|
|
@ -17,14 +17,17 @@ public class AdminUserAddDto {
|
|||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@NotNull(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "nickName", title = "昵称")
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
@NotNull(message = "昵称不能为空")
|
||||
private String nickName;
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
@NotNull(message = "邮箱不能为空")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "phone", title = "手机号")
|
||||
|
@ -32,6 +35,7 @@ public class AdminUserAddDto {
|
|||
|
||||
@Schema(name = "password", title = "密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@NotNull(message = "密码不能为空")
|
||||
private String password = "123456";
|
||||
|
||||
@Schema(name = "avatar", title = "头像")
|
||||
|
|
|
@ -21,14 +21,17 @@ public class AdminUserUpdateDto {
|
|||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@NotNull(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "nickName", title = "昵称")
|
||||
@NotBlank(message = "昵称不能为空")
|
||||
@NotNull(message = "昵称不能为空")
|
||||
private String nickName;
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
@NotBlank(message = "邮箱不能为空")
|
||||
@NotNull(message = "邮箱不能为空")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "phone", title = "手机号")
|
||||
|
|
|
@ -2,7 +2,6 @@ package cn.bunny.dao.dto.system.user;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
|
@ -22,7 +21,7 @@ public class AdminUserUpdateWithPasswordDto {
|
|||
|
||||
@Schema(name = "password", title = "用户密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@NotEmpty
|
||||
@NotNull(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.user;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -16,15 +17,18 @@ public class LoginDto {
|
|||
|
||||
@Schema(name = "username", title = "用户名")
|
||||
@NotBlank(message = "用户名不能为空")
|
||||
@NotNull(message = "用户名不能为空")
|
||||
private String username;
|
||||
|
||||
@Schema(name = "password", title = "密码")
|
||||
@NotBlank(message = "密码不能为空")
|
||||
@NotNull(message = "密码不能为空")
|
||||
private String password;
|
||||
|
||||
|
||||
@Schema(name = "emailCode", title = "邮箱验证码")
|
||||
@NotBlank(message = "邮箱验证码不能为空")
|
||||
@NotNull(message = "邮箱验证码不能为空")
|
||||
private String emailCode;
|
||||
|
||||
@Schema(name = "readMeDay", title = "记住我的天数")
|
||||
|
|
|
@ -2,6 +2,7 @@ package cn.bunny.dao.dto.system.user;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@ -15,6 +16,7 @@ import lombok.NoArgsConstructor;
|
|||
public class RefreshTokenDto {
|
||||
@Schema(name = "refreshToken", title = "请求刷新token")
|
||||
@NotBlank(message = "请求刷新token不能为空")
|
||||
@NotNull(message = "请求刷新token不能为空")
|
||||
private String refreshToken;
|
||||
|
||||
@Schema(name = "readMeDay", title = "记住我天数")
|
||||
|
|
|
@ -15,13 +15,13 @@ import lombok.experimental.Accessors;
|
|||
* @author Bunny
|
||||
* @since 2024-05-17
|
||||
*/
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("sys_email_users")
|
||||
@Schema(name = "EmailUsers对象", title = "邮箱发送表", description = "邮箱发送表")
|
||||
@Schema(name = "EmailUsers对象", title = "邮箱用户发送配置", description = "邮箱用户发送配置管理")
|
||||
public class EmailUsers extends BaseEntity {
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
private String email;
|
||||
|
||||
|
@ -41,5 +41,8 @@ public class EmailUsers extends BaseEntity {
|
|||
private String smtpAgreement;
|
||||
|
||||
@Schema(name = "isDefault", title = "是否为默认邮件")
|
||||
private Byte isDefault;
|
||||
private Boolean isDefault;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package cn.bunny.dao.entity.system;
|
|||
|
||||
import cn.bunny.dao.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -23,7 +22,6 @@ import lombok.experimental.Accessors;
|
|||
@Schema(name = "Router对象", title = "系统菜单表", description = "系统菜单表")
|
||||
public class Router extends BaseEntity {
|
||||
|
||||
@ApiModelProperty("父级id")
|
||||
@Schema(name = "parentId", title = "父级id")
|
||||
private Long parentId;
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package cn.bunny.dao.vo.system;
|
||||
package cn.bunny.dao.vo.system.email;
|
||||
|
||||
import cn.bunny.dao.vo.BaseVo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.*;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "EmailTemplateVo对象", title = "邮箱模板返回内容", description = "邮箱模板返回内容")
|
||||
public class EmailTemplateVo {
|
||||
public class EmailTemplateVo extends BaseVo {
|
||||
|
||||
@Schema(name = "templateName", title = "模板名称")
|
||||
private String templateName;
|
||||
|
||||
|
@ -20,4 +20,11 @@ public class EmailTemplateVo {
|
|||
|
||||
@Schema(name = "body", title = "邮件内容")
|
||||
private String body;
|
||||
|
||||
@Schema(name = "type", title = "邮件类型")
|
||||
private String type;
|
||||
|
||||
@Schema(name = "isDefault", title = "是否默认")
|
||||
private Boolean isDefault;
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package cn.bunny.dao.vo.system.email;
|
||||
|
||||
import cn.bunny.dao.vo.BaseVo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "EmailUsersVo对象", title = "邮箱用户发送配置", description = "邮箱用户发送配置管理")
|
||||
public class EmailUsersVo extends BaseVo {
|
||||
|
||||
@Schema(name = "email", title = "邮箱")
|
||||
private String email;
|
||||
|
||||
@Schema(name = "emailTemplate", title = "使用邮件模板")
|
||||
private Long emailTemplate;
|
||||
|
||||
@Schema(name = "password", title = "密码")
|
||||
private String password;
|
||||
|
||||
@Schema(name = "host", title = "Host地址")
|
||||
private String host;
|
||||
|
||||
@Schema(name = "port", title = "端口号")
|
||||
private Integer port;
|
||||
|
||||
@Schema(name = "smtpAgreement", title = "邮箱协议")
|
||||
private String smtpAgreement;
|
||||
|
||||
@Schema(name = "isDefault", title = "是否为默认邮件")
|
||||
private Boolean isDefault;
|
||||
|
||||
}
|
|
@ -40,6 +40,12 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- admin 依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>3.2.3</version>
|
||||
</dependency>
|
||||
<!-- 单元测试 -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@ -74,10 +80,6 @@
|
|||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
|
|
|
@ -1,18 +1,72 @@
|
|||
package cn.bunny.services.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateAddDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateUpdateDto;
|
||||
import cn.bunny.dao.entity.system.EmailTemplate;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.pojo.result.Result;
|
||||
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||
import cn.bunny.dao.vo.system.email.EmailTemplateVo;
|
||||
import cn.bunny.services.service.EmailTemplateService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* 邮件模板表表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-09-26
|
||||
* @since 2024-10-10 16:28:29
|
||||
*/
|
||||
@Tag(name = "邮件模板表", description = "邮件模板表相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/emailTemplate")
|
||||
@RequestMapping("admin/emailTemplate")
|
||||
public class EmailTemplateController {
|
||||
|
||||
@Autowired
|
||||
private EmailTemplateService emailTemplateService;
|
||||
|
||||
@Operation(summary = "分页查询邮件模板表", description = "分页查询邮件模板表")
|
||||
@GetMapping("getEmailTemplateList/{page}/{limit}")
|
||||
public Mono<Result<PageResult<EmailTemplateVo>>> getEmailTemplateList(
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@PathVariable("page") Integer page,
|
||||
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||
@PathVariable("limit") Integer limit,
|
||||
EmailTemplateDto dto) {
|
||||
Page<EmailTemplate> pageParams = new Page<>(page, limit);
|
||||
PageResult<EmailTemplateVo> pageResult = emailTemplateService.getEmailTemplateList(pageParams, dto);
|
||||
return Mono.just(Result.success(pageResult));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加邮件模板表", description = "添加邮件模板表")
|
||||
@PostMapping("addEmailTemplate")
|
||||
public Mono<Result<String>> addEmailTemplate(@Valid @RequestBody EmailTemplateAddDto dto) {
|
||||
emailTemplateService.addEmailTemplate(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新邮件模板表", description = "更新邮件模板表")
|
||||
@PutMapping("updateEmailTemplate")
|
||||
public Mono<Result<String>> updateEmailTemplate(@Valid @RequestBody EmailTemplateUpdateDto dto) {
|
||||
emailTemplateService.updateEmailTemplate(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除邮件模板表", description = "删除邮件模板表")
|
||||
@DeleteMapping("deleteEmailTemplate")
|
||||
public Mono<Result<String>> deleteEmailTemplate(@RequestBody List<Long> ids) {
|
||||
emailTemplateService.deleteEmailTemplate(ids);
|
||||
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,72 @@
|
|||
package cn.bunny.services.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersAddDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersUpdateDto;
|
||||
import cn.bunny.dao.entity.system.EmailUsers;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.pojo.result.Result;
|
||||
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||
import cn.bunny.dao.vo.system.email.EmailUsersVo;
|
||||
import cn.bunny.services.service.EmailUsersService;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 邮箱发送表 前端控制器
|
||||
* 邮箱用户发送配置表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-09-26
|
||||
* @since 2024-10-10 15:19:22
|
||||
*/
|
||||
@Tag(name = "邮箱用户发送配置", description = "邮箱用户发送配置相关接口")
|
||||
@RestController
|
||||
@RequestMapping("/emailUsers")
|
||||
@RequestMapping("admin/emailUsers")
|
||||
public class EmailUsersController {
|
||||
|
||||
@Autowired
|
||||
private EmailUsersService emailUsersService;
|
||||
|
||||
@Operation(summary = "分页查询邮箱用户发送配置", description = "分页查询邮箱用户发送配置")
|
||||
@GetMapping("getEmailUsersList/{page}/{limit}")
|
||||
public Mono<Result<PageResult<EmailUsersVo>>> getEmailUsersList(
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@PathVariable("page") Integer page,
|
||||
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||
@PathVariable("limit") Integer limit,
|
||||
EmailUsersDto dto) {
|
||||
Page<EmailUsers> pageParams = new Page<>(page, limit);
|
||||
PageResult<EmailUsersVo> pageResult = emailUsersService.getEmailUsersList(pageParams, dto);
|
||||
return Mono.just(Result.success(pageResult));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加邮箱用户发送配置", description = "添加邮箱用户发送配置")
|
||||
@PostMapping("addEmailUsers")
|
||||
public Mono<Result<String>> addEmailUsers(@Valid @RequestBody EmailUsersAddDto dto) {
|
||||
emailUsersService.addEmailUsers(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新邮箱用户发送配置", description = "更新邮箱用户发送配置")
|
||||
@PutMapping("updateEmailUsers")
|
||||
public Mono<Result<String>> updateEmailUsers(@Valid @RequestBody EmailUsersUpdateDto dto) {
|
||||
emailUsersService.updateEmailUsers(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除邮箱用户发送配置", description = "删除邮箱用户发送配置")
|
||||
@DeleteMapping("deleteEmailUsers")
|
||||
public Mono<Result<String>> deleteEmailUsers(@RequestBody List<Long> ids) {
|
||||
emailUsersService.deleteEmailUsers(ids);
|
||||
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,39 @@
|
|||
package cn.bunny.services.mapper;
|
||||
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateDto;
|
||||
import cn.bunny.dao.entity.system.EmailTemplate;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* 邮件模板表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-09-26
|
||||
* @since 2024-10-10 16:28:29
|
||||
*/
|
||||
@Mapper
|
||||
public interface EmailTemplateMapper extends BaseMapper<EmailTemplate> {
|
||||
|
||||
/**
|
||||
* * 分页查询邮件模板表内容
|
||||
*
|
||||
* @param pageParams 邮件模板表分页参数
|
||||
* @param dto 邮件模板表查询表单
|
||||
* @return 邮件模板表分页结果
|
||||
*/
|
||||
IPage<EmailTemplate> selectListByPage(@Param("page") Page<EmailTemplate> pageParams, @Param("dto") EmailTemplateDto dto);
|
||||
|
||||
/**
|
||||
* 物理删除邮件模板表
|
||||
*
|
||||
* @param ids 删除 id 列表
|
||||
*/
|
||||
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,39 @@
|
|||
package cn.bunny.services.mapper;
|
||||
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersDto;
|
||||
import cn.bunny.dao.entity.system.EmailUsers;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 邮箱发送表 Mapper 接口
|
||||
* 邮箱用户发送配置 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-09-26
|
||||
* @since 2024-10-10 15:19:22
|
||||
*/
|
||||
@Mapper
|
||||
public interface EmailUsersMapper extends BaseMapper<EmailUsers> {
|
||||
|
||||
/**
|
||||
* * 分页查询邮箱用户发送配置内容
|
||||
*
|
||||
* @param pageParams 邮箱用户发送配置分页参数
|
||||
* @param dto 邮箱用户发送配置查询表单
|
||||
* @return 邮箱用户发送配置分页结果
|
||||
*/
|
||||
IPage<EmailUsers> selectListByPage(@Param("page") Page<EmailUsers> pageParams, @Param("dto") EmailUsersDto dto);
|
||||
|
||||
/**
|
||||
* 物理删除邮箱用户发送配置
|
||||
*
|
||||
* @param ids 删除 id 列表
|
||||
*/
|
||||
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -30,15 +30,16 @@ import org.springframework.security.web.util.matcher.RegexRequestMatcher;
|
|||
public class WebSecurityConfig {
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
// 自定义用户接口
|
||||
|
||||
@Autowired
|
||||
private CustomUserDetailsService customUserDetailsService;
|
||||
// 自定义密码加密器
|
||||
|
||||
@Autowired
|
||||
private CustomPasswordEncoder customPasswordEncoder;
|
||||
// 自定义验证码
|
||||
|
||||
@Autowired
|
||||
private CustomAuthorizationManagerServiceImpl customAuthorizationManagerService;
|
||||
|
||||
@Autowired
|
||||
private AuthenticationConfiguration authenticationConfiguration;
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class WebSecurityConfig {
|
|||
// 前端段分离不需要---禁用明文验证
|
||||
.httpBasic(AbstractHttpConfigurer::disable)
|
||||
// 前端段分离不需要---禁用默认登录页
|
||||
.formLogin(AbstractHttpConfigurer::disable)
|
||||
// .formLogin(AbstractHttpConfigurer::disable)
|
||||
// 前端段分离不需要---禁用退出页
|
||||
.logout(AbstractHttpConfigurer::disable)
|
||||
// 前端段分离不需要---csrf攻击
|
||||
|
@ -60,9 +61,6 @@ public class WebSecurityConfig {
|
|||
// 前后端分离不需要---记住我,e -> e.rememberMeParameter("rememberBunny").rememberMeCookieName("rememberBunny").key("BunnyKey")
|
||||
.rememberMe(AbstractHttpConfigurer::disable)
|
||||
.authorizeHttpRequests(authorize -> {
|
||||
// 有样式文件,不需要访问权限
|
||||
// authorize.requestMatchers(RegexRequestMatcher.regexMatcher("^\\S*[css|js]$")).permitAll();
|
||||
authorize.requestMatchers(RegexRequestMatcher.regexMatcher("^.*\\.(css|js)$")).permitAll();
|
||||
// 上面都不是需要鉴权访问
|
||||
authorize.anyRequest().access(customAuthorizationManagerService);
|
||||
})
|
||||
|
@ -94,10 +92,10 @@ public class WebSecurityConfig {
|
|||
String[] annotations = {
|
||||
"/", "/ws/**",
|
||||
"/*/*/noAuth/**", "/*/noAuth/**", "/noAuth/**",
|
||||
"/media.ico", "/favicon.ico", "*.html", "/webjars/**",
|
||||
"/swagger-resources/**", "/v3/**", "/swagger-ui/**",
|
||||
"/*/i18n/getI18n"
|
||||
"/media.ico", "/favicon.ico", "*.html", "/webjars/**", "/error", "/*/api-docs/*",
|
||||
"/*/i18n/getI18n",
|
||||
};
|
||||
return web -> web.ignoring().requestMatchers(annotations);
|
||||
return web -> web.ignoring().requestMatchers(annotations)
|
||||
.requestMatchers(RegexRequestMatcher.regexMatcher(".*\\.(css|js)$"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class NoTokenAuthenticationFilter extends OncePerRequestFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull FilterChain filterChain) throws ServletException, IOException {
|
||||
protected void doFilterInternal(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull FilterChain filterChain) throws ServletException, IOException {
|
||||
// 判断是否有 token
|
||||
String token = request.getHeader("token");
|
||||
if (token == null) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import cn.bunny.common.service.context.BaseContext;
|
|||
import cn.bunny.dao.entity.system.Power;
|
||||
import cn.bunny.services.mapper.PowerMapper;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
|
@ -12,6 +13,7 @@ import org.springframework.security.authorization.AuthorizationManager;
|
|||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.web.access.intercept.RequestAuthorizationContext;
|
||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -31,30 +33,25 @@ public class CustomAuthorizationManagerServiceImpl implements AuthorizationManag
|
|||
private PowerMapper powerMapper;
|
||||
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public AuthorizationDecision check(Supplier<Authentication> authentication, RequestAuthorizationContext context) {
|
||||
// 用户的token和用户id、请求Url
|
||||
HttpServletRequest request = context.getRequest();
|
||||
|
||||
// 请求地址
|
||||
String requestURI = request.getRequestURI();
|
||||
|
||||
// 请求方式
|
||||
String method = request.getMethod();
|
||||
|
||||
// 角色代码列表
|
||||
List<String> roleCodeList = authentication.get().getAuthorities().stream().map(GrantedAuthority::getAuthority).toList();
|
||||
|
||||
// 校验权限
|
||||
return new AuthorizationDecision(hasAuth(requestURI));
|
||||
return new AuthorizationDecision(hasAuth(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户所属的角色信息
|
||||
*
|
||||
* @param requestURI 请求url地址
|
||||
* @param request 请求url地址
|
||||
*/
|
||||
private Boolean hasAuth(String requestURI) {
|
||||
private Boolean hasAuth(HttpServletRequest request) {
|
||||
// 角色代码列表
|
||||
List<String> roleCodeList = BaseContext.getLoginVo().getRoles();
|
||||
|
||||
|
@ -69,6 +66,7 @@ public class CustomAuthorizationManagerServiceImpl implements AuthorizationManag
|
|||
List<Power> powerList = powerMapper.selectListByPowerCodes(powerCodes);
|
||||
|
||||
// 判断是否与请求路径匹配
|
||||
return powerList.stream().anyMatch(power -> requestURI.matches(power.getRequestUrl()));
|
||||
return powerList.stream().anyMatch(power -> AntPathRequestMatcher.antMatcher(power.getRequestUrl()).matches(request) ||
|
||||
request.getRequestURI().matches(power.getRequestUrl()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,52 @@
|
|||
package cn.bunny.services.service;
|
||||
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateAddDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateUpdateDto;
|
||||
import cn.bunny.dao.entity.system.EmailTemplate;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.system.email.EmailTemplateVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* 邮件模板表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-09-26
|
||||
* @since 2024-10-10 16:28:29
|
||||
*/
|
||||
public interface EmailTemplateService extends IService<EmailTemplate> {
|
||||
|
||||
/**
|
||||
* * 获取邮件模板表列表
|
||||
*
|
||||
* @return 邮件模板表返回列表
|
||||
*/
|
||||
PageResult<EmailTemplateVo> getEmailTemplateList(Page<EmailTemplate> pageParams, EmailTemplateDto dto);
|
||||
|
||||
/**
|
||||
* * 添加邮件模板表
|
||||
*
|
||||
* @param dto 添加表单
|
||||
*/
|
||||
void addEmailTemplate(@Valid EmailTemplateAddDto dto);
|
||||
|
||||
/**
|
||||
* * 更新邮件模板表
|
||||
*
|
||||
* @param dto 更新表单
|
||||
*/
|
||||
void updateEmailTemplate(@Valid EmailTemplateUpdateDto dto);
|
||||
|
||||
/**
|
||||
* * 删除|批量删除邮件模板表类型
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
void deleteEmailTemplate(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -1,16 +1,52 @@
|
|||
package cn.bunny.services.service;
|
||||
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersAddDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersUpdateDto;
|
||||
import cn.bunny.dao.entity.system.EmailUsers;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.system.email.EmailUsersVo;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 邮箱发送表 服务类
|
||||
* 邮箱用户发送配置 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-09-26
|
||||
* @since 2024-10-10 15:19:22
|
||||
*/
|
||||
public interface EmailUsersService extends IService<EmailUsers> {
|
||||
|
||||
/**
|
||||
* * 获取邮箱用户发送配置列表
|
||||
*
|
||||
* @return 邮箱用户发送配置返回列表
|
||||
*/
|
||||
PageResult<EmailUsersVo> getEmailUsersList(Page<EmailUsers> pageParams, EmailUsersDto dto);
|
||||
|
||||
/**
|
||||
* * 添加邮箱用户发送配置
|
||||
*
|
||||
* @param dto 添加表单
|
||||
*/
|
||||
void addEmailUsers(@Valid EmailUsersAddDto dto);
|
||||
|
||||
/**
|
||||
* * 更新邮箱用户发送配置
|
||||
*
|
||||
* @param dto 更新表单
|
||||
*/
|
||||
void updateEmailUsers(@Valid EmailUsersUpdateDto dto);
|
||||
|
||||
/**
|
||||
* * 删除|批量删除邮箱用户发送配置类型
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
void deleteEmailUsers(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -1,20 +1,92 @@
|
|||
package cn.bunny.services.service.impl;
|
||||
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateAddDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailTemplateUpdateDto;
|
||||
import cn.bunny.dao.entity.system.EmailTemplate;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.system.email.EmailTemplateVo;
|
||||
import cn.bunny.services.mapper.EmailTemplateMapper;
|
||||
import cn.bunny.services.service.EmailTemplateService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* 邮件模板表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-09-26
|
||||
* @since 2024-10-10 16:28:29
|
||||
*/
|
||||
@Service
|
||||
public class EmailTemplateServiceImpl extends ServiceImpl<EmailTemplateMapper, EmailTemplate> implements EmailTemplateService {
|
||||
|
||||
/**
|
||||
* * 邮件模板表 服务实现类
|
||||
*
|
||||
* @param pageParams 邮件模板表分页查询page对象
|
||||
* @param dto 邮件模板表分页查询对象
|
||||
* @return 查询分页邮件模板表返回对象
|
||||
*/
|
||||
@Override
|
||||
public PageResult<EmailTemplateVo> getEmailTemplateList(Page<EmailTemplate> pageParams, EmailTemplateDto dto) {
|
||||
// 分页查询菜单图标
|
||||
IPage<EmailTemplate> page = baseMapper.selectListByPage(pageParams, dto);
|
||||
|
||||
List<EmailTemplateVo> voList = page.getRecords().stream().map(emailTemplate -> {
|
||||
EmailTemplateVo emailTemplateVo = new EmailTemplateVo();
|
||||
BeanUtils.copyProperties(emailTemplate, emailTemplateVo);
|
||||
return emailTemplateVo;
|
||||
}).toList();
|
||||
|
||||
return PageResult.<EmailTemplateVo>builder()
|
||||
.list(voList)
|
||||
.pageNo(page.getCurrent())
|
||||
.pageSize(page.getSize())
|
||||
.total(page.getTotal())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加邮件模板表
|
||||
*
|
||||
* @param dto 邮件模板表添加
|
||||
*/
|
||||
@Override
|
||||
public void addEmailTemplate(@Valid EmailTemplateAddDto dto) {
|
||||
// 保存数据
|
||||
EmailTemplate emailTemplate = new EmailTemplate();
|
||||
BeanUtils.copyProperties(dto, emailTemplate);
|
||||
save(emailTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新邮件模板表
|
||||
*
|
||||
* @param dto 邮件模板表更新
|
||||
*/
|
||||
@Override
|
||||
public void updateEmailTemplate(@Valid EmailTemplateUpdateDto dto) {
|
||||
// 更新内容
|
||||
EmailTemplate emailTemplate = new EmailTemplate();
|
||||
BeanUtils.copyProperties(dto, emailTemplate);
|
||||
updateById(emailTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除|批量删除邮件模板表
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
@Override
|
||||
public void deleteEmailTemplate(List<Long> ids) {
|
||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,92 @@
|
|||
package cn.bunny.services.service.impl;
|
||||
|
||||
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersAddDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersDto;
|
||||
import cn.bunny.dao.dto.system.email.EmailUsersUpdateDto;
|
||||
import cn.bunny.dao.entity.system.EmailUsers;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import cn.bunny.dao.vo.system.email.EmailUsersVo;
|
||||
import cn.bunny.services.mapper.EmailUsersMapper;
|
||||
import cn.bunny.services.service.EmailUsersService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 邮箱发送表 服务实现类
|
||||
* <p>
|
||||
* 邮箱用户发送配置 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-09-26
|
||||
* @since 2024-10-10 15:19:22
|
||||
*/
|
||||
@Service
|
||||
public class EmailUsersServiceImpl extends ServiceImpl<EmailUsersMapper, EmailUsers> implements EmailUsersService {
|
||||
|
||||
/**
|
||||
* * 邮箱用户发送配置 服务实现类
|
||||
*
|
||||
* @param pageParams 邮箱用户发送配置分页查询page对象
|
||||
* @param dto 邮箱用户发送配置分页查询对象
|
||||
* @return 查询分页邮箱用户发送配置返回对象
|
||||
*/
|
||||
@Override
|
||||
public PageResult<EmailUsersVo> getEmailUsersList(Page<EmailUsers> pageParams, EmailUsersDto dto) {
|
||||
// 分页查询菜单图标
|
||||
IPage<EmailUsers> page = baseMapper.selectListByPage(pageParams, dto);
|
||||
|
||||
List<EmailUsersVo> voList = page.getRecords().stream().map(emailUsers -> {
|
||||
EmailUsersVo emailUsersVo = new EmailUsersVo();
|
||||
BeanUtils.copyProperties(emailUsers, emailUsersVo);
|
||||
return emailUsersVo;
|
||||
}).toList();
|
||||
|
||||
return PageResult.<EmailUsersVo>builder()
|
||||
.list(voList)
|
||||
.pageNo(page.getCurrent())
|
||||
.pageSize(page.getSize())
|
||||
.total(page.getTotal())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加邮箱用户发送配置
|
||||
*
|
||||
* @param dto 邮箱用户发送配置添加
|
||||
*/
|
||||
@Override
|
||||
public void addEmailUsers(@Valid EmailUsersAddDto dto) {
|
||||
// 保存数据
|
||||
EmailUsers emailUsers = new EmailUsers();
|
||||
BeanUtils.copyProperties(dto, emailUsers);
|
||||
save(emailUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新邮箱用户发送配置
|
||||
*
|
||||
* @param dto 邮箱用户发送配置更新
|
||||
*/
|
||||
@Override
|
||||
public void updateEmailUsers(@Valid EmailUsersUpdateDto dto) {
|
||||
// 更新内容
|
||||
EmailUsers emailUsers = new EmailUsers();
|
||||
BeanUtils.copyProperties(dto, emailUsers);
|
||||
updateById(emailUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除|批量删除邮箱用户发送配置
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
@Override
|
||||
public void deleteEmailUsers(List<Long> ids) {
|
||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,22 @@
|
|||
server:
|
||||
port: 7070
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
base-path: /bunny
|
||||
info:
|
||||
env:
|
||||
enabled: true
|
||||
java:
|
||||
enabled: true
|
||||
os:
|
||||
enabled: true
|
||||
endpoint:
|
||||
health:
|
||||
show-details: always
|
||||
spring:
|
||||
profiles:
|
||||
active: @profiles.active@
|
||||
|
|
|
@ -2,24 +2,23 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.bunny.services.mapper.EmailTemplateMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.EmailTemplate">
|
||||
<id column="id" property="id"/>
|
||||
<result column="template_name" property="templateName"/>
|
||||
<result column="subject" property="subject"/>
|
||||
<result column="body" property="body"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="is_default" property="isDefault"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, template_name, subject, body, type, is_default, create_time, update_time, create_user, update_user, is_deleted
|
||||
</sql>
|
||||
<!-- 分页查询邮件模板表内容 -->
|
||||
<select id="selectListByPage" resultType="cn.bunny.dao.entity.system.EmailTemplate">
|
||||
select * from $tableName
|
||||
<where>
|
||||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<!-- 物理删除邮件模板表 -->
|
||||
<delete id="deleteBatchIdsWithPhysics">
|
||||
delete
|
||||
from $tableName
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -5,23 +5,58 @@
|
|||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.bunny.dao.entity.system.EmailUsers">
|
||||
<id column="id" property="id"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="email_template" property="emailTemplate"/>
|
||||
<result column="password" property="password"/>
|
||||
<result column="host" property="host"/>
|
||||
<result column="port" property="port"/>
|
||||
<result column="smtp_agreement" property="smtpAgreement"/>
|
||||
<result column="is_default" property="isDefault"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<id column="create_time" property="createTime"/>
|
||||
<id column="update_time" property="updateTime"/>
|
||||
<id column="create_user" property="createUser"/>
|
||||
<id column="update_user" property="updateUser"/>
|
||||
<id column="is_deleted" property="isDeleted"/>
|
||||
<id column="email" property="email"/>
|
||||
<id column="email_template" property="emailTemplate"/>
|
||||
<id column="password" property="password"/>
|
||||
<id column="host" property="host"/>
|
||||
<id column="port" property="port"/>
|
||||
<id column="smtp_agreement" property="smtpAgreement"/>
|
||||
<id column="is_default" property="isDefault"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, email, email_template, password, host, port, smtp_agreement, is_default, create_time, update_time, create_user, update_user, is_deleted
|
||||
id, create_time, update_time, create_user, update_user, is_deleted, email, email_template, password, host, port, smtp_agreement, is_default
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询邮箱用户发送配置内容 -->
|
||||
<select id="selectListByPage" resultType="cn.bunny.dao.entity.system.EmailUsers">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from sys_email_users
|
||||
<where>
|
||||
<if test="dto.email != null and dto.email != ''">
|
||||
email like CONCAT('%',#{dto.email},'%')
|
||||
</if>
|
||||
<if test="dto.emailTemplate != null and dto.emailTemplate != ''">
|
||||
email_template like CONCAT('%',#{dto.emailTemplate},'%')
|
||||
</if>
|
||||
<if test="dto.host != null and dto.host != ''">
|
||||
host like CONCAT('%',#{dto.host},'%')
|
||||
</if>
|
||||
<if test="dto.port != null and dto.port != ''">
|
||||
port like CONCAT('%',#{dto.port},'%')
|
||||
</if>
|
||||
<if test="dto.smtpAgreement != null and dto.smtpAgreement != ''">
|
||||
smtp_agreement like CONCAT('%',#{dto.smtpAgreement},'%')
|
||||
</if>
|
||||
</where>
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<!-- 物理删除邮箱用户发送配置 -->
|
||||
<delete id="deleteBatchIdsWithPhysics">
|
||||
delete
|
||||
from sys_email_users
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
request_url like CONCAT('%',#{dto.requestUrl},'%')
|
||||
</if>
|
||||
</where>
|
||||
order by update_time
|
||||
order by update_time desc
|
||||
</select>
|
||||
|
||||
<!-- 物理删除权限 -->
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-cmn-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>500 - 服务器错误</title>
|
||||
<meta content="width=device-width, maximum-scale=1, initial-scale=1" name="viewport"/>
|
||||
<style>
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
color: #333;
|
||||
margin: auto;
|
||||
padding: 1em;
|
||||
display: table;
|
||||
user-select: none;
|
||||
box-sizing: border-box;
|
||||
font: lighter 20px "微软雅黑";
|
||||
}
|
||||
|
||||
a {
|
||||
color: #3498db;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
font-size: 3.5em;
|
||||
}
|
||||
|
||||
main {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: #fff;
|
||||
padding: .75em 1em;
|
||||
background: #3498db;
|
||||
border-radius: 1.5em;
|
||||
display: inline-block;
|
||||
transition: opacity .3s, transform .3s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
opacity: .7;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>:'(</h1>
|
||||
<p>服务器开小差啦!管理员正在修理中...</p>
|
||||
<p>还请阁下静候站点恢复~</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue