diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index 6b44615ce..0cdab761c 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -119,4 +119,9 @@ public interface ErrorCodeConstants { ErrorCode SOCIAL_USER_UNBIND_NOT_SELF = new ErrorCode(1002018001, "社交解绑失败,非当前用户绑定"); ErrorCode SOCIAL_USER_NOT_FOUND = new ErrorCode(1002018002, "社交授权失败,找不到对应的用户"); + // ========== 邮箱账号 1002019000 ========== + ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002019000, "邮箱账号不存在"); + ErrorCode MAIL_ACCOUNT_EXISTS = new ErrorCode(1002019000, "邮箱账号存在"); + + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java new file mode 100644 index 000000000..5cace6378 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java @@ -0,0 +1,85 @@ +package cn.iocoder.yudao.module.system.controller.admin.mail; + + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountBaseVO; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO; +import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert; +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; +import cn.iocoder.yudao.module.system.service.mail.MailAccountService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiOperation; +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; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + + +@Api(tags = "管理后台 - 邮件模板") +@RestController +@RequestMapping("/system/mail-account") +public class MailAccountController { + @Resource + private MailAccountService mailAccountService; + + + @PostMapping("/create") + @ApiOperation("创建邮箱账号") + @PreAuthorize("@ss.hasPermission('system:mail-account:create')") + public CommonResult createMailAccount(@Valid @RequestBody MailAccountCreateReqVO createReqVO) { + return success(mailAccountService.create(createReqVO)); + } + + @PutMapping("/update") + @ApiOperation("修改邮箱账号") + @PreAuthorize("@ss.hasPermission('system:mail-account:update')") + public CommonResult updateMailAccount(@Valid @RequestBody MailAccountUpdateReqVO updateReqVO) { + mailAccountService.update(updateReqVO); + return success(true); + } + + + @DeleteMapping("/delete") + @ApiOperation("删除邮箱账号") + @PreAuthorize("@ss.hasPermission('system:mail-account:delete')") + public CommonResult deleteMailAccount(@Valid @RequestBody Long id) { + mailAccountService.delete(id); + return success(true); + } + + @GetMapping("/get") + @ApiOperation("获得邮箱账号") + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) + @PreAuthorize("@ss.hasPermission('system:mail-account:get')") + public CommonResult getMailAccount(@RequestParam("id") Long id) { + MailAccountDO mailAccountDO = mailAccountService.getMailAccount(id); + return success(MailAccountConvert.INSTANCE.convert(mailAccountDO)); + } + + + @GetMapping("/page") + @ApiOperation("获得邮箱账号分页") + @PreAuthorize("@ss.hasPermission('system:mail-account:query')") + public CommonResult> getSmsChannelPage(@Valid MailAccountPageReqVO pageReqVO) { + PageResult pageResult = mailAccountService.getMailAccountPage(pageReqVO); + return success(MailAccountConvert.INSTANCE.convertPage(pageResult)); + } + + @GetMapping("/list-all-simple") + @ApiOperation(value = "获得邮箱账号精简列表") + public CommonResult> getSimpleSmsChannels() { + List list = mailAccountService.getMailAccountList(); + // 排序后,返回给前端 + list.sort(Comparator.comparing(MailAccountDO::getId)); + return success(MailAccountConvert.INSTANCE.convertList02(list)); + } +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailLogController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java similarity index 85% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailLogController.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java index 710e3f4d3..2bc87c6ac 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailLogController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java @@ -1,20 +1,20 @@ -package cn.iocoder.yudao.module.system.controller.admin.mail; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.RestController; - -/** - *

- * 前端控制器 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@RestController -@RequestMapping("/system-mail-log") -public class SystemMailLogController { - -} +package cn.iocoder.yudao.module.system.controller.admin.mail; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +@RestController +@RequestMapping("/system-mail-log") +public class MailLogController { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailTempleController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTempleController.java similarity index 84% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailTempleController.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTempleController.java index 7b76958d1..7a4151fbe 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailTempleController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTempleController.java @@ -1,20 +1,20 @@ -package cn.iocoder.yudao.module.system.controller.admin.mail; - - -import org.springframework.web.bind.annotation.RequestMapping; - -import org.springframework.web.bind.annotation.RestController; - -/** - *

- * 前端控制器 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@RestController -@RequestMapping("/system-mail-temple") -public class SystemMailTempleController { - -} +package cn.iocoder.yudao.module.system.controller.admin.mail; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +@RestController +@RequestMapping("/system-mail-temple") +public class MailTempleController { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailAccountController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailAccountController.java deleted file mode 100644 index c625b7cda..000000000 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailAccountController.java +++ /dev/null @@ -1,94 +0,0 @@ -package cn.iocoder.yudao.module.system.controller.admin.mail; - - -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.module.system.controller.admin.mail.vo.account.SystemMailAccountBaseVO; -import cn.iocoder.yudao.module.system.convert.mail.SystemMailAccountConvert; -import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailAccountDO; -import cn.iocoder.yudao.module.system.service.mail.SystemMailAccountService; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -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; - -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; - -// TODO @ジョイイ:使用 Swagger 注解,不用写这个注释啦 -/** - *

- * 前端控制器 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@Api(tags = "管理后台 - 邮件模板") -@RestController -@RequestMapping("/system-mail-account") // TODO @ジョイイ:/system/mail-account -public class SystemMailAccountController { - @Resource - private SystemMailAccountService systemMailAccountService; - - // TODO @ジョイイ:最好,VO 分拆下,参考下别的模块 - - @PostMapping("/create") - @ApiOperation("创建邮箱账号") - @PreAuthorize("@ss.hasPermission('system:system-mail-account:create')") - public CommonResult createMailAccount(@Valid @RequestBody SystemMailAccountBaseVO baseVO) { - return success(systemMailAccountService.create(baseVO)); - } - - @PutMapping("/update") - @ApiOperation("修改邮箱账号") - @PreAuthorize("@ss.hasPermission('system:system-mail-account:update')") - public CommonResult updateMailAccount(@Valid @RequestBody SystemMailAccountBaseVO baseVO) { - systemMailAccountService.update(baseVO); - return success(true); - } - - // TODO @ジョイイ:删除,编号即可 - - @DeleteMapping("/delete") - @ApiOperation("删除邮箱账号") - @PreAuthorize("@ss.hasPermission('system:system-mail-account:delete')") - public CommonResult deleteMailAccount(@Valid @RequestBody SystemMailAccountBaseVO baseVO) { - systemMailAccountService.delete(baseVO); - return success(true); - } - - @GetMapping("/get") - @ApiOperation("获得邮箱账号") - @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) - @PreAuthorize("@ss.hasPermission('system:system-mail-account:get')") - public CommonResult getMailAccount(@RequestParam("id") Long id) { - SystemMailAccountDO systemMailAccountDO = systemMailAccountService.getMailAccount(id); - return success(SystemMailAccountConvert.INSTANCE.convert(systemMailAccountDO)); - } - - // TODO @ジョイイ:分页的查询条件 - - @GetMapping("/page") - @ApiOperation("获得邮箱账号分页") - @PreAuthorize("@ss.hasPermission('system:system-mail-account:query')") - public CommonResult> getSmsChannelPage(@Valid PageParam pageParam) { - PageResult pageResult = systemMailAccountService.getMailAccountPage(pageParam); - return success(SystemMailAccountConvert.INSTANCE.convertPage(pageResult)); - } - - @GetMapping("/list-all-simple") - @ApiOperation(value = "获得邮箱账号精简列表") - public CommonResult> getSimpleSmsChannels() { - List list = systemMailAccountService.getMailAccountList(); - // 排序后,返回给前端 - list.sort(Comparator.comparing(SystemMailAccountDO::getId)); - return success(SystemMailAccountConvert.INSTANCE.convertList02(list)); - } -} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/SystemMailAccountBaseVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountBaseVO.java similarity index 69% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/SystemMailAccountBaseVO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountBaseVO.java index 07352140c..7b65a0876 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/SystemMailAccountBaseVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountBaseVO.java @@ -3,12 +3,10 @@ package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -// TODO @ジョイイ:System 去掉哈 @Data -public class SystemMailAccountBaseVO { +public class MailAccountBaseVO { - // TODO @ジョイイ:example 写的不太对,这个应该是邮箱; - @ApiModelProperty(value = "来源" , required = true , example = "yudaoyuanma") + @ApiModelProperty(value = "邮箱" , required = true , example = "yudaoyuanma@123.com") private String from; @ApiModelProperty(value = "用户名" , required = true , example = "yudao") @@ -23,7 +21,6 @@ public class SystemMailAccountBaseVO { @ApiModelProperty(value = "端口" , required = true , example = "80") private String port; - // TODO @ジョイイ:Boolean @ApiModelProperty(value = "是否开启ssl" , required = true , example = "2") - private Integer sslEnable; + private Boolean sslEnable; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountCreateReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountCreateReqVO.java new file mode 100644 index 000000000..b07801cee --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountCreateReqVO.java @@ -0,0 +1,8 @@ +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; + +import lombok.Data; + +@Data +public class MailAccountCreateReqVO extends MailAccountBaseVO{ + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountPageReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountPageReqVO.java new file mode 100644 index 000000000..6ddbc2ae6 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountPageReqVO.java @@ -0,0 +1,26 @@ +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +public class MailAccountPageReqVO extends PageParam { + @ApiModelProperty(value = "邮箱" , required = true , example = "yudaoyuanma@123.com") + private String from; + + @ApiModelProperty(value = "用户名" , required = true , example = "yudao") + private String username; + + @ApiModelProperty(value = "密码" , required = true , example = "123456") + private String password; + + @ApiModelProperty(value = "网站" , required = true , example = "www.iocoder.cn") + private String host; + + @ApiModelProperty(value = "端口" , required = true , example = "80") + private String port; + + @ApiModelProperty(value = "是否开启ssl" , required = true , example = "2") + private Boolean sslEnable; +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountUpdateReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountUpdateReqVO.java new file mode 100644 index 000000000..9482ce474 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/MailAccountUpdateReqVO.java @@ -0,0 +1,8 @@ +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; + +import lombok.Data; + +@Data +public class MailAccountUpdateReqVO extends MailAccountBaseVO{ + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailAccountConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailAccountConvert.java new file mode 100644 index 000000000..a288dd84a --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailAccountConvert.java @@ -0,0 +1,22 @@ +package cn.iocoder.yudao.module.system.convert.mail; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountBaseVO; +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +@Mapper +public interface MailAccountConvert { + MailAccountConvert INSTANCE = Mappers.getMapper(MailAccountConvert.class); + + MailAccountDO convert (MailAccountBaseVO mailAccountBaseVO); + + MailAccountBaseVO convert (MailAccountDO mailAccountDO); + + PageResult convertPage(PageResult pageResult); + + List convertList02(List list); +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/SystemMailAccountConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/SystemMailAccountConvert.java deleted file mode 100644 index 465bff31f..000000000 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/SystemMailAccountConvert.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.yudao.module.system.convert.mail; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.SystemMailAccountBaseVO; -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelRespVO; -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSimpleRespVO; -import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailAccountDO; -import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface SystemMailAccountConvert { - SystemMailAccountConvert INSTANCE = Mappers.getMapper(SystemMailAccountConvert.class); - - SystemMailAccountDO convert (SystemMailAccountBaseVO systemMailAccountBaseVO); - - SystemMailAccountBaseVO convert (SystemMailAccountDO systemMailAccountDO); - - PageResult convertPage(PageResult pageResult); - - List convertList02(List list); -} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailAccountDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailAccountDO.java similarity index 75% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailAccountDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailAccountDO.java index c5d90dfd1..195bc0bb0 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailAccountDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailAccountDO.java @@ -1,54 +1,46 @@ -package cn.iocoder.yudao.module.system.dal.dataobject.mail; - -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableField; -import java.io.Serializable; - -import com.baomidou.mybatisplus.annotation.TableName; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - *

- * - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) -@ApiModel(value="SystemMailAccount对象", description="") -@TableName(value = "system_mail_account", autoResultMap = true) -public class SystemMailAccountDO extends BaseDO implements Serializable { - - private static final long serialVersionUID = 1L; - @TableId - private Long id; - - @TableField("from") - private String from; - - @TableField("username") - private String username; - - @TableField("password") - private String password; - - @TableField("host") - private String host; - - @TableField("port") - private String port; - - @TableField("sslEnable") - private Integer sslEnable; - - -} +package cn.iocoder.yudao.module.system.dal.dataobject.mail; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value="MailAccount对象", description="") +@TableName(value = "system_mail_account", autoResultMap = true) +public class MailAccountDO extends BaseDO implements Serializable { + + private static final long serialVersionUID = 1L; + @TableId + private Long id; + + @TableField("from") + private String from; + + @TableField("username") + private String username; + + @TableField("password") + private String password; + + @TableField("host") + private String host; + + @TableField("port") + private String port; + + @TableField("sslEnable") + private Boolean sslEnable; + + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailLogDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailLogDO.java similarity index 88% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailLogDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailLogDO.java index b909e0c37..0d435a8c3 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailLogDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailLogDO.java @@ -1,61 +1,61 @@ -package cn.iocoder.yudao.module.system.dal.dataobject.mail; - -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.IdType; -import java.sql.Timestamp; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableField; -import java.io.Serializable; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - *

- * - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) -@ApiModel(value="SystemMailLog对象", description="") -public class SystemMailLogDO extends BaseDO implements Serializable { - - private static final long serialVersionUID = 1L; - @TableId - private Long id; - - @TableField("account_code") - private String accountCode; - - @TableField("from") - private String from; - - @TableField("temple_code") - private String templeCode; - - @TableField("title") - private String title; - - @TableField("content") - private String content; - - @TableField("to") - private String to; - - @TableField("sendTime") - private Timestamp sendTime; - - @TableField("sendStatus") - private String sendStatus; - - @TableField("sendResult") - private String sendResult; - - -} +package cn.iocoder.yudao.module.system.dal.dataobject.mail; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.IdType; +import java.sql.Timestamp; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value="SystemMailLog对象", description="") +public class MailLogDO extends BaseDO implements Serializable { + + private static final long serialVersionUID = 1L; + @TableId + private Long id; + + @TableField("account_code") + private String accountCode; + + @TableField("from") + private String from; + + @TableField("temple_code") + private String templeCode; + + @TableField("title") + private String title; + + @TableField("content") + private String content; + + @TableField("to") + private String to; + + @TableField("sendTime") + private Timestamp sendTime; + + @TableField("sendStatus") + private String sendStatus; + + @TableField("sendResult") + private String sendResult; + + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailTempleDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailTempleDO.java similarity index 86% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailTempleDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailTempleDO.java index 3a13d1b4b..c48de644d 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/SystemMailTempleDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailTempleDO.java @@ -1,54 +1,54 @@ -package cn.iocoder.yudao.module.system.dal.dataobject.mail; - -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableField; -import java.io.Serializable; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - *

- * - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@Data -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) -@ApiModel(value="SystemMailTemple对象", description="") -public class SystemMailTempleDO extends BaseDO implements Serializable { - - private static final long serialVersionUID = 1L; - @TableId - private Long id; - - @TableField("name") - private String name; - - @TableField("code") - private String code; - - @TableField("username") - private String username; - - @TableField("title") - private String title; - - @TableField("content") - private String content; - - @TableField("status") - private String status; - - @TableField("remark") - private String remark; - - -} +package cn.iocoder.yudao.module.system.dal.dataobject.mail; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableField; +import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 邮箱账号 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@ApiModel(value="SystemMailTemple对象", description="") +public class MailTempleDO extends BaseDO implements Serializable { + + private static final long serialVersionUID = 1L; + @TableId + private Long id; + + @TableField("name") + private String name; + + @TableField("code") + private String code; + + @TableField("username") + private String username; + + @TableField("title") + private String title; + + @TableField("content") + private String content; + + @TableField("status") + private String status; + + @TableField("remark") + private String remark; + + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailAccountMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailAccountMapper.java new file mode 100644 index 000000000..f7e06862f --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailAccountMapper.java @@ -0,0 +1,23 @@ +package cn.iocoder.yudao.module.system.dal.mysql.mail; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface MailAccountMapper extends BaseMapperX { + + default PageResult selectPage(MailAccountPageReqVO pageReqVO) { + return selectPage(pageReqVO, new QueryWrapperX() + .likeIfPresent("form" , pageReqVO.getFrom()) + .likeIfPresent("host" , pageReqVO.getHost()) + .likeIfPresent("username" , pageReqVO.getUsername()) + .eqIfPresent("password" , pageReqVO.getPassword()) + .eqIfPresent("port" , pageReqVO.getPort()) + ); + } + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailLogMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailLogMapper.java similarity index 55% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailLogMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailLogMapper.java index 7432fdde3..2f6912812 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailLogMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailLogMapper.java @@ -1,16 +1,16 @@ -package cn.iocoder.yudao.module.system.dal.mysql.mail; - -import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailLogDO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -public interface SystemMailLogMapper extends BaseMapper { - -} +package cn.iocoder.yudao.module.system.dal.mysql.mail; + +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +public interface MailLogMapper extends BaseMapper { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailTempleMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailTempleMapper.java similarity index 53% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailTempleMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailTempleMapper.java index 0460cc7b2..0264ca301 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailTempleMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailTempleMapper.java @@ -1,16 +1,16 @@ -package cn.iocoder.yudao.module.system.dal.mysql.mail; - -import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailTempleDO; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; - -/** - *

- * Mapper 接口 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -public interface SystemMailTempleMapper extends BaseMapper { - -} +package cn.iocoder.yudao.module.system.dal.mysql.mail; + +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTempleDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * Mapper 接口 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +public interface MailTempleMapper extends BaseMapper { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailAccountMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailAccountMapper.java deleted file mode 100644 index d4855c1b2..000000000 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailAccountMapper.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.iocoder.yudao.module.system.dal.mysql.mail; - -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; -import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailAccountDO; -import org.apache.ibatis.annotations.Mapper; - -// TODO @ジョイイ: Mapper 一般不用注释,因为用途不大 -/** - *

- * Mapper 接口 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@Mapper -public interface SystemMailAccountMapper extends BaseMapperX { - - default PageResult selectPage(PageParam pageParam) { - return selectPage(pageParam, new QueryWrapperX()); - } - -} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java new file mode 100644 index 000000000..759263a40 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailAccountService.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.system.service.mail; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; + +import java.util.List; + + +/** + *

+ * 邮箱账号 Service 接口 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +public interface MailAccountService { + + Long create(MailAccountCreateReqVO createReqVO); + + void update(MailAccountUpdateReqVO updateReqVO); + + void delete(Long id); + + MailAccountDO getMailAccount(Long id); + + PageResult getMailAccountPage(MailAccountPageReqVO pageReqVO); + + List getMailAccountList(); +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailLogService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogService.java similarity index 71% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailLogService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogService.java index ff5043878..d5442936f 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailLogService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailLogService.java @@ -1,14 +1,14 @@ -package cn.iocoder.yudao.module.system.service.mail; - - -/** - *

- * 服务类 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -public interface SystemMailLogService { - -} +package cn.iocoder.yudao.module.system.service.mail; + + +/** + *

+ * 服务类 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +public interface MailLogService { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailTempleService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTempleService.java similarity index 71% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailTempleService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTempleService.java index 507b64b9a..3c14626f9 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailTempleService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTempleService.java @@ -1,13 +1,13 @@ -package cn.iocoder.yudao.module.system.service.mail; - -/** - *

- * 服务类 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -public interface SystemMailTempleService { - -} +package cn.iocoder.yudao.module.system.service.mail; + +/** + *

+ * 服务类 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +public interface MailTempleService { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailAccountService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailAccountService.java deleted file mode 100644 index b7ffbfa41..000000000 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailAccountService.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.yudao.module.system.service.mail; - -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.SystemMailAccountBaseVO; -import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailAccountDO; - -import java.util.List; - -// TODO @ジョイイ:类注释,应该是 邮箱账号 Service 接口 - -/** - *

- * 服务类 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -public interface SystemMailAccountService { - - Long create(SystemMailAccountBaseVO baseVO); - - String update(SystemMailAccountBaseVO baseVO); - - String delete(SystemMailAccountBaseVO baseVO); - - SystemMailAccountDO getMailAccount(Long id); - - PageResult getMailAccountPage(PageParam pageParam); - - List getMailAccountList(); -} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailAccountServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailAccountServiceImpl.java new file mode 100644 index 000000000..11625a7bc --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailAccountServiceImpl.java @@ -0,0 +1,99 @@ +package cn.iocoder.yudao.module.system.service.mail.impl; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountCreateReqVO; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountUpdateReqVO; +import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert; +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.service.mail.MailAccountService; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.MAIL_ACCOUNT_EXISTS; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.MAIL_ACCOUNT_NOT_EXISTS; + + +/** + *

+ * 邮箱账号 Service 实现类 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +@Service +public class MailAccountServiceImpl implements MailAccountService { + + @Resource + private MailAccountMapper mailAccountMapper; + + @Override + public Long create(MailAccountCreateReqVO createReqVO) { + // username 要校验唯一 + Map map = new HashMap<>(); + map.put("username" , createReqVO.getUsername()); + this.validateMailAccountOnly(map); + MailAccountDO mailAccountDO = MailAccountConvert.INSTANCE.convert(createReqVO); + mailAccountMapper.insert(mailAccountDO); + return mailAccountDO.getId(); + } + + @Override + public void update(MailAccountUpdateReqVO updateReqVO) { + // username 要校验唯一 + Map map = new HashMap<>(); + map.put("username" , updateReqVO.getUsername()); + this.validateMailAccountOnly(map); + MailAccountDO mailAccountDO = MailAccountConvert.INSTANCE.convert(updateReqVO); + // 校验是否存在 + this.validateMailAccountExists(mailAccountDO.getId()); + mailAccountMapper.updateById(mailAccountDO); + } + + + @Override + public void delete(Long id) { + // 校验是否存在 + this.validateMailAccountExists(id); + mailAccountMapper.deleteById(id); + } + + @Override + public MailAccountDO getMailAccount(Long id) { + return mailAccountMapper.selectById(id); + } + + @Override + public PageResult getMailAccountPage(MailAccountPageReqVO pageReqVO) { + return mailAccountMapper.selectPage(pageReqVO); + } + + @Override + public List getMailAccountList() { + return mailAccountMapper.selectList(); + } + + private void validateMailAccountExists(Long id) { + if (mailAccountMapper.selectById(id) == null) { + throw exception(MAIL_ACCOUNT_NOT_EXISTS); + } + } + + private void validateMailAccountOnly(Map params){ + QueryWrapper queryWrapper = new QueryWrapper(); + params.forEach((k , v)->{ + queryWrapper.like(k , v); + }); + if (mailAccountMapper.selectOne(queryWrapper) != null) { + throw exception(MAIL_ACCOUNT_EXISTS); + } + } +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailLogServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailLogServiceImpl.java similarity index 56% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailLogServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailLogServiceImpl.java index 4b17a3e21..af2ff6694 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailLogServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailLogServiceImpl.java @@ -1,18 +1,18 @@ -package cn.iocoder.yudao.module.system.service.mail.impl; - - -import cn.iocoder.yudao.module.system.service.mail.SystemMailLogService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@Service -public class SystemMailLogServiceImpl implements SystemMailLogService { - -} +package cn.iocoder.yudao.module.system.service.mail.impl; + + +import cn.iocoder.yudao.module.system.service.mail.MailLogService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +@Service +public class MailLogServiceImpl implements MailLogService { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailTempleServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailTempleServiceImpl.java similarity index 54% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailTempleServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailTempleServiceImpl.java index e59cb01ba..be83bccc8 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailTempleServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailTempleServiceImpl.java @@ -1,18 +1,18 @@ -package cn.iocoder.yudao.module.system.service.mail.impl; - - -import cn.iocoder.yudao.module.system.service.mail.SystemMailTempleService; -import org.springframework.stereotype.Service; - -/** - *

- * 服务实现类 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@Service -public class SystemMailTempleServiceImpl implements SystemMailTempleService { - -} +package cn.iocoder.yudao.module.system.service.mail.impl; + + +import cn.iocoder.yudao.module.system.service.mail.MailTempleService; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author wangjingyi + * @since 2022-03-21 + */ +@Service +public class MailTempleServiceImpl implements MailTempleService { + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailAccountServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailAccountServiceImpl.java deleted file mode 100644 index e1ef51267..000000000 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailAccountServiceImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -package cn.iocoder.yudao.module.system.service.mail.impl; - -import cn.iocoder.yudao.framework.common.pojo.PageParam; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.SystemMailAccountBaseVO; -import cn.iocoder.yudao.module.system.convert.mail.SystemMailAccountConvert; -import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailAccountDO; -import cn.iocoder.yudao.module.system.dal.mysql.mail.SystemMailAccountMapper; -import cn.iocoder.yudao.module.system.service.mail.SystemMailAccountService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.List; - -// TODO @ジョイイ:类注释,应该是 邮箱账号 Service 实现类 - -/** - *

- * 服务实现类 - *

- * - * @author wangjingyi - * @since 2022-03-21 - */ -@Service -public class SystemMailAccountServiceImpl implements SystemMailAccountService { - // TODO @ジョイイ: private - @Resource - SystemMailAccountMapper systemMailAccountMapper; // TODO @ジョイイ: 变量,和方法要空一行 - @Override - public Long create(SystemMailAccountBaseVO baseVO) { - // TODO @ジョイイ: username 要校验唯一 - SystemMailAccountDO systemMailAccountDO = SystemMailAccountConvert.INSTANCE.convert(baseVO); - systemMailAccountMapper.insert(systemMailAccountDO); - return systemMailAccountDO.getId(); - } - - // TODO @ジョイイ: 不用返回值,void 即可 - @Override - public String update(SystemMailAccountBaseVO baseVO) { - // TODO @ジョイイ: username 要校验唯一 - // TODO @ジョイイ: 校验是否存在 - SystemMailAccountDO systemMailAccountDO = SystemMailAccountConvert.INSTANCE.convert(baseVO); - systemMailAccountMapper.updateById(systemMailAccountDO); - return null; - } - - // TODO @ジョイイ: 不用返回值,void 即可 - - @Override - public String delete(SystemMailAccountBaseVO baseVO) { - // TODO @ジョイイ: 校验是否存在 - SystemMailAccountDO systemMailAccountDO = SystemMailAccountConvert.INSTANCE.convert(baseVO); - systemMailAccountMapper.deleteById(systemMailAccountDO); - return null; - } - - @Override - public SystemMailAccountDO getMailAccount(Long id) { - return systemMailAccountMapper.selectById(id); - } - - @Override - public PageResult getMailAccountPage(PageParam pageParam) { - return systemMailAccountMapper.selectPage(pageParam); - } - - @Override - public List getMailAccountList() { - return systemMailAccountMapper.selectList(); - } - -}