# Conflicts:
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountSaveReqVO.java
#	yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailSendServiceImpl.java
This commit is contained in:
YunaiV 2024-04-24 09:40:05 +08:00
commit 5e3e68f7f5
21 changed files with 20 additions and 47 deletions

View File

@ -249,7 +249,6 @@ CREATE TABLE "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"
"COLUMN_COMMENT" VARCHAR(500) NOT NULL, "COLUMN_COMMENT" VARCHAR(500) NOT NULL,
"NULLABLE" BIT NOT NULL, "NULLABLE" BIT NOT NULL,
"PRIMARY_KEY" BIT NOT NULL, "PRIMARY_KEY" BIT NOT NULL,
"AUTO_INCREMENT" CHAR(1) NOT NULL,
"ORDINAL_POSITION" INT NOT NULL, "ORDINAL_POSITION" INT NOT NULL,
"JAVA_TYPE" VARCHAR(32) NOT NULL, "JAVA_TYPE" VARCHAR(32) NOT NULL,
"JAVA_FIELD" VARCHAR(64) NOT NULL, "JAVA_FIELD" VARCHAR(64) NOT NULL,
@ -2512,8 +2511,6 @@ COMMENT ON COLUMN "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"."NULLABLE" IS '是否
COMMENT ON COLUMN "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"."PRIMARY_KEY" IS '是否主键'; COMMENT ON COLUMN "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"."PRIMARY_KEY" IS '是否主键';
COMMENT ON COLUMN "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"."AUTO_INCREMENT" IS '是否自增';
COMMENT ON COLUMN "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"."ORDINAL_POSITION" IS '排序'; COMMENT ON COLUMN "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"."ORDINAL_POSITION" IS '排序';
COMMENT ON COLUMN "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"."JAVA_TYPE" IS 'Java 属性类型'; COMMENT ON COLUMN "RUOYI_VUE_PRO"."INFRA_CODEGEN_COLUMN"."JAVA_TYPE" IS 'Java 属性类型';

View File

@ -409,7 +409,6 @@ CREATE TABLE `infra_codegen_column` (
`column_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段描述', `column_comment` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '字段描述',
`nullable` bit(1) NOT NULL COMMENT '是否允许为空', `nullable` bit(1) NOT NULL COMMENT '是否允许为空',
`primary_key` bit(1) NOT NULL COMMENT '是否主键', `primary_key` bit(1) NOT NULL COMMENT '是否主键',
`auto_increment` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '是否自增',
`ordinal_position` int NOT NULL COMMENT '排序', `ordinal_position` int NOT NULL COMMENT '排序',
`java_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性类型', `java_type` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性类型',
`java_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性名', `java_field` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Java 属性名',

View File

@ -622,7 +622,6 @@ CREATE TABLE "INFRA_CODEGEN_COLUMN" (
"COLUMN_COMMENT" NVARCHAR2(500), "COLUMN_COMMENT" NVARCHAR2(500),
"NULLABLE" NUMBER(4,0), "NULLABLE" NUMBER(4,0),
"PRIMARY_KEY" NUMBER(4,0), "PRIMARY_KEY" NUMBER(4,0),
"AUTO_INCREMENT" NUMBER(4,0),
"ORDINAL_POSITION" NUMBER(11,0) NOT NULL, "ORDINAL_POSITION" NUMBER(11,0) NOT NULL,
"JAVA_TYPE" NVARCHAR2(32), "JAVA_TYPE" NVARCHAR2(32),
"JAVA_FIELD" NVARCHAR2(64), "JAVA_FIELD" NVARCHAR2(64),
@ -664,7 +663,6 @@ COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."DATA_TYPE" IS '字段类型';
COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."COLUMN_COMMENT" IS '字段描述'; COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."COLUMN_COMMENT" IS '字段描述';
COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."NULLABLE" IS '是否允许为空'; COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."NULLABLE" IS '是否允许为空';
COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."PRIMARY_KEY" IS '是否主键'; COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."PRIMARY_KEY" IS '是否主键';
COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."AUTO_INCREMENT" IS '是否自增';
COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."ORDINAL_POSITION" IS '排序'; COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."ORDINAL_POSITION" IS '排序';
COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."JAVA_TYPE" IS 'Java 属性类型'; COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."JAVA_TYPE" IS 'Java 属性类型';
COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."JAVA_FIELD" IS 'Java 属性名'; COMMENT ON COLUMN "INFRA_CODEGEN_COLUMN"."JAVA_FIELD" IS 'Java 属性名';

View File

@ -1225,7 +1225,6 @@ CREATE TABLE "infra_codegen_column"
"column_comment" varchar(500) COLLATE "pg_catalog"."default" NOT NULL, "column_comment" varchar(500) COLLATE "pg_catalog"."default" NOT NULL,
"nullable" bool NOT NULL, "nullable" bool NOT NULL,
"primary_key" bool NOT NULL, "primary_key" bool NOT NULL,
"auto_increment" bool NOT NULL,
"ordinal_position" int4 NOT NULL, "ordinal_position" int4 NOT NULL,
"java_type" varchar(32) COLLATE "pg_catalog"."default" NOT NULL, "java_type" varchar(32) COLLATE "pg_catalog"."default" NOT NULL,
"java_field" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, "java_field" varchar(64) COLLATE "pg_catalog"."default" NOT NULL,
@ -1259,8 +1258,6 @@ ON COLUMN "infra_codegen_column"."nullable" IS '是否允许为空';
COMMENT COMMENT
ON COLUMN "infra_codegen_column"."primary_key" IS '是否主键'; ON COLUMN "infra_codegen_column"."primary_key" IS '是否主键';
COMMENT COMMENT
ON COLUMN "infra_codegen_column"."auto_increment" IS '是否自增';
COMMENT
ON COLUMN "infra_codegen_column"."ordinal_position" IS '排序'; ON COLUMN "infra_codegen_column"."ordinal_position" IS '排序';
COMMENT COMMENT
ON COLUMN "infra_codegen_column"."java_type" IS 'Java 属性类型'; ON COLUMN "infra_codegen_column"."java_type" IS 'Java 属性类型';

View File

@ -1957,7 +1957,6 @@ CREATE TABLE [dbo].[infra_codegen_column] (
[column_comment] nvarchar(500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [column_comment] nvarchar(500) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[nullable] varchar(1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [nullable] varchar(1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[primary_key] varchar(1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [primary_key] varchar(1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[auto_increment] nchar(1) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[ordinal_position] int NOT NULL, [ordinal_position] int NOT NULL,
[java_type] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [java_type] nvarchar(32) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[java_field] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [java_field] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
@ -2029,13 +2028,6 @@ EXEC sp_addextendedproperty
'COLUMN', N'primary_key' 'COLUMN', N'primary_key'
GO GO
EXEC sp_addextendedproperty
'MS_Description', N'是否自增',
'SCHEMA', N'dbo',
'TABLE', N'infra_codegen_column',
'COLUMN', N'auto_increment'
GO
EXEC sp_addextendedproperty EXEC sp_addextendedproperty
'MS_Description', N'排序', 'MS_Description', N'排序',
'SCHEMA', N'dbo', 'SCHEMA', N'dbo',

View File

@ -30,9 +30,6 @@ public class CodegenColumnRespVO {
@Schema(description = "是否主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "false") @Schema(description = "是否主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "false")
private Boolean primaryKey; private Boolean primaryKey;
@Schema(description = "是否自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean autoIncrement;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
private Integer ordinalPosition; private Integer ordinalPosition;

View File

@ -36,10 +36,6 @@ public class CodegenColumnSaveReqVO {
@NotNull(message = "是否主键不能为空") @NotNull(message = "是否主键不能为空")
private Boolean primaryKey; private Boolean primaryKey;
@Schema(description = "是否自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "是否自增不能为空")
private Boolean autoIncrement;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
@NotNull(message = "排序不能为空") @NotNull(message = "排序不能为空")
private Integer ordinalPosition; private Integer ordinalPosition;

View File

@ -41,7 +41,6 @@ public interface CodegenConvert {
@Mapping(source = "comment", target = "columnComment"), @Mapping(source = "comment", target = "columnComment"),
@Mapping(source = "metaInfo.nullable", target = "nullable"), @Mapping(source = "metaInfo.nullable", target = "nullable"),
@Mapping(source = "keyFlag", target = "primaryKey"), @Mapping(source = "keyFlag", target = "primaryKey"),
@Mapping(source = "keyIdentityFlag", target = "autoIncrement"),
@Mapping(source = "columnType.type", target = "javaType"), @Mapping(source = "columnType.type", target = "javaType"),
@Mapping(source = "propertyName", target = "javaField"), @Mapping(source = "propertyName", target = "javaField"),
}) })

View File

@ -67,12 +67,6 @@ public class CodegenColumnDO extends BaseDO {
* 关联 {@link TableField#isKeyFlag()} * 关联 {@link TableField#isKeyFlag()}
*/ */
private Boolean primaryKey; private Boolean primaryKey;
/**
* 是否自增
*
* 关联 {@link TableField#isKeyIdentityFlag()}
*/
private Boolean autoIncrement;
/** /**
* 排序 * 排序
*/ */

View File

@ -54,7 +54,6 @@ public class CodegenBuilderTest extends BaseMockitoUnitTest {
when(metaInfo.getJdbcType()).thenReturn(JdbcType.BIGINT); when(metaInfo.getJdbcType()).thenReturn(JdbcType.BIGINT);
when(tableField.getComment()).thenReturn("编号"); when(tableField.getComment()).thenReturn("编号");
when(tableField.isKeyFlag()).thenReturn(true); when(tableField.isKeyFlag()).thenReturn(true);
when(tableField.isKeyIdentityFlag()).thenReturn(true);
IColumnType columnType = mock(IColumnType.class); IColumnType columnType = mock(IColumnType.class);
when(tableField.getColumnType()).thenReturn(columnType); when(tableField.getColumnType()).thenReturn(columnType);
when(columnType.getType()).thenReturn("Long"); when(columnType.getType()).thenReturn("Long");
@ -72,7 +71,6 @@ public class CodegenBuilderTest extends BaseMockitoUnitTest {
assertEquals("编号", column.getColumnComment()); assertEquals("编号", column.getColumnComment());
assertFalse(column.getNullable()); assertFalse(column.getNullable());
assertTrue(column.getPrimaryKey()); assertTrue(column.getPrimaryKey());
assertTrue(column.getAutoIncrement());
assertEquals(1, column.getOrdinalPosition()); assertEquals(1, column.getOrdinalPosition());
assertEquals("Long", column.getJavaType()); assertEquals("Long", column.getJavaType());
assertEquals("id", column.getJavaField()); assertEquals("id", column.getJavaField());

View File

@ -18,7 +18,6 @@
"dataType" : "BIGINT", "dataType" : "BIGINT",
"columnComment" : "编号", "columnComment" : "编号",
"primaryKey" : true, "primaryKey" : true,
"autoIncrement" : true,
"javaType" : "Long", "javaType" : "Long",
"javaField" : "id", "javaField" : "id",
"example" : "1024", "example" : "1024",

View File

@ -14,7 +14,6 @@
"dataType" : "BIGINT", "dataType" : "BIGINT",
"columnComment" : "编号", "columnComment" : "编号",
"primaryKey" : true, "primaryKey" : true,
"autoIncrement" : true,
"javaType" : "Long", "javaType" : "Long",
"javaField" : "id", "javaField" : "id",
"example" : "1024", "example" : "1024",

View File

@ -17,7 +17,6 @@
"dataType" : "BIGINT", "dataType" : "BIGINT",
"columnComment" : "编号", "columnComment" : "编号",
"primaryKey" : true, "primaryKey" : true,
"autoIncrement" : true,
"javaType" : "Long", "javaType" : "Long",
"javaField" : "id", "javaField" : "id",
"example" : "1024", "example" : "1024",

View File

@ -14,7 +14,6 @@
"dataType" : "BIGINT", "dataType" : "BIGINT",
"columnComment" : "编号", "columnComment" : "编号",
"primaryKey" : true, "primaryKey" : true,
"autoIncrement" : true,
"javaType" : "Long", "javaType" : "Long",
"javaField" : "id", "javaField" : "id",
"example" : "1024", "example" : "1024",

View File

@ -196,7 +196,6 @@ CREATE TABLE IF NOT EXISTS "infra_codegen_column" (
"column_comment" varchar(500) NOT NULL, "column_comment" varchar(500) NOT NULL,
"nullable" tinyint not null, "nullable" tinyint not null,
"primary_key" tinyint not null, "primary_key" tinyint not null,
"auto_increment" varchar(5) not null,
"ordinal_position" int not null, "ordinal_position" int not null,
"java_type" varchar(32) NOT NULL, "java_type" varchar(32) NOT NULL,
"java_field" varchar(64) NOT NULL, "java_field" varchar(64) NOT NULL,

View File

@ -30,6 +30,9 @@ public class MailAccountRespVO {
@Schema(description = "是否开启 ssl", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") @Schema(description = "是否开启 ssl", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean sslEnable; private Boolean sslEnable;
@Schema(description = "是否开启 starttls", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
private Boolean starttlsEnable;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime; private LocalDateTime createTime;

View File

@ -1,11 +1,10 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotNull;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 邮箱账号创建/修改 Request VO") @Schema(description = "管理后台 - 邮箱账号创建/修改 Request VO")
@Data @Data
public class MailAccountSaveReqVO { public class MailAccountSaveReqVO {
@ -38,4 +37,8 @@ public class MailAccountSaveReqVO {
@NotNull(message = "是否开启 ssl 必填") @NotNull(message = "是否开启 ssl 必填")
private Boolean sslEnable; private Boolean sslEnable;
@Schema(description = "是否开启 starttls", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "是否开启 starttls 必填")
private Boolean starttlsEnable;
} }

View File

@ -49,5 +49,9 @@ public class MailAccountDO extends BaseDO {
* 是否开启 SSL * 是否开启 SSL
*/ */
private Boolean sslEnable; private Boolean sslEnable;
/**
* 是否开启 STARTTLS
*/
private Boolean starttlsEnable;
} }

View File

@ -21,7 +21,7 @@ public interface RoleMapper extends BaseMapperX<RoleDO> {
.likeIfPresent(RoleDO::getCode, reqVO.getCode()) .likeIfPresent(RoleDO::getCode, reqVO.getCode())
.eqIfPresent(RoleDO::getStatus, reqVO.getStatus()) .eqIfPresent(RoleDO::getStatus, reqVO.getStatus())
.betweenIfPresent(BaseDO::getCreateTime, reqVO.getCreateTime()) .betweenIfPresent(BaseDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(RoleDO::getId)); .orderByAsc(RoleDO::getId));
} }
default RoleDO selectByName(String name) { default RoleDO selectByName(String name) {

View File

@ -1,8 +1,6 @@
package cn.iocoder.yudao.module.system.service.mail; package cn.iocoder.yudao.module.system.service.mail;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.mail.MailAccount;
import cn.hutool.extra.mail.MailUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
@ -13,11 +11,12 @@ import cn.iocoder.yudao.module.system.mq.producer.mail.MailProducer;
import cn.iocoder.yudao.module.system.service.member.MemberService; import cn.iocoder.yudao.module.system.service.member.MemberService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.hutool.extra.mail.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
@ -120,8 +119,9 @@ public class MailSendServiceImpl implements MailSendService {
private MailAccount buildMailAccount(MailAccountDO account, String nickname) { private MailAccount buildMailAccount(MailAccountDO account, String nickname) {
String from = StrUtil.isNotEmpty(nickname) ? nickname + " <" + account.getMail() + ">" : account.getMail(); String from = StrUtil.isNotEmpty(nickname) ? nickname + " <" + account.getMail() + ">" : account.getMail();
return new MailAccount().setFrom(from).setAuth(true) return new MailAccount().setFrom(from).setAuth(true)
.setUser(account.getUsername()).setPass(account.getPassword()) .setUser(account.getUsername()).setPass(account.getPassword().toCharArray())
.setHost(account.getHost()).setPort(account.getPort()).setSslEnable(account.getSslEnable()); .setHost(account.getHost()).setPort(account.getPort())
.setSslEnable(account.getSslEnable()).setStarttlsEnable(account.getStarttlsEnable());
} }
@VisibleForTesting @VisibleForTesting

View File

@ -520,6 +520,7 @@ CREATE TABLE IF NOT EXISTS "system_mail_account" (
"host" varchar NOT NULL, "host" varchar NOT NULL,
"port" int NOT NULL, "port" int NOT NULL,
"ssl_enable" bit NOT NULL, "ssl_enable" bit NOT NULL,
"starttls_enable" bit NOT NULL,
"creator" varchar DEFAULT '', "creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '', "updater" varchar DEFAULT '',