Commit 50f7af00e9249108f8113e4ffd3e480c9651dfa9
1 parent
3b42b706
code review 邮件账号模块
Showing
5 changed files
with
26 additions
and
14 deletions
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/SystemMailAccountController.java
| ... | ... | @@ -5,16 +5,9 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 7 | import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.SystemMailAccountBaseVO; |
| 8 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelCreateReqVO; | |
| 9 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; | |
| 10 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelRespVO; | |
| 11 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSimpleRespVO; | |
| 12 | 8 | import cn.iocoder.yudao.module.system.convert.mail.SystemMailAccountConvert; |
| 13 | -import cn.iocoder.yudao.module.system.convert.sms.SmsChannelConvert; | |
| 14 | 9 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailAccountDO; |
| 15 | -import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | |
| 16 | 10 | import cn.iocoder.yudao.module.system.service.mail.SystemMailAccountService; |
| 17 | -import cn.iocoder.yudao.module.system.service.sms.SmsChannelService; | |
| 18 | 11 | import io.swagger.annotations.Api; |
| 19 | 12 | import io.swagger.annotations.ApiImplicitParam; |
| 20 | 13 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -23,12 +16,12 @@ import org.springframework.web.bind.annotation.*; |
| 23 | 16 | |
| 24 | 17 | import javax.annotation.Resource; |
| 25 | 18 | import javax.validation.Valid; |
| 26 | - | |
| 27 | 19 | import java.util.Comparator; |
| 28 | 20 | import java.util.List; |
| 29 | 21 | |
| 30 | 22 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 31 | 23 | |
| 24 | +// TODO @ジョイイ:使用 Swagger 注解,不用写这个注释啦 | |
| 32 | 25 | /** |
| 33 | 26 | * <p> |
| 34 | 27 | * 前端控制器 |
| ... | ... | @@ -39,11 +32,13 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 39 | 32 | */ |
| 40 | 33 | @Api(tags = "管理后台 - 邮件模板") |
| 41 | 34 | @RestController |
| 42 | -@RequestMapping("/system-mail-account") | |
| 35 | +@RequestMapping("/system-mail-account") // TODO @ジョイイ:/system/mail-account | |
| 43 | 36 | public class SystemMailAccountController { |
| 44 | 37 | @Resource |
| 45 | 38 | private SystemMailAccountService systemMailAccountService; |
| 46 | 39 | |
| 40 | + // TODO @ジョイイ:最好,VO 分拆下,参考下别的模块 | |
| 41 | + | |
| 47 | 42 | @PostMapping("/create") |
| 48 | 43 | @ApiOperation("创建邮箱账号") |
| 49 | 44 | @PreAuthorize("@ss.hasPermission('system:system-mail-account:create')") |
| ... | ... | @@ -59,6 +54,8 @@ public class SystemMailAccountController { |
| 59 | 54 | return success(true); |
| 60 | 55 | } |
| 61 | 56 | |
| 57 | + // TODO @ジョイイ:删除,编号即可 | |
| 58 | + | |
| 62 | 59 | @DeleteMapping("/delete") |
| 63 | 60 | @ApiOperation("删除邮箱账号") |
| 64 | 61 | @PreAuthorize("@ss.hasPermission('system:system-mail-account:delete')") |
| ... | ... | @@ -76,6 +73,8 @@ public class SystemMailAccountController { |
| 76 | 73 | return success(SystemMailAccountConvert.INSTANCE.convert(systemMailAccountDO)); |
| 77 | 74 | } |
| 78 | 75 | |
| 76 | + // TODO @ジョイイ:分页的查询条件 | |
| 77 | + | |
| 79 | 78 | @GetMapping("/page") |
| 80 | 79 | @ApiOperation("获得邮箱账号分页") |
| 81 | 80 | @PreAuthorize("@ss.hasPermission('system:system-mail-account:query')") | ... | ... |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/mail/vo/account/SystemMailAccountBaseVO.java
| 1 | 1 | package cn.iocoder.yudao.module.system.controller.admin.mail.vo.account; |
| 2 | 2 | |
| 3 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 4 | 3 | import io.swagger.annotations.ApiModelProperty; |
| 5 | 4 | import lombok.Data; |
| 6 | 5 | |
| 6 | +// TODO @ジョイイ:System 去掉哈 | |
| 7 | 7 | @Data |
| 8 | 8 | public class SystemMailAccountBaseVO { |
| 9 | + | |
| 10 | + // TODO @ジョイイ:example 写的不太对,这个应该是邮箱; | |
| 9 | 11 | @ApiModelProperty(value = "来源" , required = true , example = "yudaoyuanma") |
| 10 | 12 | private String from; |
| 11 | 13 | |
| ... | ... | @@ -21,6 +23,7 @@ public class SystemMailAccountBaseVO { |
| 21 | 23 | @ApiModelProperty(value = "端口" , required = true , example = "80") |
| 22 | 24 | private String port; |
| 23 | 25 | |
| 26 | + // TODO @ジョイイ:Boolean | |
| 24 | 27 | @ApiModelProperty(value = "是否开启ssl" , required = true , example = "2") |
| 25 | 28 | private Integer sslEnable; |
| 26 | 29 | } | ... | ... |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/mail/SystemMailAccountMapper.java
| ... | ... | @@ -4,12 +4,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; |
| 7 | -import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; | |
| 8 | 7 | import cn.iocoder.yudao.module.system.dal.dataobject.mail.SystemMailAccountDO; |
| 9 | -import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsChannelDO; | |
| 10 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 11 | 9 | |
| 12 | - | |
| 10 | +// TODO @ジョイイ: Mapper 一般不用注释,因为用途不大 | |
| 13 | 11 | /** |
| 14 | 12 | * <p> |
| 15 | 13 | * Mapper 接口 | ... | ... |
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/SystemMailAccountService.java
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/mail/impl/SystemMailAccountServiceImpl.java
| ... | ... | @@ -12,6 +12,8 @@ import org.springframework.stereotype.Service; |
| 12 | 12 | import javax.annotation.Resource; |
| 13 | 13 | import java.util.List; |
| 14 | 14 | |
| 15 | +// TODO @ジョイイ:类注释,应该是 邮箱账号 Service 实现类 | |
| 16 | + | |
| 15 | 17 | /** |
| 16 | 18 | * <p> |
| 17 | 19 | * 服务实现类 |
| ... | ... | @@ -22,24 +24,32 @@ import java.util.List; |
| 22 | 24 | */ |
| 23 | 25 | @Service |
| 24 | 26 | public class SystemMailAccountServiceImpl implements SystemMailAccountService { |
| 27 | + // TODO @ジョイイ: private | |
| 25 | 28 | @Resource |
| 26 | - SystemMailAccountMapper systemMailAccountMapper; | |
| 29 | + SystemMailAccountMapper systemMailAccountMapper; // TODO @ジョイイ: 变量,和方法要空一行 | |
| 27 | 30 | @Override |
| 28 | 31 | public Long create(SystemMailAccountBaseVO baseVO) { |
| 32 | + // TODO @ジョイイ: username 要校验唯一 | |
| 29 | 33 | SystemMailAccountDO systemMailAccountDO = SystemMailAccountConvert.INSTANCE.convert(baseVO); |
| 30 | 34 | systemMailAccountMapper.insert(systemMailAccountDO); |
| 31 | 35 | return systemMailAccountDO.getId(); |
| 32 | 36 | } |
| 33 | 37 | |
| 38 | + // TODO @ジョイイ: 不用返回值,void 即可 | |
| 34 | 39 | @Override |
| 35 | 40 | public String update(SystemMailAccountBaseVO baseVO) { |
| 41 | + // TODO @ジョイイ: username 要校验唯一 | |
| 42 | + // TODO @ジョイイ: 校验是否存在 | |
| 36 | 43 | SystemMailAccountDO systemMailAccountDO = SystemMailAccountConvert.INSTANCE.convert(baseVO); |
| 37 | 44 | systemMailAccountMapper.updateById(systemMailAccountDO); |
| 38 | 45 | return null; |
| 39 | 46 | } |
| 40 | 47 | |
| 48 | + // TODO @ジョイイ: 不用返回值,void 即可 | |
| 49 | + | |
| 41 | 50 | @Override |
| 42 | 51 | public String delete(SystemMailAccountBaseVO baseVO) { |
| 52 | + // TODO @ジョイイ: 校验是否存在 | |
| 43 | 53 | SystemMailAccountDO systemMailAccountDO = SystemMailAccountConvert.INSTANCE.convert(baseVO); |
| 44 | 54 | systemMailAccountMapper.deleteById(systemMailAccountDO); |
| 45 | 55 | return null; | ... | ... |