refactor: 邮件和站内信模板更新api

This commit is contained in:
caiyuchao
2025-08-01 10:34:44 +08:00
parent 44353d1da2
commit dcb6af43f5
6 changed files with 192 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
package org.agt.module.system.api.mail;
import jakarta.annotation.Resource;
import org.agt.framework.common.pojo.CommonResult;
import org.agt.framework.common.util.object.BeanUtils;
import org.agt.module.system.api.mail.dto.MailTemplateSaveReqDTO;
import org.agt.module.system.controller.admin.mail.vo.template.MailTemplateSaveReqVO;
import org.agt.module.system.service.mail.MailTemplateService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import static org.agt.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
public class MailTemplateApiImpl implements MailTemplateApi {
@Resource
private MailTemplateService mailTemplateService;
@Override
public CommonResult<Boolean> updateMailTemplate(MailTemplateSaveReqDTO reqDTO) {
MailTemplateSaveReqVO reqVO = BeanUtils.toBean(reqDTO, MailTemplateSaveReqVO.class);
mailTemplateService.updateMailTemplate(reqVO);
return success(true);
}
}

View File

@@ -0,0 +1,27 @@
package org.agt.module.system.api.notify;
import jakarta.annotation.Resource;
import org.agt.framework.common.pojo.CommonResult;
import org.agt.framework.common.util.object.BeanUtils;
import org.agt.module.system.api.notify.dto.NotifyTemplateSaveReqDTO;
import org.agt.module.system.controller.admin.notify.vo.template.NotifyTemplateSaveReqVO;
import org.agt.module.system.service.notify.NotifyTemplateService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
import static org.agt.framework.common.pojo.CommonResult.success;
@RestController // 提供 RESTful API 接口,给 Feign 调用
@Validated
public class NotifyTemplateApiImpl implements NotifyTemplateApi {
@Resource
private NotifyTemplateService notifyTemplateService;
@Override
public CommonResult<Boolean> updateNotifyTemplate(NotifyTemplateSaveReqDTO reqDTO) {
notifyTemplateService.updateNotifyTemplate(BeanUtils.toBean(reqDTO, NotifyTemplateSaveReqVO.class));
return success(true);
}
}