Commit 132c8b0e84d7741d3990f10cdc012cb1a490b9b7
1 parent
de10aa6a
邮箱模版增删改查功能 修改mapstruct 相关bug
Showing
22 changed files
with
393 additions
and
88 deletions
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
| @@ -121,7 +121,10 @@ public interface ErrorCodeConstants { | @@ -121,7 +121,10 @@ public interface ErrorCodeConstants { | ||
| 121 | 121 | ||
| 122 | // ========== 邮箱账号 1002019000 ========== | 122 | // ========== 邮箱账号 1002019000 ========== |
| 123 | ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002019000, "邮箱账号不存在"); | 123 | ErrorCode MAIL_ACCOUNT_NOT_EXISTS = new ErrorCode(1002019000, "邮箱账号不存在"); |
| 124 | - ErrorCode MAIL_ACCOUNT_EXISTS = new ErrorCode(1002019000, "邮箱账号存在"); | 124 | + ErrorCode MAIL_ACCOUNT_EXISTS = new ErrorCode(1002019001, "邮箱账号存在"); |
| 125 | 125 | ||
| 126 | + // ========== 邮箱账号 1002020000 ========== | ||
| 127 | + ErrorCode MAIL_TEMPLATE_NOT_EXISTS = new ErrorCode(1002020000 , "邮箱模版不存在"); | ||
| 128 | + ErrorCode MAIL_TEMPLATE_EXISTS = new ErrorCode(1002020001, "邮箱账号存在"); | ||
| 126 | 129 | ||
| 127 | } | 130 | } |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailAccountController.java
| @@ -24,14 +24,13 @@ import java.util.List; | @@ -24,14 +24,13 @@ import java.util.List; | ||
| 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | -@Api(tags = "管理后台 - 邮件模板") | 27 | +@Api(tags = "管理后台 - 邮件账号") |
| 28 | @RestController | 28 | @RestController |
| 29 | @RequestMapping("/system/mail-account") | 29 | @RequestMapping("/system/mail-account") |
| 30 | public class MailAccountController { | 30 | public class MailAccountController { |
| 31 | @Resource | 31 | @Resource |
| 32 | private MailAccountService mailAccountService; | 32 | private MailAccountService mailAccountService; |
| 33 | 33 | ||
| 34 | - | ||
| 35 | @PostMapping("/create") | 34 | @PostMapping("/create") |
| 36 | @ApiOperation("创建邮箱账号") | 35 | @ApiOperation("创建邮箱账号") |
| 37 | @PreAuthorize("@ss.hasPermission('system:mail-account:create')") | 36 | @PreAuthorize("@ss.hasPermission('system:mail-account:create')") |
| @@ -69,14 +68,14 @@ public class MailAccountController { | @@ -69,14 +68,14 @@ public class MailAccountController { | ||
| 69 | @GetMapping("/page") | 68 | @GetMapping("/page") |
| 70 | @ApiOperation("获得邮箱账号分页") | 69 | @ApiOperation("获得邮箱账号分页") |
| 71 | @PreAuthorize("@ss.hasPermission('system:mail-account:query')") | 70 | @PreAuthorize("@ss.hasPermission('system:mail-account:query')") |
| 72 | - public CommonResult<PageResult<MailAccountBaseVO>> getSmsChannelPage(@Valid MailAccountPageReqVO pageReqVO) { | 71 | + public CommonResult<PageResult<MailAccountBaseVO>> getMailAccountPage(@Valid MailAccountPageReqVO pageReqVO) { |
| 73 | PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(pageReqVO); | 72 | PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(pageReqVO); |
| 74 | return success(MailAccountConvert.INSTANCE.convertPage(pageResult)); | 73 | return success(MailAccountConvert.INSTANCE.convertPage(pageResult)); |
| 75 | } | 74 | } |
| 76 | 75 | ||
| 77 | @GetMapping("/list-all-simple") | 76 | @GetMapping("/list-all-simple") |
| 78 | @ApiOperation(value = "获得邮箱账号精简列表") | 77 | @ApiOperation(value = "获得邮箱账号精简列表") |
| 79 | - public CommonResult<List<MailAccountBaseVO>> getSimpleSmsChannels() { | 78 | + public CommonResult<List<MailAccountBaseVO>> getSimpleMailAccountList() { |
| 80 | List<MailAccountDO> list = mailAccountService.getMailAccountList(); | 79 | List<MailAccountDO> list = mailAccountService.getMailAccountList(); |
| 81 | // 排序后,返回给前端 | 80 | // 排序后,返回给前端 |
| 82 | list.sort(Comparator.comparing(MailAccountDO::getId)); | 81 | list.sort(Comparator.comparing(MailAccountDO::getId)); |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailLogController.java
| @@ -8,14 +8,13 @@ import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.*; | @@ -8,14 +8,13 @@ import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.*; | ||
| 8 | import cn.iocoder.yudao.module.system.convert.mail.MailLogConvert; | 8 | import cn.iocoder.yudao.module.system.convert.mail.MailLogConvert; |
| 9 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; |
| 10 | import cn.iocoder.yudao.module.system.service.mail.MailLogService; | 10 | import cn.iocoder.yudao.module.system.service.mail.MailLogService; |
| 11 | +import io.swagger.annotations.Api; | ||
| 11 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.security.access.prepost.PreAuthorize; | 14 | import org.springframework.security.access.prepost.PreAuthorize; |
| 14 | import org.springframework.web.bind.annotation.GetMapping; | 15 | import org.springframework.web.bind.annotation.GetMapping; |
| 15 | import org.springframework.web.bind.annotation.RequestMapping; | 16 | import org.springframework.web.bind.annotation.RequestMapping; |
| 16 | - | ||
| 17 | import org.springframework.web.bind.annotation.RestController; | 17 | import org.springframework.web.bind.annotation.RestController; |
| 18 | - | ||
| 19 | import javax.servlet.http.HttpServletResponse; | 18 | import javax.servlet.http.HttpServletResponse; |
| 20 | import javax.validation.Valid; | 19 | import javax.validation.Valid; |
| 21 | 20 | ||
| @@ -24,14 +23,8 @@ import java.util.List; | @@ -24,14 +23,8 @@ import java.util.List; | ||
| 24 | 23 | ||
| 25 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 26 | 25 | ||
| 27 | -/** | ||
| 28 | - * <p> | ||
| 29 | - * 邮箱日志功能 | ||
| 30 | - * </p> | ||
| 31 | - * | ||
| 32 | - * @author wangjingyi | ||
| 33 | - * @since 2022-03-21 | ||
| 34 | - */ | 26 | + |
| 27 | +@Api(tags = "管理后台 - 邮件日志") | ||
| 35 | @RestController | 28 | @RestController |
| 36 | @RequestMapping("/system/mail-log") | 29 | @RequestMapping("/system/mail-log") |
| 37 | public class MailLogController { | 30 | public class MailLogController { |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTemplateController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateBaseVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert; | ||
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | ||
| 11 | +import cn.iocoder.yudao.module.system.service.mail.MailTemplateService; | ||
| 12 | +import io.swagger.annotations.Api; | ||
| 13 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 14 | +import io.swagger.annotations.ApiOperation; | ||
| 15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 16 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 17 | +import org.springframework.web.bind.annotation.*; | ||
| 18 | + | ||
| 19 | +import javax.validation.Valid; | ||
| 20 | + | ||
| 21 | +import java.util.Comparator; | ||
| 22 | +import java.util.List; | ||
| 23 | + | ||
| 24 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 25 | + | ||
| 26 | +@Api(tags = "管理后台 - 邮件模版") | ||
| 27 | +@RestController | ||
| 28 | +@RequestMapping("/system/mail-template") | ||
| 29 | +public class MailTemplateController { | ||
| 30 | + @Autowired | ||
| 31 | + MailTemplateService mailTempleService; | ||
| 32 | + | ||
| 33 | + @PostMapping("/create") | ||
| 34 | + @ApiOperation("创建邮箱模版") | ||
| 35 | + @PreAuthorize("@ss.hasPermission('system:mail-template:create')") | ||
| 36 | + public CommonResult<Long> createMailTemplate(@Valid @RequestBody MailTemplateCreateReqVO createReqVO){ | ||
| 37 | + return success(mailTempleService.create(createReqVO)); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @PutMapping("/update") | ||
| 41 | + @ApiOperation("修改邮箱模版") | ||
| 42 | + @PreAuthorize("@ss.hasPermission('system:mail-template:update')") | ||
| 43 | + public CommonResult<Boolean> updateMailTemplate(@Valid @RequestBody MailTemplateUpdateReqVO updateReqVO){ | ||
| 44 | + mailTempleService.update(updateReqVO); | ||
| 45 | + return success(true); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @DeleteMapping("/delete") | ||
| 49 | + @ApiOperation("删除邮箱模版") | ||
| 50 | + @PreAuthorize("@ss.hasPermission('system:mail-template:delete')") | ||
| 51 | + public CommonResult<Boolean> deleteMailTemplate(@Valid @RequestBody Long id) { | ||
| 52 | + mailTempleService.delete(id); | ||
| 53 | + return success(true); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @GetMapping("/get") | ||
| 57 | + @ApiOperation("获得邮箱模版") | ||
| 58 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | ||
| 59 | + @PreAuthorize("@ss.hasPermission('system:mail-template:get')") | ||
| 60 | + public CommonResult<MailTemplateBaseVO> getMailTemplate(@RequestParam("id") Long id) { | ||
| 61 | + MailTemplateDO mailTemplateDO = mailTempleService.getMailTemplate(id); | ||
| 62 | + return success(MailTemplateConvert.INSTANCE.convert(mailTemplateDO)); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + | ||
| 66 | + @GetMapping("/page") | ||
| 67 | + @ApiOperation("获得邮箱模版分页") | ||
| 68 | + @PreAuthorize("@ss.hasPermission('system:mail-account:query')") | ||
| 69 | + public CommonResult<PageResult<MailTemplateBaseVO>> getMailTemplatePage(@Valid MailTemplatePageReqVO pageReqVO) { | ||
| 70 | + PageResult<MailTemplateDO> pageResult = mailTempleService.getMailTemplatePage(pageReqVO); | ||
| 71 | + return success(MailTemplateConvert.INSTANCE.convertPage(pageResult)); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @GetMapping("/list-all-simple") | ||
| 75 | + @ApiOperation(value = "获得邮箱模版精简列表") | ||
| 76 | + public CommonResult<List<MailTemplateBaseVO>> getSimpleTemplateList() { | ||
| 77 | + List<MailTemplateDO> list = mailTempleService.getMailTemplateList(); | ||
| 78 | + // 排序后,返回给前端 | ||
| 79 | + list.sort(Comparator.comparing(MailTemplateDO::getId)); | ||
| 80 | + return success(MailTemplateConvert.INSTANCE.convertList02(list)); | ||
| 81 | + } | ||
| 82 | +} |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/MailTempleController.java deleted
| 1 | -package cn.iocoder.yudao.module.system.controller.admin.mail; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 5 | - | ||
| 6 | -import org.springframework.web.bind.annotation.RestController; | ||
| 7 | - | ||
| 8 | -/** | ||
| 9 | - * <p> | ||
| 10 | - * 前端控制器 | ||
| 11 | - * </p> | ||
| 12 | - * | ||
| 13 | - * @author wangjingyi | ||
| 14 | - * @since 2022-03-21 | ||
| 15 | - */ | ||
| 16 | -@RestController | ||
| 17 | -@RequestMapping("/system-mail-temple") | ||
| 18 | -public class MailTempleController { | ||
| 19 | - | ||
| 20 | -} |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/log/MailLogBaseVO.java
| @@ -15,10 +15,10 @@ public class MailLogBaseVO { | @@ -15,10 +15,10 @@ public class MailLogBaseVO { | ||
| 15 | private String from; | 15 | private String from; |
| 16 | 16 | ||
| 17 | @ApiModelProperty(value = "模版编号" , required = false , example = "templeId") | 17 | @ApiModelProperty(value = "模版编号" , required = false , example = "templeId") |
| 18 | - private String templeId; | 18 | + private String templateId; |
| 19 | 19 | ||
| 20 | @ApiModelProperty(value = "模版code" , required = false , example = "templeCode") | 20 | @ApiModelProperty(value = "模版code" , required = false , example = "templeCode") |
| 21 | - private String templeCode; | 21 | + private String templateCode; |
| 22 | 22 | ||
| 23 | @ApiModelProperty(value = "标题" , required = false , example = "芋道源码") | 23 | @ApiModelProperty(value = "标题" , required = false , example = "芋道源码") |
| 24 | private String title; | 24 | private String title; |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/log/MailLogExcelVO.java
| 1 | package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log; | 1 | package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log; |
| 2 | 2 | ||
| 3 | import com.alibaba.excel.annotation.ExcelProperty; | 3 | import com.alibaba.excel.annotation.ExcelProperty; |
| 4 | +import lombok.Data; | ||
| 4 | import org.springframework.format.annotation.DateTimeFormat; | 5 | import org.springframework.format.annotation.DateTimeFormat; |
| 5 | 6 | ||
| 6 | import java.sql.Timestamp; | 7 | import java.sql.Timestamp; |
| 7 | 8 | ||
| 8 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 9 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 9 | 10 | ||
| 11 | +@Data | ||
| 10 | public class MailLogExcelVO { | 12 | public class MailLogExcelVO { |
| 11 | 13 | ||
| 12 | @ExcelProperty(value = "邮箱" ) | 14 | @ExcelProperty(value = "邮箱" ) |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/log/MailLogPageReqVO.java
| @@ -8,16 +8,17 @@ import org.springframework.format.annotation.DateTimeFormat; | @@ -8,16 +8,17 @@ import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | import java.sql.Timestamp; | 8 | import java.sql.Timestamp; |
| 9 | 9 | ||
| 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | + | ||
| 11 | @Data | 12 | @Data |
| 12 | public class MailLogPageReqVO extends PageParam { | 13 | public class MailLogPageReqVO extends PageParam { |
| 13 | @ApiModelProperty(value = "邮箱" , required = false , example = "yudaoyuanma@123.com") | 14 | @ApiModelProperty(value = "邮箱" , required = false , example = "yudaoyuanma@123.com") |
| 14 | private String from; | 15 | private String from; |
| 15 | 16 | ||
| 16 | @ApiModelProperty(value = "模版编号" , required = false , example = "templeId") | 17 | @ApiModelProperty(value = "模版编号" , required = false , example = "templeId") |
| 17 | - private String templeId; | 18 | + private String templateId; |
| 18 | 19 | ||
| 19 | @ApiModelProperty(value = "模版code" , required = false , example = "templeCode") | 20 | @ApiModelProperty(value = "模版code" , required = false , example = "templeCode") |
| 20 | - private String templeCode; | 21 | + private String templateCode; |
| 21 | 22 | ||
| 22 | @ApiModelProperty(value = "标题" , required = false , example = "芋道源码") | 23 | @ApiModelProperty(value = "标题" , required = false , example = "芋道源码") |
| 23 | private String title; | 24 | private String title; |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/log/MailLogRespVO.java
| 1 | package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log; | 1 | package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log; |
| 2 | 2 | ||
| 3 | -public class MailLogRespVO extends MailLogBaseVO { | 3 | +import io.swagger.annotations.ApiModelProperty; |
| 4 | +import lombok.Data; | ||
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | + | ||
| 7 | +import java.sql.Timestamp; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | +@Data | ||
| 11 | +public class MailLogRespVO { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty(value = "邮箱" , required = false , example = "yudaoyuanma@123.com") | ||
| 14 | + private String from; | ||
| 15 | + | ||
| 16 | + @ApiModelProperty(value = "模版编号" , required = false , example = "templeId") | ||
| 17 | + private String templateId; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty(value = "模版code" , required = false , example = "templeCode") | ||
| 20 | + private String templateCode; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty(value = "标题" , required = false , example = "芋道源码") | ||
| 23 | + private String title; | ||
| 24 | + | ||
| 25 | + @ApiModelProperty(value = "内容" , required = false , example = "遇到源码") | ||
| 26 | + private String content; | ||
| 27 | + | ||
| 28 | + @ApiModelProperty(value = "收件人" , required = false , example = "yudaoyuanma@456.com") | ||
| 29 | + private String to; | ||
| 30 | + | ||
| 31 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 32 | + @ApiModelProperty(value = "发送时间" , required = false , example = "2022-03-26 03:45:20") | ||
| 33 | + private Timestamp sendTime; | ||
| 34 | + | ||
| 35 | + @ApiModelProperty(value = "发送状态" , required = false , example = "1") | ||
| 36 | + private Boolean sendStatus; | ||
| 37 | + | ||
| 38 | + @ApiModelProperty(value = "发送结果" , required = false , example = "yudaoyuanma@123.com") | ||
| 39 | + private String sendResult; | ||
| 40 | + | ||
| 4 | } | 41 | } |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModelProperty; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +@Data | ||
| 7 | +public class MailTemplateBaseVO { | ||
| 8 | + @ApiModelProperty("主键") | ||
| 9 | + private Long id; | ||
| 10 | + | ||
| 11 | + @ApiModelProperty("名称") | ||
| 12 | + private String name; | ||
| 13 | + | ||
| 14 | + @ApiModelProperty("标识") | ||
| 15 | + private String code; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty("发件人") | ||
| 18 | + private String username; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty("标题") | ||
| 21 | + private String title; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty("内容") | ||
| 24 | + private String content; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty("状态") | ||
| 27 | + private String status; | ||
| 28 | + | ||
| 29 | + @ApiModelProperty("备注") | ||
| 30 | + private String remark; | ||
| 31 | +} |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateCreateReqVO.java
0 → 100644
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplatePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@Data | ||
| 8 | +public class MailTemplatePageReqVO extends PageParam { | ||
| 9 | + @ApiModelProperty("主键") | ||
| 10 | + private Long id; | ||
| 11 | + | ||
| 12 | + @ApiModelProperty("名称") | ||
| 13 | + private String name; | ||
| 14 | + | ||
| 15 | + @ApiModelProperty("标识") | ||
| 16 | + private String code; | ||
| 17 | + | ||
| 18 | + @ApiModelProperty("发件人") | ||
| 19 | + private String username; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty("标题") | ||
| 22 | + private String title; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty("内容") | ||
| 25 | + private String content; | ||
| 26 | + | ||
| 27 | + @ApiModelProperty("状态") | ||
| 28 | + private String status; | ||
| 29 | + | ||
| 30 | + @ApiModelProperty("备注") | ||
| 31 | + private String remark; | ||
| 32 | +} |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/template/MailTemplateUpdateReqVO.java
0 → 100644
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/mail/MailTemplateConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.convert.mail; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountBaseVO; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateBaseVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.convert.errorcode.ErrorCodeConvertImpl; | ||
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | ||
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | ||
| 10 | +import org.mapstruct.Mapper; | ||
| 11 | +import org.mapstruct.factory.Mappers; | ||
| 12 | + | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +@Mapper | ||
| 16 | +public interface MailTemplateConvert { | ||
| 17 | + MailTemplateConvert INSTANCE = Mappers.getMapper(MailTemplateConvert.class); | ||
| 18 | + | ||
| 19 | + MailTemplateDO convert(MailTemplateBaseVO baseVO); | ||
| 20 | + | ||
| 21 | + MailTemplateBaseVO convert(MailTemplateDO mailTemplateDO); | ||
| 22 | + | ||
| 23 | + PageResult<MailTemplateBaseVO> convertPage(PageResult<MailTemplateDO> pageResult); | ||
| 24 | + | ||
| 25 | + List<MailTemplateBaseVO> convertList02(List<MailTemplateDO> list); | ||
| 26 | +} |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailLogDO.java
| 1 | package cn.iocoder.yudao.module.system.dal.dataobject.mail; | 1 | package cn.iocoder.yudao.module.system.dal.dataobject.mail; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import com.baomidou.mybatisplus.annotation.IdType; | ||
| 5 | import java.sql.Timestamp; | 4 | import java.sql.Timestamp; |
| 6 | import com.baomidou.mybatisplus.annotation.TableId; | 5 | import com.baomidou.mybatisplus.annotation.TableId; |
| 7 | import com.baomidou.mybatisplus.annotation.TableField; | 6 | import com.baomidou.mybatisplus.annotation.TableField; |
| 8 | import java.io.Serializable; | 7 | import java.io.Serializable; |
| 9 | import io.swagger.annotations.ApiModel; | 8 | import io.swagger.annotations.ApiModel; |
| 10 | -import io.swagger.annotations.ApiModelProperty; | ||
| 11 | import lombok.Data; | 9 | import lombok.Data; |
| 12 | import lombok.EqualsAndHashCode; | 10 | import lombok.EqualsAndHashCode; |
| 13 | import lombok.experimental.Accessors; | 11 | import lombok.experimental.Accessors; |
| 14 | 12 | ||
| 15 | /** | 13 | /** |
| 16 | * <p> | 14 | * <p> |
| 17 | - * | 15 | + * 邮箱日志 |
| 18 | * </p> | 16 | * </p> |
| 19 | * | 17 | * |
| 20 | * @author wangjingyi | 18 | * @author wangjingyi |
| @@ -36,11 +34,11 @@ public class MailLogDO extends BaseDO implements Serializable { | @@ -36,11 +34,11 @@ public class MailLogDO extends BaseDO implements Serializable { | ||
| 36 | @TableField("from") | 34 | @TableField("from") |
| 37 | private String from; | 35 | private String from; |
| 38 | 36 | ||
| 39 | - @TableField("temple_id") | ||
| 40 | - private String templeId; | 37 | + @TableField("template_id") |
| 38 | + private String templateId; | ||
| 41 | 39 | ||
| 42 | - @TableField("temple_code") | ||
| 43 | - private String templeCode; | 40 | + @TableField("template_code") |
| 41 | + private String templateCode; | ||
| 44 | 42 | ||
| 45 | @TableField("title") | 43 | @TableField("title") |
| 46 | private String title; | 44 | private String title; |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailTempleDO.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/mail/MailTemplateDO.java
| @@ -13,7 +13,7 @@ import lombok.experimental.Accessors; | @@ -13,7 +13,7 @@ import lombok.experimental.Accessors; | ||
| 13 | 13 | ||
| 14 | /** | 14 | /** |
| 15 | * <p> | 15 | * <p> |
| 16 | - * 邮箱账号 | 16 | + * 邮箱模版 |
| 17 | * </p> | 17 | * </p> |
| 18 | * | 18 | * |
| 19 | * @author wangjingyi | 19 | * @author wangjingyi |
| @@ -22,8 +22,8 @@ import lombok.experimental.Accessors; | @@ -22,8 +22,8 @@ import lombok.experimental.Accessors; | ||
| 22 | @Data | 22 | @Data |
| 23 | @EqualsAndHashCode(callSuper = true) | 23 | @EqualsAndHashCode(callSuper = true) |
| 24 | @Accessors(chain = true) | 24 | @Accessors(chain = true) |
| 25 | -@ApiModel(value="SystemMailTemple对象", description="") | ||
| 26 | -public class MailTempleDO extends BaseDO implements Serializable { | 25 | +@ApiModel(value="SystemMailTemplate对象", description="") |
| 26 | +public class MailTemplateDO extends BaseDO implements Serializable { | ||
| 27 | 27 | ||
| 28 | private static final long serialVersionUID = 1L; | 28 | private static final long serialVersionUID = 1L; |
| 29 | @TableId | 29 | @TableId |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailLogMapper.java
| @@ -6,15 +6,16 @@ import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | @@ -6,15 +6,16 @@ import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | ||
| 6 | import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogExportReqVO; | 6 | import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogExportReqVO; |
| 7 | import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO; | 7 | import cn.iocoder.yudao.module.system.controller.admin.mail.vo.log.MailLogPageReqVO; |
| 8 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; | 8 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO; |
| 9 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | 10 | ||
| 10 | import java.util.List; | 11 | import java.util.List; |
| 11 | - | 12 | +@Mapper |
| 12 | public interface MailLogMapper extends BaseMapperX<MailLogDO> { | 13 | public interface MailLogMapper extends BaseMapperX<MailLogDO> { |
| 13 | 14 | ||
| 14 | default PageResult<MailLogDO> selectPage(MailLogPageReqVO pageVO){ | 15 | default PageResult<MailLogDO> selectPage(MailLogPageReqVO pageVO){ |
| 15 | return selectPage(pageVO , new QueryWrapperX<MailLogDO>() | 16 | return selectPage(pageVO , new QueryWrapperX<MailLogDO>() |
| 16 | .eqIfPresent("from", pageVO.getFrom()) | 17 | .eqIfPresent("from", pageVO.getFrom()) |
| 17 | - .eqIfPresent("templeCode", pageVO.getTempleCode()) | 18 | + .eqIfPresent("templeCode", pageVO.getTemplateCode()) |
| 18 | .likeIfPresent("title" , pageVO.getTitle()) | 19 | .likeIfPresent("title" , pageVO.getTitle()) |
| 19 | .likeIfPresent("content" , pageVO.getContent()) | 20 | .likeIfPresent("content" , pageVO.getContent()) |
| 20 | .eqIfPresent("to", pageVO.getTo()) | 21 | .eqIfPresent("to", pageVO.getTo()) |
| @@ -28,7 +29,7 @@ public interface MailLogMapper extends BaseMapperX<MailLogDO> { | @@ -28,7 +29,7 @@ public interface MailLogMapper extends BaseMapperX<MailLogDO> { | ||
| 28 | default List<MailLogDO> selectList(MailLogExportReqVO exportReqVO){ | 29 | default List<MailLogDO> selectList(MailLogExportReqVO exportReqVO){ |
| 29 | return selectList(new QueryWrapperX<MailLogDO>() | 30 | return selectList(new QueryWrapperX<MailLogDO>() |
| 30 | .eqIfPresent("from", exportReqVO.getFrom()) | 31 | .eqIfPresent("from", exportReqVO.getFrom()) |
| 31 | - .eqIfPresent("templeCode", exportReqVO.getTempleCode()) | 32 | + .eqIfPresent("templeCode", exportReqVO.getTemplateCode()) |
| 32 | .likeIfPresent("title" , exportReqVO.getTitle()) | 33 | .likeIfPresent("title" , exportReqVO.getTitle()) |
| 33 | .likeIfPresent("content" , exportReqVO.getContent()) | 34 | .likeIfPresent("content" , exportReqVO.getContent()) |
| 34 | .eqIfPresent("to", exportReqVO.getTo()) | 35 | .eqIfPresent("to", exportReqVO.getTo()) |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailTemplateMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.mysql.mail; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +@Mapper | ||
| 12 | +public interface MailTemplateMapper extends BaseMapperX<MailTemplateDO> { | ||
| 13 | + | ||
| 14 | + default PageResult<MailTemplateDO> selectPage(MailTemplatePageReqVO pageReqVO){ | ||
| 15 | + return selectPage(pageReqVO , new QueryWrapperX<MailTemplateDO>() | ||
| 16 | + .likeIfPresent("name" , pageReqVO.getName()) | ||
| 17 | + .likeIfPresent("username" , pageReqVO.getUsername()) | ||
| 18 | + .likeIfPresent("title" , pageReqVO.getTitle()) | ||
| 19 | + .likeIfPresent("content" , pageReqVO.getContent()) | ||
| 20 | + .eqIfPresent("status" , pageReqVO.getStatus()) | ||
| 21 | + .likeIfPresent("remark" , pageReqVO.getRemark()) | ||
| 22 | + ); | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | +} |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/MailTempleMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.system.dal.mysql.mail; | ||
| 2 | - | ||
| 3 | -import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTempleDO; | ||
| 4 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
| 5 | - | ||
| 6 | -/** | ||
| 7 | - * <p> | ||
| 8 | - * Mapper 接口 | ||
| 9 | - * </p> | ||
| 10 | - * | ||
| 11 | - * @author wangjingyi | ||
| 12 | - * @since 2022-03-21 | ||
| 13 | - */ | ||
| 14 | -public interface MailTempleMapper extends BaseMapper<MailTempleDO> { | ||
| 15 | - | ||
| 16 | -} |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTempleService.java renamed to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailTemplateService.java
| 1 | package cn.iocoder.yudao.module.system.service.mail; | 1 | package cn.iocoder.yudao.module.system.service.mail; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | ||
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 3 | /** | 12 | /** |
| 4 | * <p> | 13 | * <p> |
| 5 | * 服务类 | 14 | * 服务类 |
| @@ -8,6 +17,17 @@ package cn.iocoder.yudao.module.system.service.mail; | @@ -8,6 +17,17 @@ package cn.iocoder.yudao.module.system.service.mail; | ||
| 8 | * @author wangjingyi | 17 | * @author wangjingyi |
| 9 | * @since 2022-03-21 | 18 | * @since 2022-03-21 |
| 10 | */ | 19 | */ |
| 11 | -public interface MailTempleService { | 20 | +public interface MailTemplateService { |
| 21 | + | ||
| 22 | + Long create(MailTemplateCreateReqVO createReqVO); | ||
| 23 | + | ||
| 24 | + void update(MailTemplateUpdateReqVO updateReqVO); | ||
| 25 | + | ||
| 26 | + void delete(Long id); | ||
| 27 | + | ||
| 28 | + MailTemplateDO getMailTemplate(Long id); | ||
| 29 | + | ||
| 30 | + PageResult<MailTemplateDO> getMailTemplatePage(MailTemplatePageReqVO pageReqVO); | ||
| 12 | 31 | ||
| 32 | + List<MailTemplateDO> getMailTemplateList(); | ||
| 13 | } | 33 | } |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailTemplateServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.mail.impl; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.system.convert.mail.MailTemplateConvert; | ||
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO; | ||
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO; | ||
| 11 | +import cn.iocoder.yudao.module.system.dal.mysql.mail.MailTemplateMapper; | ||
| 12 | +import cn.iocoder.yudao.module.system.service.mail.MailTemplateService; | ||
| 13 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
| 14 | +import org.springframework.stereotype.Service; | ||
| 15 | + | ||
| 16 | +import javax.annotation.Resource; | ||
| 17 | +import java.util.HashMap; | ||
| 18 | +import java.util.List; | ||
| 19 | +import java.util.Map; | ||
| 20 | + | ||
| 21 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 22 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | ||
| 23 | + | ||
| 24 | +/** | ||
| 25 | + * <p> | ||
| 26 | + * 邮箱模版 服务实现类 | ||
| 27 | + * </p> | ||
| 28 | + * | ||
| 29 | + * @author wangjingyi | ||
| 30 | + * @since 2022-03-21 | ||
| 31 | + */ | ||
| 32 | +@Service | ||
| 33 | +public class MailTemplateServiceImpl implements MailTemplateService { | ||
| 34 | + @Resource | ||
| 35 | + private MailTemplateMapper mailTemplateMapper; | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public Long create(MailTemplateCreateReqVO createReqVO) { | ||
| 39 | + // name 要校验唯一 | ||
| 40 | + Map<String , String> map = new HashMap<>(); | ||
| 41 | + map.put("name" , createReqVO.getName()); | ||
| 42 | + this.validateMailTemplateOnly(map); | ||
| 43 | + MailTemplateDO mailTemplateDO = MailTemplateConvert.INSTANCE.convert(createReqVO); | ||
| 44 | + mailTemplateMapper.insert(mailTemplateDO); | ||
| 45 | + return mailTemplateDO.getId(); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public void update(MailTemplateUpdateReqVO updateReqVO) { | ||
| 50 | + // username 要校验唯一 | ||
| 51 | + Map<String , String> map = new HashMap<>(); | ||
| 52 | + map.put("username" , updateReqVO.getUsername()); | ||
| 53 | + this.validateMailTemplateOnly(map); | ||
| 54 | + MailTemplateDO mailTemplateDO = MailTemplateConvert.INSTANCE.convert(updateReqVO); | ||
| 55 | + // 校验是否存在 | ||
| 56 | + this.validateMailTemplateExists(mailTemplateDO.getId()); | ||
| 57 | + mailTemplateMapper.updateById(mailTemplateDO); | ||
| 58 | + } | ||
| 59 | + @Override | ||
| 60 | + public void delete(Long id) { | ||
| 61 | + // 校验是否存在 | ||
| 62 | + this.validateMailTemplateExists(id); | ||
| 63 | + mailTemplateMapper.deleteById(id); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public MailTemplateDO getMailTemplate(Long id) {return mailTemplateMapper.selectById(id);} | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public PageResult<MailTemplateDO> getMailTemplatePage(MailTemplatePageReqVO pageReqVO) { | ||
| 71 | + return mailTemplateMapper.selectPage(pageReqVO); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public List<MailTemplateDO> getMailTemplateList() {return mailTemplateMapper.selectList();} | ||
| 76 | + | ||
| 77 | + private void validateMailTemplateExists(Long id) { | ||
| 78 | + if (mailTemplateMapper.selectById(id) == null) { | ||
| 79 | + throw exception(MAIL_TEMPLATE_NOT_EXISTS); | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + private void validateMailTemplateOnly(Map params){ | ||
| 84 | + QueryWrapper queryWrapper = new QueryWrapper<MailTemplateDO>(); | ||
| 85 | + params.forEach((k , v)->{ | ||
| 86 | + queryWrapper.like(k , v); | ||
| 87 | + }); | ||
| 88 | + if (mailTemplateMapper.selectOne(queryWrapper) != null) { | ||
| 89 | + throw exception(MAIL_TEMPLATE_EXISTS); | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | +} |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/MailTempleServiceImpl.java deleted
| 1 | -package cn.iocoder.yudao.module.system.service.mail.impl; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -import cn.iocoder.yudao.module.system.service.mail.MailTempleService; | ||
| 5 | -import org.springframework.stereotype.Service; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * <p> | ||
| 9 | - * 服务实现类 | ||
| 10 | - * </p> | ||
| 11 | - * | ||
| 12 | - * @author wangjingyi | ||
| 13 | - * @since 2022-03-21 | ||
| 14 | - */ | ||
| 15 | -@Service | ||
| 16 | -public class MailTempleServiceImpl implements MailTempleService { | ||
| 17 | - | ||
| 18 | -} |