邮件模块swagger注释修改

This commit is contained in:
wangjingyi 2022-03-30 14:20:32 +08:00
parent 1a120cd07c
commit f349fbf84a
19 changed files with 166 additions and 37 deletions

View File

@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccou
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.controller.admin.mail.vo.send.MailSendVO;
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.send.MailReqVO;
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;
@ -29,8 +29,9 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@RestController
@RequestMapping("/system/mail-account")
public class MailAccountController {
@Resource
private MailAccountService mailAccountService; // TODO @wangjingyi属性和类名中间要空一行
private MailAccountService mailAccountService;
@PostMapping("/create")
@ApiOperation("创建邮箱账号")
@ -50,8 +51,9 @@ public class MailAccountController {
@DeleteMapping("/delete")
@ApiOperation("删除邮箱账号")
@PreAuthorize("@ss.hasPermission('system:mail-account:delete')") // TODO @wangjingyiid 应该是 @RequestParam另外id swagger 注解要写下
public CommonResult<Boolean> deleteMailAccount(@Valid @RequestBody Long id) {
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('system:mail-account:delete')")
public CommonResult<Boolean> deleteMailAccount(@Valid @RequestParam Long id) {
mailAccountService.delete(id);
return success(true);
}
@ -63,8 +65,7 @@ public class MailAccountController {
public CommonResult<MailAccountBaseVO> getMailAccount(@RequestParam("id") Long id) {
MailAccountDO mailAccountDO = mailAccountService.getMailAccount(id);
return success(MailAccountConvert.INSTANCE.convert(mailAccountDO));
} // TODO wangjingyi方法与方法之间只空一行
}
@GetMapping("/page")
@ApiOperation("获得邮箱账号分页")
@ -82,11 +83,12 @@ public class MailAccountController {
list.sort(Comparator.comparing(MailAccountDO::getId));
return success(MailAccountConvert.INSTANCE.convertList02(list));
}
@PostMapping("/send") // TODO wangjingyi方法与方法之间空一行
@PostMapping("/send")
@ApiOperation("发送邮件")
@PreAuthorize("@ss.hasPermission('system:mail-account:send')")
public CommonResult<Boolean> sendMail(MailSendVO mailSendVO){
mailAccountService.sendMail(mailSendVO);
public CommonResult<Boolean> sendMail(MailReqVO mailReqVO){
mailAccountService.sendMail(mailReqVO);
return success(true);
}
}

View File

@ -1,8 +1,9 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("管理后台 - 邮箱账号基类 Base VO")
@Data
public class MailAccountBaseVO {

View File

@ -1,8 +1,14 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data // TODO @wangjingyiswagger 注解
public class MailAccountCreateReqVO extends MailAccountBaseVO{ // TODO @wangjingyi要空格再 {
@ApiModel("管理后台 - 邮箱账号创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MailAccountCreateReqVO extends MailAccountBaseVO {
}

View File

@ -1,10 +1,16 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ApiModel("管理后台 - 邮箱账号分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MailAccountPageReqVO extends PageParam {
@ApiModelProperty(value = "邮箱" , required = true , example = "yudaoyuanma@123.com")
private String from;

View File

@ -1,10 +1,21 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@ApiModel("管理后台 - 邮箱账号修改 Request VO")
@Data
public class MailAccountUpdateReqVO extends MailAccountBaseVO{
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MailAccountUpdateReqVO extends MailAccountBaseVO {
// TODO @wangjingyi更新的话是不是要有个 id
@ApiModelProperty(value = "编号", required = true, example = "1024")
@NotNull(message = "编号不能为空")
private Long id;
}

View File

@ -2,13 +2,17 @@ package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.sql.Timestamp;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 邮箱日志基类 Base VO")
@Data
public class MailLogBaseVO {
@ApiModelProperty(value = "邮箱" , required = false , example = "yudaoyuanma@123.com")

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -8,6 +9,7 @@ import java.sql.Timestamp;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 邮箱日志导出 Request VO")
@Data
public class MailLogExcelVO {

View File

@ -1,4 +1,9 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
public class MailLogExportReqVO extends MailLogPageReqVO{
import io.swagger.annotations.ApiModel;
import lombok.Data;
@ApiModel("管理后台 - 邮箱日志导出 Request VO")
@Data
public class MailLogExportReqVO extends MailLogPageReqVO {
}

View File

@ -1,15 +1,21 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.sql.Timestamp;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 邮箱日志分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MailLogPageReqVO extends PageParam {
@ApiModelProperty(value = "邮箱" , required = false , example = "yudaoyuanma@123.com")
private String from;

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.log;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@ -7,6 +8,8 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.sql.Timestamp;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 邮箱日志返回 Request VO")
@Data
public class MailLogRespVO {

View File

@ -1,8 +1,10 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("管理后台 - 邮箱模版基类 Base VO")
@Data
public class MailTemplateBaseVO {
@ApiModelProperty("主键")

View File

@ -1,10 +1,15 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ApiModel("管理后台 - 邮箱模版创建 Request VO")
@Data
public class MailTemplateCreateReqVO extends MailTemplateBaseVO{
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MailTemplateCreateReqVO extends MailTemplateBaseVO {
}

View File

@ -1,10 +1,16 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ApiModel("管理后台 - 邮箱模版分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MailTemplatePageReqVO extends PageParam {
@ApiModelProperty("主键")
private Long id;

View File

@ -1,7 +1,20 @@
package cn.iocoder.yudao.module.system.controller.admin.mail.vo.template;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@ApiModel("管理后台 - 邮箱模版修改 Request VO")
@Data
public class MailTemplateUpdateReqVO extends MailTemplateBaseVO{
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MailTemplateUpdateReqVO extends MailTemplateBaseVO {
@ApiModelProperty(value = "编号", required = true, example = "1024")
@NotNull(message = "编号不能为空")
private Long id;
}

View File

@ -4,33 +4,61 @@ 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.controller.admin.mail.vo.send.MailSendVO;
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.send.MailReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
import java.util.List;
/**
* <p>
* 邮箱账号 Service 接口
* </p> // TODO wangjingyi不用 <p></p> 标签
*
* @author wangjingyi
* @since 2022-03-21
*/
public interface MailAccountService { // TODO wangjingyi方法的注释
public interface MailAccountService {
/**
* 创建邮箱账号
* @param createReqVO
* @return
*/
Long create(MailAccountCreateReqVO createReqVO);
/**
* 修改邮箱账号
* @param updateReqVO
*/
void update(MailAccountUpdateReqVO updateReqVO);
/**
* 删除邮箱账号
* @param id
*/
void delete(Long id);
/**
* 获取邮箱账号信息
* @param id
* @return
*/
MailAccountDO getMailAccount(Long id);
/**
* 获取邮箱账号分页信息
* @param pageReqVO
* @return
*/
PageResult<MailAccountDO> getMailAccountPage(MailAccountPageReqVO pageReqVO);
/**
* 获取邮箱数组信息
* @return
*/
List<MailAccountDO> getMailAccountList();
void sendMail(MailSendVO mailSendVO);
/**
* 发送邮件
* @param mailReqVO
*/
void sendMail(MailReqVO mailReqVO);
}

View File

@ -9,16 +9,23 @@ import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailLogDO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
* 邮箱日志服务类
*
* @author wangjingyi
* @since 2022-03-21
*/
public interface MailLogService {
/**
* 邮箱日志分页
* @param pageVO
* @return
*/
PageResult<MailLogDO> getMailLogPage(MailLogPageReqVO pageVO);
/**
* 邮箱日志数组信息
* @param exportReqVO
* @return
*/
List<MailLogDO> getMailLogList(MailLogExportReqVO exportReqVO);
}

View File

@ -4,30 +4,53 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateCreateReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplatePageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mail.vo.template.MailTemplateUpdateReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailTemplateDO;
import java.util.List;
/**
* <p>
* 服务类
* </p>
* 邮箱模版服务类
*
* @author wangjingyi
* @since 2022-03-21
*/
public interface MailTemplateService {
/**
* 邮箱模版创建
* @param createReqVO
* @return
*/
Long create(MailTemplateCreateReqVO createReqVO);
/**
* 邮箱模版修改
* @param updateReqVO
*/
void update(MailTemplateUpdateReqVO updateReqVO);
/**
* 邮箱模版删除
* @param id
*/
void delete(Long id);
/**
* 获取邮箱模版
* @param id
* @return
*/
MailTemplateDO getMailTemplate(Long id);
/**
* 获取邮箱模版分页
* @param pageReqVO
* @return
*/
PageResult<MailTemplateDO> getMailTemplatePage(MailTemplatePageReqVO pageReqVO);
/**
* 获取邮箱模板数组
* @return
*/
List<MailTemplateDO> getMailTemplateList();
}

View File

@ -13,15 +13,14 @@ import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 邮箱日志实现类
* </p>
*
* @author wangjingyi
* @since 2022-03-21
*/
@Service
public class MailLogServiceImpl implements MailLogService {
@Autowired
MailLogMapper mailLogMapper;

View File

@ -22,15 +22,14 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* <p>
* 邮箱模版 服务实现类
* </p>
*
* @author wangjingyi
* @since 2022-03-21
*/
@Service
public class MailTemplateServiceImpl implements MailTemplateService {
@Resource
private MailTemplateMapper mailTemplateMapper;
@ -56,6 +55,7 @@ public class MailTemplateServiceImpl implements MailTemplateService {
this.validateMailTemplateExists(mailTemplateDO.getId());
mailTemplateMapper.updateById(mailTemplateDO);
}
@Override
public void delete(Long id) {
// 校验是否存在