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