Browse Source

站内信基础代码整理,接口定义。

xrcoder 3 years ago
parent
commit
bb78a58029
30 changed files with 1244 additions and 0 deletions
  1. 34 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApi.java
  2. 33 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/dto/NotifySendSingleToUserReqDTO.java
  3. 6 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
  4. 22 0
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/notify/NotifyReadStatusEnum.java
  5. 39 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApiImpl.java
  6. 73 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyMessageController.java
  7. 99 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java
  8. 83 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/UserNotifyMessageController.java
  9. 40 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageBaseVO.java
  10. 15 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageCreateReqVO.java
  11. 27 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessagePageReqVO.java
  12. 19 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageRespVO.java
  13. 20 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageUpdateReqVO.java
  14. 34 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateBaseVO.java
  15. 12 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateCreateReqVO.java
  16. 42 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateExcelVO.java
  17. 28 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateExportReqVO.java
  18. 30 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplatePageReqVO.java
  19. 19 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateRespVO.java
  20. 17 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateUpdateReqVO.java
  21. 34 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/notify/NotifyMessageConvert.java
  22. 37 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/notify/NotifyTemplateConvert.java
  23. 59 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/notify/NotifyMessageDO.java
  24. 55 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/notify/NotifyTemplateDO.java
  25. 25 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java
  26. 39 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyTemplateMapper.java
  27. 65 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageService.java
  28. 78 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java
  29. 74 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateService.java
  30. 86 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateServiceImpl.java

+ 34 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApi.java

@@ -0,0 +1,34 @@
+package cn.iocoder.yudao.module.system.api.notify;
+
+import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
+
+import javax.validation.Valid;
+
+/**
+ * 站内信发送 API 接口
+ *
+ * @author xrcoder
+ */
+public interface NotifyMessageSendApi {
+
+    /**
+     * 发送单条站内信给 Admin 用户
+     * <p>
+     * 在 mobile 为空时,使用 userId 加载对应 Admin 的手机号
+     *
+     * @param reqDTO 发送请求
+     * @return 发送消息ID
+     */
+    Long sendSingleMessageToAdmin(@Valid NotifySendSingleToUserReqDTO reqDTO);
+
+    /**
+     * 发送单条站内信给 Member 用户
+     * <p>
+     * 在 mobile 为空时,使用 userId 加载对应 Member 的手机号
+     *
+     * @param reqDTO 发送请求
+     * @return 发送消息ID
+     */
+    Long sendSingleMessageToMember(@Valid NotifySendSingleToUserReqDTO reqDTO);
+
+}

+ 33 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/dto/NotifySendSingleToUserReqDTO.java

@@ -0,0 +1,33 @@
+package cn.iocoder.yudao.module.system.api.notify.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Map;
+
+/**
+ * 站内信发送给 Admin 或者 Member 用户
+ *
+ * @author xrcoder
+ */
+@Data
+public class NotifySendSingleToUserReqDTO {
+
+    /**
+     * 用户编号
+     */
+    @NotNull(message = "用户编号不能为空")
+    private Long userId;
+
+    /**
+     * 站内信模板编号
+     */
+    @NotEmpty(message = "站内信模板编号不能为空")
+    private String templateCode;
+
+    /**
+     * 站内信模板参数
+     */
+    private Map<String, Object> templateParams;
+}

+ 6 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java

@@ -142,4 +142,10 @@ public interface ErrorCodeConstants {
     ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1002022000, "code 不存在");
     ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1002022000, "code 已过期");
 
+    // ========== 站内信模版 1002023000 ==========
+    ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1002023000, "站内信模版不存在");
+
+    // ========== 站内信 1002024000 ==========
+    ErrorCode NOTIFY_MESSAGE_NOT_EXISTS = new ErrorCode(1002024000, "站内信不存在");
+
 }

+ 22 - 0
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/notify/NotifyReadStatusEnum.java

@@ -0,0 +1,22 @@
+package cn.iocoder.yudao.module.system.enums.notify;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * 站内信阅读状态枚举类
+ *
+ * @author xrcoder
+ */
+@Getter
+@AllArgsConstructor
+public enum NotifyReadStatusEnum {
+
+    UNREAD(0),
+    READ(1);
+
+    /**
+     * 类型
+     */
+    private final Integer status;
+}

+ 39 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApiImpl.java

@@ -0,0 +1,39 @@
+package cn.iocoder.yudao.module.system.api.notify;
+
+import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
+import org.springframework.stereotype.Service;
+
+/**
+ * 站内信发送 API 接口
+ *
+ * @author xrcoder
+ */
+@Service
+public class NotifyMessageSendApiImpl implements NotifyMessageSendApi {
+
+    /**
+     * 发送单条站内信给 Admin 用户
+     * <p>
+     * 在 mobile 为空时,使用 userId 加载对应 Admin 的手机号
+     *
+     * @param reqDTO 发送请求
+     * @return 发送消息ID
+     */
+    @Override
+    public Long sendSingleMessageToAdmin(NotifySendSingleToUserReqDTO reqDTO) {
+        return null;
+    }
+
+    /**
+     * 发送单条站内信给 Member 用户
+     * <p>
+     * 在 mobile 为空时,使用 userId 加载对应 Member 的手机号
+     *
+     * @param reqDTO 发送请求
+     * @return 发送消息ID
+     */
+    @Override
+    public Long sendSingleMessageToMember(NotifySendSingleToUserReqDTO reqDTO) {
+        return null;
+    }
+}

+ 73 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyMessageController.java

@@ -0,0 +1,73 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageCreateReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageUpdateReqVO;
+import cn.iocoder.yudao.module.system.convert.notify.NotifyMessageConvert;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
+import cn.iocoder.yudao.module.system.service.notify.NotifyMessageService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+@Api(tags = "管理后台 - 站内信")
+@RestController
+@RequestMapping("/system/notify-message")
+@Validated
+public class NotifyMessageController {
+
+    @Resource
+    private NotifyMessageService notifyMessageService;
+
+    @PostMapping("/create")
+    @ApiOperation("创建站内信")
+    @PreAuthorize("@ss.hasPermission('system:notify-message:create')")
+    public CommonResult<Long> createNotifyMessage(@Valid @RequestBody NotifyMessageCreateReqVO createReqVO) {
+        return success(notifyMessageService.createNotifyMessage(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @ApiOperation("更新站内信")
+    @PreAuthorize("@ss.hasPermission('system:notify-message:update')")
+    public CommonResult<Boolean> updateNotifyMessage(@Valid @RequestBody NotifyMessageUpdateReqVO updateReqVO) {
+        notifyMessageService.updateNotifyMessage(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @ApiOperation("删除站内信")
+    @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
+    @PreAuthorize("@ss.hasPermission('system:notify-message:delete')")
+    public CommonResult<Boolean> deleteNotifyMessage(@RequestParam("id") Long id) {
+        notifyMessageService.deleteNotifyMessage(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @ApiOperation("获得站内信")
+    @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
+    @PreAuthorize("@ss.hasPermission('system:notify-message:query')")
+    public CommonResult<NotifyMessageRespVO> getNotifyMessage(@RequestParam("id") Long id) {
+        NotifyMessageDO notifyMessage = notifyMessageService.getNotifyMessage(id);
+        return success(NotifyMessageConvert.INSTANCE.convert(notifyMessage));
+    }
+
+    @GetMapping("/page")
+    @ApiOperation("获得站内信分页")
+    @PreAuthorize("@ss.hasPermission('system:notify-message:query')")
+    public CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@Valid NotifyMessagePageReqVO pageVO) {
+        PageResult<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessagePage(pageVO);
+        return success(NotifyMessageConvert.INSTANCE.convertPage(pageResult));
+    }
+}

+ 99 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java

@@ -0,0 +1,99 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.*;
+import cn.iocoder.yudao.module.system.convert.notify.NotifyTemplateConvert;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
+import cn.iocoder.yudao.module.system.service.notify.NotifyTemplateService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
+
+@Api(tags = "管理后台 - 站内信模版")
+@RestController
+@RequestMapping("/system/notify-template")
+@Validated
+public class NotifyTemplateController {
+
+    @Resource
+    private NotifyTemplateService notifyTemplateService;
+
+    @PostMapping("/create")
+    @ApiOperation("创建站内信模版")
+    @PreAuthorize("@ss.hasPermission('system:notify-template:create')")
+    public CommonResult<Long> createNotifyTemplate(@Valid @RequestBody NotifyTemplateCreateReqVO createReqVO) {
+        return success(notifyTemplateService.createNotifyTemplate(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @ApiOperation("更新站内信模版")
+    @PreAuthorize("@ss.hasPermission('system:notify-template:update')")
+    public CommonResult<Boolean> updateNotifyTemplate(@Valid @RequestBody NotifyTemplateUpdateReqVO updateReqVO) {
+        notifyTemplateService.updateNotifyTemplate(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @ApiOperation("删除站内信模版")
+    @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
+    @PreAuthorize("@ss.hasPermission('system:notify-template:delete')")
+    public CommonResult<Boolean> deleteNotifyTemplate(@RequestParam("id") Long id) {
+        notifyTemplateService.deleteNotifyTemplate(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @ApiOperation("获得站内信模版")
+    @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
+    @PreAuthorize("@ss.hasPermission('system:notify-template:query')")
+    public CommonResult<NotifyTemplateRespVO> getNotifyTemplate(@RequestParam("id") Long id) {
+        NotifyTemplateDO notifyTemplate = notifyTemplateService.getNotifyTemplate(id);
+        return success(NotifyTemplateConvert.INSTANCE.convert(notifyTemplate));
+    }
+
+    @GetMapping("/list")
+    @ApiOperation("获得站内信模版列表")
+    @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
+    @PreAuthorize("@ss.hasPermission('system:notify-template:query')")
+    public CommonResult<List<NotifyTemplateRespVO>> getNotifyTemplateList(@RequestParam("ids") Collection<Long> ids) {
+        List<NotifyTemplateDO> list = notifyTemplateService.getNotifyTemplateList(ids);
+        return success(NotifyTemplateConvert.INSTANCE.convertList(list));
+    }
+
+    @GetMapping("/page")
+    @ApiOperation("获得站内信模版分页")
+    @PreAuthorize("@ss.hasPermission('system:notify-template:query')")
+    public CommonResult<PageResult<NotifyTemplateRespVO>> getNotifyTemplatePage(@Valid NotifyTemplatePageReqVO pageVO) {
+        PageResult<NotifyTemplateDO> pageResult = notifyTemplateService.getNotifyTemplatePage(pageVO);
+        return success(NotifyTemplateConvert.INSTANCE.convertPage(pageResult));
+    }
+
+    @GetMapping("/export-excel")
+    @ApiOperation("导出站内信模版 Excel")
+    @PreAuthorize("@ss.hasPermission('system:notify-template:export')")
+    @OperateLog(type = EXPORT)
+    public void exportNotifyTemplateExcel(@Valid NotifyTemplateExportReqVO exportReqVO,
+                                          HttpServletResponse response) throws IOException {
+        List<NotifyTemplateDO> list = notifyTemplateService.getNotifyTemplateList(exportReqVO);
+        // 导出 Excel
+        List<NotifyTemplateExcelVO> datas = NotifyTemplateConvert.INSTANCE.convertList02(list);
+        ExcelUtils.write(response, "站内信模版.xls", "数据", NotifyTemplateExcelVO.class, datas);
+    }
+
+}

+ 83 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/UserNotifyMessageController.java

@@ -0,0 +1,83 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify;
+
+import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
+import cn.iocoder.yudao.module.system.convert.notify.NotifyMessageConvert;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
+import cn.iocoder.yudao.module.system.service.notify.NotifyMessageService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.validation.Valid;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+
+/**
+ * 管理后台 - 站内信-消息中心
+ *
+ * @author xrcoder
+ */
+@Api(tags = "管理后台 - 站内信-消息中心")
+@RestController
+@RequestMapping("/system/user/notify-message")
+@Validated
+public class UserNotifyMessageController {
+
+    @Resource
+    private NotifyMessageService notifyMessageService;
+
+
+    @GetMapping("/page")
+    @ApiOperation("获得站内信分页")
+    public CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@Valid NotifyMessagePageReqVO pageVO) {
+        PageResult<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessagePage(pageVO);
+        return success(NotifyMessageConvert.INSTANCE.convertPage(pageResult));
+    }
+
+    @GetMapping("/latest/list")
+    @ApiOperation("获得最新10站内信列表")
+    public CommonResult<List<NotifyMessageRespVO>> getNotifyLatestMessageList() {
+        return success(Collections.emptyList());
+    }
+
+    @GetMapping("/unread/count")
+    @ApiOperation("获得未读站内信数量")
+    public CommonResult<Long> getUnreadNotifyMessageCount() {
+        return success(1L);
+    }
+
+    @GetMapping("/read")
+    @ApiOperation("获得站内信")
+    @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
+    public CommonResult<NotifyMessageRespVO> readNotifyMessage(@RequestParam("id") Long id) {
+        NotifyMessageDO notifyMessage = notifyMessageService.getNotifyMessage(id);
+        // TODO 记录消息已读。
+        return success(NotifyMessageConvert.INSTANCE.convert(notifyMessage));
+    }
+
+    @GetMapping("/read/list")
+    @ApiOperation("批量标记已读")
+    @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
+    public CommonResult<Boolean> batchUpdateNotifyMessageReadStatus(@RequestParam("ids") Collection<Long> ids) {
+        return success(Boolean.TRUE);
+    }
+
+    @GetMapping("/read/all")
+    @ApiOperation("所有未读消息标记已读")
+    @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
+    public CommonResult<Boolean> batchUpdateAllNotifyMessageReadStatus(@RequestParam("ids") Collection<Long> ids) {
+        return success(Boolean.TRUE);
+    }
+}

+ 40 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageBaseVO.java

@@ -0,0 +1,40 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+import javax.validation.constraints.*;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+/**
+* 站内信 Base VO,提供给添加、修改、详细的子 VO 使用
+* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
+*/
+@Data
+public class NotifyMessageBaseVO {
+
+    @ApiModelProperty(value = "用户编号", required = true)
+    @NotNull(message = "用户编号不能为空")
+    private Long userId;
+
+    @ApiModelProperty(value = "用户类型", required = true)
+    @NotNull(message = "用户类型不能为空")
+    private Integer userType;
+
+    @ApiModelProperty(value = "标题")
+    private String title;
+
+    @ApiModelProperty(value = "内容", required = true)
+    @NotNull(message = "内容不能为空")
+    private String content;
+
+    @ApiModelProperty(value = "是否已读 0-未读  1-已读")
+    private Boolean readStatus;
+
+    @ApiModelProperty(value = "阅读时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private Date readTime;
+
+}

+ 15 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageCreateReqVO.java

@@ -0,0 +1,15 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
+
+import lombok.*;
+import io.swagger.annotations.*;
+
+@ApiModel("管理后台 - 站内信创建 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class NotifyMessageCreateReqVO extends NotifyMessageBaseVO {
+
+    @ApiModelProperty(value = "站内信模版编号")
+    private Long templateId;
+
+}

+ 27 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessagePageReqVO.java

@@ -0,0 +1,27 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+
+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 NotifyMessagePageReqVO extends PageParam {
+
+    @ApiModelProperty(value = "标题")
+    private String title;
+
+    @ApiModelProperty(value = "是否已读 0-未读  1-已读")
+    private Boolean readStatus;
+
+    @ApiModelProperty(value = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private Date[] createTime;
+
+}

+ 19 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageRespVO.java

@@ -0,0 +1,19 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+
+@ApiModel("管理后台 - 站内信 Response VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class NotifyMessageRespVO extends NotifyMessageBaseVO {
+
+    @ApiModelProperty(value = "ID", required = true)
+    private Long id;
+
+    @ApiModelProperty(value = "创建时间", required = true)
+    private Date createTime;
+
+}

+ 20 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageUpdateReqVO.java

@@ -0,0 +1,20 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message;
+
+import lombok.*;
+import io.swagger.annotations.*;
+import javax.validation.constraints.*;
+
+@ApiModel("管理后台 - 站内信更新 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class NotifyMessageUpdateReqVO extends NotifyMessageBaseVO {
+
+    @ApiModelProperty(value = "ID", required = true)
+    @NotNull(message = "ID不能为空")
+    private Long id;
+
+    @ApiModelProperty(value = "站内信模版编号")
+    private Long templateId;
+
+}

+ 34 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateBaseVO.java

@@ -0,0 +1,34 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+import javax.validation.constraints.*;
+
+/**
+* 站内信模版 Base VO,提供给添加、修改、详细的子 VO 使用
+* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
+*/
+@Data
+public class NotifyTemplateBaseVO {
+
+    @ApiModelProperty(value = "模版编码", required = true)
+    @NotNull(message = "模版编码不能为空")
+    private String code;
+
+    @ApiModelProperty(value = "模版标题", required = true)
+    @NotNull(message = "模版标题不能为空")
+    private String title;
+
+    @ApiModelProperty(value = "模版内容", required = true)
+    @NotNull(message = "模版内容不能为空")
+    private String content;
+
+    @ApiModelProperty(value = "状态:1-启用 0-禁用", required = true)
+    @NotNull(message = "状态:1-启用 0-禁用不能为空")
+    private String status;
+
+    @ApiModelProperty(value = "备注")
+    private String remarks;
+
+}

+ 12 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateCreateReqVO.java

@@ -0,0 +1,12 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
+
+import lombok.*;
+import io.swagger.annotations.*;
+
+@ApiModel("管理后台 - 站内信模版创建 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class NotifyTemplateCreateReqVO extends NotifyTemplateBaseVO {
+
+}

+ 42 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateExcelVO.java

@@ -0,0 +1,42 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
+import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
+
+
+/**
+ * 站内信模版 Excel VO
+ *
+ * @author 芋道源码
+ */
+@Data
+public class NotifyTemplateExcelVO {
+
+    @ExcelProperty("ID")
+    private Long id;
+
+    @ExcelProperty("模版编码")
+    private String code;
+
+    @ExcelProperty("模版标题")
+    private String title;
+
+    @ExcelProperty("模版内容")
+    private String content;
+
+    @ExcelProperty(value = "状态:1-启用 0-禁用", converter = DictConvert.class)
+    @DictFormat("common_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
+    private String status;
+
+    @ExcelProperty("备注")
+    private String remarks;
+
+    @ExcelProperty("创建时间")
+    private Date createTime;
+
+}

+ 28 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateExportReqVO.java

@@ -0,0 +1,28 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@ApiModel(value = "管理后台 - 站内信模版 Excel 导出 Request VO", description = "参数和 NotifyTemplatePageReqVO 是一致的")
+@Data
+public class NotifyTemplateExportReqVO {
+
+    @ApiModelProperty(value = "模版编码")
+    private String code;
+
+    @ApiModelProperty(value = "模版标题")
+    private String title;
+
+    @ApiModelProperty(value = "状态:1-启用 0-禁用")
+    private String status;
+
+    @ApiModelProperty(value = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private Date[] createTime;
+
+}

+ 30 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplatePageReqVO.java

@@ -0,0 +1,30 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+import cn.iocoder.yudao.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+
+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 NotifyTemplatePageReqVO extends PageParam {
+
+    @ApiModelProperty(value = "模版编码")
+    private String code;
+
+    @ApiModelProperty(value = "模版标题")
+    private String title;
+
+    @ApiModelProperty(value = "状态:1-启用 0-禁用")
+    private String status;
+
+    @ApiModelProperty(value = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private Date[] createTime;
+
+}

+ 19 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateRespVO.java

@@ -0,0 +1,19 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
+
+import lombok.*;
+import java.util.*;
+import io.swagger.annotations.*;
+
+@ApiModel("管理后台 - 站内信模版 Response VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class NotifyTemplateRespVO extends NotifyTemplateBaseVO {
+
+    @ApiModelProperty(value = "ID", required = true)
+    private Long id;
+
+    @ApiModelProperty(value = "创建时间", required = true)
+    private Date createTime;
+
+}

+ 17 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateUpdateReqVO.java

@@ -0,0 +1,17 @@
+package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template;
+
+import lombok.*;
+import io.swagger.annotations.*;
+import javax.validation.constraints.*;
+
+@ApiModel("管理后台 - 站内信模版更新 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class NotifyTemplateUpdateReqVO extends NotifyTemplateBaseVO {
+
+    @ApiModelProperty(value = "ID", required = true)
+    @NotNull(message = "ID不能为空")
+    private Long id;
+
+}

+ 34 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/notify/NotifyMessageConvert.java

@@ -0,0 +1,34 @@
+package cn.iocoder.yudao.module.system.convert.notify;
+
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageCreateReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageUpdateReqVO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
+
+/**
+ * 站内信 Convert
+ *
+ * @author xrcoder
+ */
+@Mapper
+public interface NotifyMessageConvert {
+
+    NotifyMessageConvert INSTANCE = Mappers.getMapper(NotifyMessageConvert.class);
+
+    NotifyMessageDO convert(NotifyMessageCreateReqVO bean);
+
+    NotifyMessageDO convert(NotifyMessageUpdateReqVO bean);
+
+    NotifyMessageRespVO convert(NotifyMessageDO bean);
+
+    List<NotifyMessageRespVO> convertList(List<NotifyMessageDO> list);
+
+    PageResult<NotifyMessageRespVO> convertPage(PageResult<NotifyMessageDO> page);
+
+}

+ 37 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/notify/NotifyTemplateConvert.java

@@ -0,0 +1,37 @@
+package cn.iocoder.yudao.module.system.convert.notify;
+
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateExcelVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateRespVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO;
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
+
+/**
+ * 站内信模版 Convert
+ *
+ * @author xrcoder
+ */
+@Mapper
+public interface NotifyTemplateConvert {
+
+    NotifyTemplateConvert INSTANCE = Mappers.getMapper(NotifyTemplateConvert.class);
+
+    NotifyTemplateDO convert(NotifyTemplateCreateReqVO bean);
+
+    NotifyTemplateDO convert(NotifyTemplateUpdateReqVO bean);
+
+    NotifyTemplateRespVO convert(NotifyTemplateDO bean);
+
+    List<NotifyTemplateRespVO> convertList(List<NotifyTemplateDO> list);
+
+    PageResult<NotifyTemplateRespVO> convertPage(PageResult<NotifyTemplateDO> page);
+
+    List<NotifyTemplateExcelVO> convertList02(List<NotifyTemplateDO> list);
+
+}

+ 59 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/notify/NotifyMessageDO.java

@@ -0,0 +1,59 @@
+package cn.iocoder.yudao.module.system.dal.dataobject.notify;
+
+import lombok.*;
+import java.util.*;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 站内信 DO
+ *
+ * @author xrcoder
+ */
+@TableName("system_notify_message")
+@KeySequence("system_notify_message_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class NotifyMessageDO extends BaseDO {
+
+    /**
+     * ID
+     */
+    @TableId
+    private Long id;
+    /**
+     * 站内信模版编号
+     */
+    private Long templateId;
+    /**
+     * 用户编号
+     */
+    private Long userId;
+    /**
+     * 用户类型
+     */
+    private Integer userType;
+    /**
+     * 标题
+     */
+    private String title;
+    /**
+     * 内容
+     */
+    private String content;
+    /**
+     * 是否已读 0-未读  1-已读
+     *
+     * 枚举 {@link TODO system_notify_message_read_status 对应的类}
+     */
+    private Boolean readStatus;
+    /**
+     * 阅读时间
+     */
+    private Date readTime;
+
+}

+ 55 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/notify/NotifyTemplateDO.java

@@ -0,0 +1,55 @@
+package cn.iocoder.yudao.module.system.dal.dataobject.notify;
+
+import lombok.*;
+import java.util.*;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 站内信模版 DO
+ *
+ * @author xrcoder
+ */
+@TableName("system_notify_template")
+@KeySequence("system_notify_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class NotifyTemplateDO extends BaseDO {
+
+    /**
+     * ID
+     */
+    @TableId
+    private Long id;
+    /**
+     * 模版编码
+     */
+    private String code;
+    /**
+     * 模版标题
+     */
+    private String title;
+    /**
+     * 模版内容
+     */
+    private String content;
+    /**
+     * 参数数组
+     */
+    private String params;
+    /**
+     * 状态:1-启用 0-禁用
+     *
+     * 枚举 {@link TODO common_status 对应的类}
+     */
+    private String status;
+    /**
+     * 备注
+     */
+    private String remarks;
+
+}

+ 25 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java

@@ -0,0 +1,25 @@
+package cn.iocoder.yudao.module.system.dal.mysql.notify;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 站内信 Mapper
+ *
+ * @author xrcoder
+ */
+@Mapper
+public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> {
+
+    default PageResult<NotifyMessageDO> selectPage(NotifyMessagePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>()
+                .likeIfPresent(NotifyMessageDO::getTitle, reqVO.getTitle())
+                .eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus())
+                .betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(NotifyMessageDO::getId));
+    }
+}

+ 39 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyTemplateMapper.java

@@ -0,0 +1,39 @@
+package cn.iocoder.yudao.module.system.dal.mysql.notify;
+
+import java.util.*;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateExportReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 站内信模版 Mapper
+ *
+ * @author xrcoder
+ */
+@Mapper
+public interface NotifyTemplateMapper extends BaseMapperX<NotifyTemplateDO> {
+
+    default PageResult<NotifyTemplateDO> selectPage(NotifyTemplatePageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<NotifyTemplateDO>()
+                .eqIfPresent(NotifyTemplateDO::getCode, reqVO.getCode())
+                .eqIfPresent(NotifyTemplateDO::getTitle, reqVO.getTitle())
+                .eqIfPresent(NotifyTemplateDO::getStatus, reqVO.getStatus())
+                .betweenIfPresent(NotifyTemplateDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(NotifyTemplateDO::getId));
+    }
+
+    default List<NotifyTemplateDO> selectList(NotifyTemplateExportReqVO reqVO) {
+        return selectList(new LambdaQueryWrapperX<NotifyTemplateDO>()
+                .eqIfPresent(NotifyTemplateDO::getCode, reqVO.getCode())
+                .eqIfPresent(NotifyTemplateDO::getTitle, reqVO.getTitle())
+                .eqIfPresent(NotifyTemplateDO::getStatus, reqVO.getStatus())
+                .betweenIfPresent(NotifyTemplateDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(NotifyTemplateDO::getId));
+    }
+
+}

+ 65 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageService.java

@@ -0,0 +1,65 @@
+package cn.iocoder.yudao.module.system.service.notify;
+
+import java.util.*;
+import javax.validation.*;
+
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageCreateReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageUpdateReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+
+/**
+ * 站内信 Service 接口
+ *
+ * @author xrcoder
+ */
+public interface NotifyMessageService {
+
+    /**
+     * 创建站内信
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createNotifyMessage(@Valid NotifyMessageCreateReqVO createReqVO);
+
+    /**
+     * 更新站内信
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateNotifyMessage(@Valid NotifyMessageUpdateReqVO updateReqVO);
+
+    /**
+     * 删除站内信
+     *
+     * @param id 编号
+     */
+    void deleteNotifyMessage(Long id);
+
+    /**
+     * 获得站内信
+     *
+     * @param id 编号
+     * @return 站内信
+     */
+    NotifyMessageDO getNotifyMessage(Long id);
+
+    /**
+     * 获得站内信列表
+     *
+     * @param ids 编号
+     * @return 站内信列表
+     */
+    List<NotifyMessageDO> getNotifyMessageList(Collection<Long> ids);
+
+    /**
+     * 获得站内信分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 站内信分页
+     */
+    PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO);
+
+}

+ 78 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java

@@ -0,0 +1,78 @@
+package cn.iocoder.yudao.module.system.service.notify;
+
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageCreateReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageUpdateReqVO;
+import cn.iocoder.yudao.module.system.convert.notify.NotifyMessageConvert;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO;
+import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyMessageMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.validation.annotation.Validated;
+
+import javax.annotation.Resource;
+import java.util.Collection;
+import java.util.List;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTIFY_MESSAGE_NOT_EXISTS;
+
+/**
+ * 站内信 Service 实现类
+ *
+ * @author xrcoder
+ */
+@Service
+@Validated
+public class NotifyMessageServiceImpl implements NotifyMessageService {
+
+    @Resource
+    private NotifyMessageMapper notifyMessageMapper;
+
+    @Override
+    public Long createNotifyMessage(NotifyMessageCreateReqVO createReqVO) {
+        // 插入
+        NotifyMessageDO notifyMessage = NotifyMessageConvert.INSTANCE.convert(createReqVO);
+        notifyMessageMapper.insert(notifyMessage);
+        // 返回
+        return notifyMessage.getId();
+    }
+
+    @Override
+    public void updateNotifyMessage(NotifyMessageUpdateReqVO updateReqVO) {
+        // 校验存在
+        this.validateNotifyMessageExists(updateReqVO.getId());
+        // 更新
+        NotifyMessageDO updateObj = NotifyMessageConvert.INSTANCE.convert(updateReqVO);
+        notifyMessageMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteNotifyMessage(Long id) {
+        // 校验存在
+        this.validateNotifyMessageExists(id);
+        // 删除
+        notifyMessageMapper.deleteById(id);
+    }
+
+    private void validateNotifyMessageExists(Long id) {
+        if (notifyMessageMapper.selectById(id) == null) {
+            throw exception(NOTIFY_MESSAGE_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public NotifyMessageDO getNotifyMessage(Long id) {
+        return notifyMessageMapper.selectById(id);
+    }
+
+    @Override
+    public List<NotifyMessageDO> getNotifyMessageList(Collection<Long> ids) {
+        return notifyMessageMapper.selectBatchIds(ids);
+    }
+
+    @Override
+    public PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO) {
+        return notifyMessageMapper.selectPage(pageReqVO);
+    }
+}

+ 74 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateService.java

@@ -0,0 +1,74 @@
+package cn.iocoder.yudao.module.system.service.notify;
+
+import java.util.*;
+import javax.validation.*;
+
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateExportReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+
+/**
+ * 站内信模版 Service 接口
+ *
+ * @author xrcoder
+ */
+public interface NotifyTemplateService {
+
+    /**
+     * 创建站内信模版
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createNotifyTemplate(@Valid NotifyTemplateCreateReqVO createReqVO);
+
+    /**
+     * 更新站内信模版
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateNotifyTemplate(@Valid NotifyTemplateUpdateReqVO updateReqVO);
+
+    /**
+     * 删除站内信模版
+     *
+     * @param id 编号
+     */
+    void deleteNotifyTemplate(Long id);
+
+    /**
+     * 获得站内信模版
+     *
+     * @param id 编号
+     * @return 站内信模版
+     */
+    NotifyTemplateDO getNotifyTemplate(Long id);
+
+    /**
+     * 获得站内信模版列表
+     *
+     * @param ids 编号
+     * @return 站内信模版列表
+     */
+    List<NotifyTemplateDO> getNotifyTemplateList(Collection<Long> ids);
+
+    /**
+     * 获得站内信模版分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 站内信模版分页
+     */
+    PageResult<NotifyTemplateDO> getNotifyTemplatePage(NotifyTemplatePageReqVO pageReqVO);
+
+    /**
+     * 获得站内信模版列表, 用于 Excel 导出
+     *
+     * @param exportReqVO 查询条件
+     * @return 站内信模版列表
+     */
+    List<NotifyTemplateDO> getNotifyTemplateList(NotifyTemplateExportReqVO exportReqVO);
+
+}

+ 86 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateServiceImpl.java

@@ -0,0 +1,86 @@
+package cn.iocoder.yudao.module.system.service.notify;
+
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateExportReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO;
+import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+
+import java.util.*;
+
+import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO;
+import cn.iocoder.yudao.framework.common.pojo.PageResult;
+
+import cn.iocoder.yudao.module.system.convert.notify.NotifyTemplateConvert;
+import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyTemplateMapper;
+
+import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
+
+/**
+ * 站内信模版 Service 实现类
+ *
+ * @author xrcoder
+ */
+@Service
+@Validated
+public class NotifyTemplateServiceImpl implements NotifyTemplateService {
+
+    @Resource
+    private NotifyTemplateMapper notifyTemplateMapper;
+
+    @Override
+    public Long createNotifyTemplate(NotifyTemplateCreateReqVO createReqVO) {
+        // 插入
+        NotifyTemplateDO notifyTemplate = NotifyTemplateConvert.INSTANCE.convert(createReqVO);
+        notifyTemplateMapper.insert(notifyTemplate);
+        // 返回
+        return notifyTemplate.getId();
+    }
+
+    @Override
+    public void updateNotifyTemplate(NotifyTemplateUpdateReqVO updateReqVO) {
+        // 校验存在
+        this.validateNotifyTemplateExists(updateReqVO.getId());
+        // 更新
+        NotifyTemplateDO updateObj = NotifyTemplateConvert.INSTANCE.convert(updateReqVO);
+        notifyTemplateMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteNotifyTemplate(Long id) {
+        // 校验存在
+        this.validateNotifyTemplateExists(id);
+        // 删除
+        notifyTemplateMapper.deleteById(id);
+    }
+
+    private void validateNotifyTemplateExists(Long id) {
+        if (notifyTemplateMapper.selectById(id) == null) {
+            throw exception(NOTIFY_TEMPLATE_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public NotifyTemplateDO getNotifyTemplate(Long id) {
+        return notifyTemplateMapper.selectById(id);
+    }
+
+    @Override
+    public List<NotifyTemplateDO> getNotifyTemplateList(Collection<Long> ids) {
+        return notifyTemplateMapper.selectBatchIds(ids);
+    }
+
+    @Override
+    public PageResult<NotifyTemplateDO> getNotifyTemplatePage(NotifyTemplatePageReqVO pageReqVO) {
+        return notifyTemplateMapper.selectPage(pageReqVO);
+    }
+
+    @Override
+    public List<NotifyTemplateDO> getNotifyTemplateList(NotifyTemplateExportReqVO exportReqVO) {
+        return notifyTemplateMapper.selectList(exportReqVO);
+    }
+
+}