|
@@ -3,8 +3,11 @@ package cn.iocoder.yudao.module.system.controller.admin.mail;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
-import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.*;
|
|
|
|
-import cn.iocoder.yudao.module.system.convert.mail.MailAccountConvert;
|
|
|
|
|
|
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountPageReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountRespVO;
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountSaveReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.mail.vo.account.MailAccountSimpleRespVO;
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.mail.MailAccountDO;
|
|
import cn.iocoder.yudao.module.system.service.mail.MailAccountService;
|
|
import cn.iocoder.yudao.module.system.service.mail.MailAccountService;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
@@ -30,14 +33,14 @@ public class MailAccountController {
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@Operation(summary = "创建邮箱账号")
|
|
@Operation(summary = "创建邮箱账号")
|
|
@PreAuthorize("@ss.hasPermission('system:mail-account:create')")
|
|
@PreAuthorize("@ss.hasPermission('system:mail-account:create')")
|
|
- public CommonResult<Long> createMailAccount(@Valid @RequestBody MailAccountCreateReqVO createReqVO) {
|
|
|
|
|
|
+ public CommonResult<Long> createMailAccount(@Valid @RequestBody MailAccountSaveReqVO createReqVO) {
|
|
return success(mailAccountService.createMailAccount(createReqVO));
|
|
return success(mailAccountService.createMailAccount(createReqVO));
|
|
}
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
@PutMapping("/update")
|
|
@Operation(summary = "修改邮箱账号")
|
|
@Operation(summary = "修改邮箱账号")
|
|
@PreAuthorize("@ss.hasPermission('system:mail-account:update')")
|
|
@PreAuthorize("@ss.hasPermission('system:mail-account:update')")
|
|
- public CommonResult<Boolean> updateMailAccount(@Valid @RequestBody MailAccountUpdateReqVO updateReqVO) {
|
|
|
|
|
|
+ public CommonResult<Boolean> updateMailAccount(@Valid @RequestBody MailAccountSaveReqVO updateReqVO) {
|
|
mailAccountService.updateMailAccount(updateReqVO);
|
|
mailAccountService.updateMailAccount(updateReqVO);
|
|
return success(true);
|
|
return success(true);
|
|
}
|
|
}
|
|
@@ -56,23 +59,23 @@ public class MailAccountController {
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
@PreAuthorize("@ss.hasPermission('system:mail-account:get')")
|
|
@PreAuthorize("@ss.hasPermission('system:mail-account:get')")
|
|
public CommonResult<MailAccountRespVO> getMailAccount(@RequestParam("id") Long id) {
|
|
public CommonResult<MailAccountRespVO> getMailAccount(@RequestParam("id") Long id) {
|
|
- MailAccountDO mailAccountDO = mailAccountService.getMailAccount(id);
|
|
|
|
- return success(MailAccountConvert.INSTANCE.convert(mailAccountDO));
|
|
|
|
|
|
+ MailAccountDO account = mailAccountService.getMailAccount(id);
|
|
|
|
+ return success(BeanUtils.toBean(account, MailAccountRespVO.class));
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/page")
|
|
@GetMapping("/page")
|
|
@Operation(summary = "获得邮箱账号分页")
|
|
@Operation(summary = "获得邮箱账号分页")
|
|
@PreAuthorize("@ss.hasPermission('system:mail-account:query')")
|
|
@PreAuthorize("@ss.hasPermission('system:mail-account:query')")
|
|
- public CommonResult<PageResult<MailAccountBaseVO>> getMailAccountPage(@Valid MailAccountPageReqVO pageReqVO) {
|
|
|
|
|
|
+ public CommonResult<PageResult<MailAccountRespVO>> getMailAccountPage(@Valid MailAccountPageReqVO pageReqVO) {
|
|
PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(pageReqVO);
|
|
PageResult<MailAccountDO> pageResult = mailAccountService.getMailAccountPage(pageReqVO);
|
|
- return success(MailAccountConvert.INSTANCE.convertPage(pageResult));
|
|
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, MailAccountRespVO.class));
|
|
}
|
|
}
|
|
|
|
|
|
- @GetMapping("/list-all-simple")
|
|
|
|
|
|
+ @GetMapping({"/list-all-simple", "simple-list"})
|
|
@Operation(summary = "获得邮箱账号精简列表")
|
|
@Operation(summary = "获得邮箱账号精简列表")
|
|
public CommonResult<List<MailAccountSimpleRespVO>> getSimpleMailAccountList() {
|
|
public CommonResult<List<MailAccountSimpleRespVO>> getSimpleMailAccountList() {
|
|
List<MailAccountDO> list = mailAccountService.getMailAccountList();
|
|
List<MailAccountDO> list = mailAccountService.getMailAccountList();
|
|
- return success(MailAccountConvert.INSTANCE.convertList02(list));
|
|
|
|
|
|
+ return success(BeanUtils.toBean(list, MailAccountSimpleRespVO.class));
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|