Commit bb78a58029db52df14b3812300b07c144a5d0b48
1 parent
ffa2850a
站内信基础代码整理,接口定义。
Showing
30 changed files
with
1244 additions
and
0 deletions
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApi.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.api.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; | ||
| 4 | + | ||
| 5 | +import javax.validation.Valid; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * 站内信发送 API 接口 | ||
| 9 | + * | ||
| 10 | + * @author xrcoder | ||
| 11 | + */ | ||
| 12 | +public interface NotifyMessageSendApi { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 发送单条站内信给 Admin 用户 | ||
| 16 | + * <p> | ||
| 17 | + * 在 mobile 为空时,使用 userId 加载对应 Admin 的手机号 | ||
| 18 | + * | ||
| 19 | + * @param reqDTO 发送请求 | ||
| 20 | + * @return 发送消息ID | ||
| 21 | + */ | ||
| 22 | + Long sendSingleMessageToAdmin(@Valid NotifySendSingleToUserReqDTO reqDTO); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 发送单条站内信给 Member 用户 | ||
| 26 | + * <p> | ||
| 27 | + * 在 mobile 为空时,使用 userId 加载对应 Member 的手机号 | ||
| 28 | + * | ||
| 29 | + * @param reqDTO 发送请求 | ||
| 30 | + * @return 发送消息ID | ||
| 31 | + */ | ||
| 32 | + Long sendSingleMessageToMember(@Valid NotifySendSingleToUserReqDTO reqDTO); | ||
| 33 | + | ||
| 34 | +} |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/api/notify/dto/NotifySendSingleToUserReqDTO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.api.notify.dto; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import javax.validation.constraints.NotEmpty; | ||
| 6 | +import javax.validation.constraints.NotNull; | ||
| 7 | +import java.util.Map; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * 站内信发送给 Admin 或者 Member 用户 | ||
| 11 | + * | ||
| 12 | + * @author xrcoder | ||
| 13 | + */ | ||
| 14 | +@Data | ||
| 15 | +public class NotifySendSingleToUserReqDTO { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * 用户编号 | ||
| 19 | + */ | ||
| 20 | + @NotNull(message = "用户编号不能为空") | ||
| 21 | + private Long userId; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 站内信模板编号 | ||
| 25 | + */ | ||
| 26 | + @NotEmpty(message = "站内信模板编号不能为空") | ||
| 27 | + private String templateCode; | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 站内信模板参数 | ||
| 31 | + */ | ||
| 32 | + private Map<String, Object> templateParams; | ||
| 33 | +} |
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 { | @@ -142,4 +142,10 @@ public interface ErrorCodeConstants { | ||
| 142 | ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1002022000, "code 不存在"); | 142 | ErrorCode OAUTH2_CODE_NOT_EXISTS = new ErrorCode(1002022000, "code 不存在"); |
| 143 | ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1002022000, "code 已过期"); | 143 | ErrorCode OAUTH2_CODE_EXPIRE = new ErrorCode(1002022000, "code 已过期"); |
| 144 | 144 | ||
| 145 | + // ========== 站内信模版 1002023000 ========== | ||
| 146 | + ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1002023000, "站内信模版不存在"); | ||
| 147 | + | ||
| 148 | + // ========== 站内信 1002024000 ========== | ||
| 149 | + ErrorCode NOTIFY_MESSAGE_NOT_EXISTS = new ErrorCode(1002024000, "站内信不存在"); | ||
| 150 | + | ||
| 145 | } | 151 | } |
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/notify/NotifyReadStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.enums.notify; | ||
| 2 | + | ||
| 3 | +import lombok.AllArgsConstructor; | ||
| 4 | +import lombok.Getter; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 站内信阅读状态枚举类 | ||
| 8 | + * | ||
| 9 | + * @author xrcoder | ||
| 10 | + */ | ||
| 11 | +@Getter | ||
| 12 | +@AllArgsConstructor | ||
| 13 | +public enum NotifyReadStatusEnum { | ||
| 14 | + | ||
| 15 | + UNREAD(0), | ||
| 16 | + READ(1); | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 类型 | ||
| 20 | + */ | ||
| 21 | + private final Integer status; | ||
| 22 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/api/notify/NotifyMessageSendApiImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.api.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO; | ||
| 4 | +import org.springframework.stereotype.Service; | ||
| 5 | + | ||
| 6 | +/** | ||
| 7 | + * 站内信发送 API 接口 | ||
| 8 | + * | ||
| 9 | + * @author xrcoder | ||
| 10 | + */ | ||
| 11 | +@Service | ||
| 12 | +public class NotifyMessageSendApiImpl implements NotifyMessageSendApi { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 发送单条站内信给 Admin 用户 | ||
| 16 | + * <p> | ||
| 17 | + * 在 mobile 为空时,使用 userId 加载对应 Admin 的手机号 | ||
| 18 | + * | ||
| 19 | + * @param reqDTO 发送请求 | ||
| 20 | + * @return 发送消息ID | ||
| 21 | + */ | ||
| 22 | + @Override | ||
| 23 | + public Long sendSingleMessageToAdmin(NotifySendSingleToUserReqDTO reqDTO) { | ||
| 24 | + return null; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 发送单条站内信给 Member 用户 | ||
| 29 | + * <p> | ||
| 30 | + * 在 mobile 为空时,使用 userId 加载对应 Member 的手机号 | ||
| 31 | + * | ||
| 32 | + * @param reqDTO 发送请求 | ||
| 33 | + * @return 发送消息ID | ||
| 34 | + */ | ||
| 35 | + @Override | ||
| 36 | + public Long sendSingleMessageToMember(NotifySendSingleToUserReqDTO reqDTO) { | ||
| 37 | + return null; | ||
| 38 | + } | ||
| 39 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyMessageController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageCreateReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageUpdateReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.system.convert.notify.NotifyMessageConvert; | ||
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 11 | +import cn.iocoder.yudao.module.system.service.notify.NotifyMessageService; | ||
| 12 | +import io.swagger.annotations.Api; | ||
| 13 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 14 | +import io.swagger.annotations.ApiOperation; | ||
| 15 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 16 | +import org.springframework.validation.annotation.Validated; | ||
| 17 | +import org.springframework.web.bind.annotation.*; | ||
| 18 | + | ||
| 19 | +import javax.annotation.Resource; | ||
| 20 | +import javax.validation.Valid; | ||
| 21 | + | ||
| 22 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 23 | + | ||
| 24 | +@Api(tags = "管理后台 - 站内信") | ||
| 25 | +@RestController | ||
| 26 | +@RequestMapping("/system/notify-message") | ||
| 27 | +@Validated | ||
| 28 | +public class NotifyMessageController { | ||
| 29 | + | ||
| 30 | + @Resource | ||
| 31 | + private NotifyMessageService notifyMessageService; | ||
| 32 | + | ||
| 33 | + @PostMapping("/create") | ||
| 34 | + @ApiOperation("创建站内信") | ||
| 35 | + @PreAuthorize("@ss.hasPermission('system:notify-message:create')") | ||
| 36 | + public CommonResult<Long> createNotifyMessage(@Valid @RequestBody NotifyMessageCreateReqVO createReqVO) { | ||
| 37 | + return success(notifyMessageService.createNotifyMessage(createReqVO)); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @PutMapping("/update") | ||
| 41 | + @ApiOperation("更新站内信") | ||
| 42 | + @PreAuthorize("@ss.hasPermission('system:notify-message:update')") | ||
| 43 | + public CommonResult<Boolean> updateNotifyMessage(@Valid @RequestBody NotifyMessageUpdateReqVO updateReqVO) { | ||
| 44 | + notifyMessageService.updateNotifyMessage(updateReqVO); | ||
| 45 | + return success(true); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @DeleteMapping("/delete") | ||
| 49 | + @ApiOperation("删除站内信") | ||
| 50 | + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) | ||
| 51 | + @PreAuthorize("@ss.hasPermission('system:notify-message:delete')") | ||
| 52 | + public CommonResult<Boolean> deleteNotifyMessage(@RequestParam("id") Long id) { | ||
| 53 | + notifyMessageService.deleteNotifyMessage(id); | ||
| 54 | + return success(true); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @GetMapping("/get") | ||
| 58 | + @ApiOperation("获得站内信") | ||
| 59 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | ||
| 60 | + @PreAuthorize("@ss.hasPermission('system:notify-message:query')") | ||
| 61 | + public CommonResult<NotifyMessageRespVO> getNotifyMessage(@RequestParam("id") Long id) { | ||
| 62 | + NotifyMessageDO notifyMessage = notifyMessageService.getNotifyMessage(id); | ||
| 63 | + return success(NotifyMessageConvert.INSTANCE.convert(notifyMessage)); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @GetMapping("/page") | ||
| 67 | + @ApiOperation("获得站内信分页") | ||
| 68 | + @PreAuthorize("@ss.hasPermission('system:notify-message:query')") | ||
| 69 | + public CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@Valid NotifyMessagePageReqVO pageVO) { | ||
| 70 | + PageResult<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessagePage(pageVO); | ||
| 71 | + return success(NotifyMessageConvert.INSTANCE.convertPage(pageResult)); | ||
| 72 | + } | ||
| 73 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/NotifyTemplateController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | ||
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.*; | ||
| 8 | +import cn.iocoder.yudao.module.system.convert.notify.NotifyTemplateConvert; | ||
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO; | ||
| 10 | +import cn.iocoder.yudao.module.system.service.notify.NotifyTemplateService; | ||
| 11 | +import io.swagger.annotations.Api; | ||
| 12 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 13 | +import io.swagger.annotations.ApiOperation; | ||
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 15 | +import org.springframework.validation.annotation.Validated; | ||
| 16 | +import org.springframework.web.bind.annotation.*; | ||
| 17 | + | ||
| 18 | +import javax.annotation.Resource; | ||
| 19 | +import javax.servlet.http.HttpServletResponse; | ||
| 20 | +import javax.validation.Valid; | ||
| 21 | +import java.io.IOException; | ||
| 22 | +import java.util.Collection; | ||
| 23 | +import java.util.List; | ||
| 24 | + | ||
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 26 | +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; | ||
| 27 | + | ||
| 28 | +@Api(tags = "管理后台 - 站内信模版") | ||
| 29 | +@RestController | ||
| 30 | +@RequestMapping("/system/notify-template") | ||
| 31 | +@Validated | ||
| 32 | +public class NotifyTemplateController { | ||
| 33 | + | ||
| 34 | + @Resource | ||
| 35 | + private NotifyTemplateService notifyTemplateService; | ||
| 36 | + | ||
| 37 | + @PostMapping("/create") | ||
| 38 | + @ApiOperation("创建站内信模版") | ||
| 39 | + @PreAuthorize("@ss.hasPermission('system:notify-template:create')") | ||
| 40 | + public CommonResult<Long> createNotifyTemplate(@Valid @RequestBody NotifyTemplateCreateReqVO createReqVO) { | ||
| 41 | + return success(notifyTemplateService.createNotifyTemplate(createReqVO)); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @PutMapping("/update") | ||
| 45 | + @ApiOperation("更新站内信模版") | ||
| 46 | + @PreAuthorize("@ss.hasPermission('system:notify-template:update')") | ||
| 47 | + public CommonResult<Boolean> updateNotifyTemplate(@Valid @RequestBody NotifyTemplateUpdateReqVO updateReqVO) { | ||
| 48 | + notifyTemplateService.updateNotifyTemplate(updateReqVO); | ||
| 49 | + return success(true); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @DeleteMapping("/delete") | ||
| 53 | + @ApiOperation("删除站内信模版") | ||
| 54 | + @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class) | ||
| 55 | + @PreAuthorize("@ss.hasPermission('system:notify-template:delete')") | ||
| 56 | + public CommonResult<Boolean> deleteNotifyTemplate(@RequestParam("id") Long id) { | ||
| 57 | + notifyTemplateService.deleteNotifyTemplate(id); | ||
| 58 | + return success(true); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @GetMapping("/get") | ||
| 62 | + @ApiOperation("获得站内信模版") | ||
| 63 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | ||
| 64 | + @PreAuthorize("@ss.hasPermission('system:notify-template:query')") | ||
| 65 | + public CommonResult<NotifyTemplateRespVO> getNotifyTemplate(@RequestParam("id") Long id) { | ||
| 66 | + NotifyTemplateDO notifyTemplate = notifyTemplateService.getNotifyTemplate(id); | ||
| 67 | + return success(NotifyTemplateConvert.INSTANCE.convert(notifyTemplate)); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @GetMapping("/list") | ||
| 71 | + @ApiOperation("获得站内信模版列表") | ||
| 72 | + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | ||
| 73 | + @PreAuthorize("@ss.hasPermission('system:notify-template:query')") | ||
| 74 | + public CommonResult<List<NotifyTemplateRespVO>> getNotifyTemplateList(@RequestParam("ids") Collection<Long> ids) { | ||
| 75 | + List<NotifyTemplateDO> list = notifyTemplateService.getNotifyTemplateList(ids); | ||
| 76 | + return success(NotifyTemplateConvert.INSTANCE.convertList(list)); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @GetMapping("/page") | ||
| 80 | + @ApiOperation("获得站内信模版分页") | ||
| 81 | + @PreAuthorize("@ss.hasPermission('system:notify-template:query')") | ||
| 82 | + public CommonResult<PageResult<NotifyTemplateRespVO>> getNotifyTemplatePage(@Valid NotifyTemplatePageReqVO pageVO) { | ||
| 83 | + PageResult<NotifyTemplateDO> pageResult = notifyTemplateService.getNotifyTemplatePage(pageVO); | ||
| 84 | + return success(NotifyTemplateConvert.INSTANCE.convertPage(pageResult)); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @GetMapping("/export-excel") | ||
| 88 | + @ApiOperation("导出站内信模版 Excel") | ||
| 89 | + @PreAuthorize("@ss.hasPermission('system:notify-template:export')") | ||
| 90 | + @OperateLog(type = EXPORT) | ||
| 91 | + public void exportNotifyTemplateExcel(@Valid NotifyTemplateExportReqVO exportReqVO, | ||
| 92 | + HttpServletResponse response) throws IOException { | ||
| 93 | + List<NotifyTemplateDO> list = notifyTemplateService.getNotifyTemplateList(exportReqVO); | ||
| 94 | + // 导出 Excel | ||
| 95 | + List<NotifyTemplateExcelVO> datas = NotifyTemplateConvert.INSTANCE.convertList02(list); | ||
| 96 | + ExcelUtils.write(response, "站内信模版.xls", "数据", NotifyTemplateExcelVO.class, datas); | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/UserNotifyMessageController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.convert.notify.NotifyMessageConvert; | ||
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 9 | +import cn.iocoder.yudao.module.system.service.notify.NotifyMessageService; | ||
| 10 | +import io.swagger.annotations.Api; | ||
| 11 | +import io.swagger.annotations.ApiImplicitParam; | ||
| 12 | +import io.swagger.annotations.ApiOperation; | ||
| 13 | +import org.springframework.validation.annotation.Validated; | ||
| 14 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 15 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 16 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 17 | +import org.springframework.web.bind.annotation.RestController; | ||
| 18 | + | ||
| 19 | +import javax.annotation.Resource; | ||
| 20 | +import javax.validation.Valid; | ||
| 21 | +import java.util.Collection; | ||
| 22 | +import java.util.Collections; | ||
| 23 | +import java.util.List; | ||
| 24 | + | ||
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * 管理后台 - 站内信-消息中心 | ||
| 29 | + * | ||
| 30 | + * @author xrcoder | ||
| 31 | + */ | ||
| 32 | +@Api(tags = "管理后台 - 站内信-消息中心") | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/system/user/notify-message") | ||
| 35 | +@Validated | ||
| 36 | +public class UserNotifyMessageController { | ||
| 37 | + | ||
| 38 | + @Resource | ||
| 39 | + private NotifyMessageService notifyMessageService; | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + @GetMapping("/page") | ||
| 43 | + @ApiOperation("获得站内信分页") | ||
| 44 | + public CommonResult<PageResult<NotifyMessageRespVO>> getNotifyMessagePage(@Valid NotifyMessagePageReqVO pageVO) { | ||
| 45 | + PageResult<NotifyMessageDO> pageResult = notifyMessageService.getNotifyMessagePage(pageVO); | ||
| 46 | + return success(NotifyMessageConvert.INSTANCE.convertPage(pageResult)); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @GetMapping("/latest/list") | ||
| 50 | + @ApiOperation("获得最新10站内信列表") | ||
| 51 | + public CommonResult<List<NotifyMessageRespVO>> getNotifyLatestMessageList() { | ||
| 52 | + return success(Collections.emptyList()); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @GetMapping("/unread/count") | ||
| 56 | + @ApiOperation("获得未读站内信数量") | ||
| 57 | + public CommonResult<Long> getUnreadNotifyMessageCount() { | ||
| 58 | + return success(1L); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @GetMapping("/read") | ||
| 62 | + @ApiOperation("获得站内信") | ||
| 63 | + @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) | ||
| 64 | + public CommonResult<NotifyMessageRespVO> readNotifyMessage(@RequestParam("id") Long id) { | ||
| 65 | + NotifyMessageDO notifyMessage = notifyMessageService.getNotifyMessage(id); | ||
| 66 | + // TODO 记录消息已读。 | ||
| 67 | + return success(NotifyMessageConvert.INSTANCE.convert(notifyMessage)); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @GetMapping("/read/list") | ||
| 71 | + @ApiOperation("批量标记已读") | ||
| 72 | + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | ||
| 73 | + public CommonResult<Boolean> batchUpdateNotifyMessageReadStatus(@RequestParam("ids") Collection<Long> ids) { | ||
| 74 | + return success(Boolean.TRUE); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @GetMapping("/read/all") | ||
| 78 | + @ApiOperation("所有未读消息标记已读") | ||
| 79 | + @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) | ||
| 80 | + public CommonResult<Boolean> batchUpdateAllNotifyMessageReadStatus(@RequestParam("ids") Collection<Long> ids) { | ||
| 81 | + return success(Boolean.TRUE); | ||
| 82 | + } | ||
| 83 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.annotations.*; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | +* 站内信 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 13 | +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 14 | +*/ | ||
| 15 | +@Data | ||
| 16 | +public class NotifyMessageBaseVO { | ||
| 17 | + | ||
| 18 | + @ApiModelProperty(value = "用户编号", required = true) | ||
| 19 | + @NotNull(message = "用户编号不能为空") | ||
| 20 | + private Long userId; | ||
| 21 | + | ||
| 22 | + @ApiModelProperty(value = "用户类型", required = true) | ||
| 23 | + @NotNull(message = "用户类型不能为空") | ||
| 24 | + private Integer userType; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty(value = "标题") | ||
| 27 | + private String title; | ||
| 28 | + | ||
| 29 | + @ApiModelProperty(value = "内容", required = true) | ||
| 30 | + @NotNull(message = "内容不能为空") | ||
| 31 | + private String content; | ||
| 32 | + | ||
| 33 | + @ApiModelProperty(value = "是否已读 0-未读 1-已读") | ||
| 34 | + private Boolean readStatus; | ||
| 35 | + | ||
| 36 | + @ApiModelProperty(value = "阅读时间") | ||
| 37 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 38 | + private Date readTime; | ||
| 39 | + | ||
| 40 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import io.swagger.annotations.*; | ||
| 5 | + | ||
| 6 | +@ApiModel("管理后台 - 站内信创建 Request VO") | ||
| 7 | +@Data | ||
| 8 | +@EqualsAndHashCode(callSuper = true) | ||
| 9 | +@ToString(callSuper = true) | ||
| 10 | +public class NotifyMessageCreateReqVO extends NotifyMessageBaseVO { | ||
| 11 | + | ||
| 12 | + @ApiModelProperty(value = "站内信模版编号") | ||
| 13 | + private Long templateId; | ||
| 14 | + | ||
| 15 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessagePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.annotations.*; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | + | ||
| 11 | +@ApiModel("管理后台 - 站内信分页 Request VO") | ||
| 12 | +@Data | ||
| 13 | +@EqualsAndHashCode(callSuper = true) | ||
| 14 | +@ToString(callSuper = true) | ||
| 15 | +public class NotifyMessagePageReqVO extends PageParam { | ||
| 16 | + | ||
| 17 | + @ApiModelProperty(value = "标题") | ||
| 18 | + private String title; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty(value = "是否已读 0-未读 1-已读") | ||
| 21 | + private Boolean readStatus; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty(value = "创建时间") | ||
| 24 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 25 | + private Date[] createTime; | ||
| 26 | + | ||
| 27 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.annotations.*; | ||
| 6 | + | ||
| 7 | +@ApiModel("管理后台 - 站内信 Response VO") | ||
| 8 | +@Data | ||
| 9 | +@EqualsAndHashCode(callSuper = true) | ||
| 10 | +@ToString(callSuper = true) | ||
| 11 | +public class NotifyMessageRespVO extends NotifyMessageBaseVO { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty(value = "ID", required = true) | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @ApiModelProperty(value = "创建时间", required = true) | ||
| 17 | + private Date createTime; | ||
| 18 | + | ||
| 19 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/message/NotifyMessageUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.message; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import io.swagger.annotations.*; | ||
| 5 | +import javax.validation.constraints.*; | ||
| 6 | + | ||
| 7 | +@ApiModel("管理后台 - 站内信更新 Request VO") | ||
| 8 | +@Data | ||
| 9 | +@EqualsAndHashCode(callSuper = true) | ||
| 10 | +@ToString(callSuper = true) | ||
| 11 | +public class NotifyMessageUpdateReqVO extends NotifyMessageBaseVO { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty(value = "ID", required = true) | ||
| 14 | + @NotNull(message = "ID不能为空") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @ApiModelProperty(value = "站内信模版编号") | ||
| 18 | + private Long templateId; | ||
| 19 | + | ||
| 20 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateBaseVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.annotations.*; | ||
| 6 | +import javax.validation.constraints.*; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | +* 站内信模版 Base VO,提供给添加、修改、详细的子 VO 使用 | ||
| 10 | +* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 | ||
| 11 | +*/ | ||
| 12 | +@Data | ||
| 13 | +public class NotifyTemplateBaseVO { | ||
| 14 | + | ||
| 15 | + @ApiModelProperty(value = "模版编码", required = true) | ||
| 16 | + @NotNull(message = "模版编码不能为空") | ||
| 17 | + private String code; | ||
| 18 | + | ||
| 19 | + @ApiModelProperty(value = "模版标题", required = true) | ||
| 20 | + @NotNull(message = "模版标题不能为空") | ||
| 21 | + private String title; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty(value = "模版内容", required = true) | ||
| 24 | + @NotNull(message = "模版内容不能为空") | ||
| 25 | + private String content; | ||
| 26 | + | ||
| 27 | + @ApiModelProperty(value = "状态:1-启用 0-禁用", required = true) | ||
| 28 | + @NotNull(message = "状态:1-启用 0-禁用不能为空") | ||
| 29 | + private String status; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty(value = "备注") | ||
| 32 | + private String remarks; | ||
| 33 | + | ||
| 34 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import io.swagger.annotations.*; | ||
| 5 | + | ||
| 6 | +@ApiModel("管理后台 - 站内信模版创建 Request VO") | ||
| 7 | +@Data | ||
| 8 | +@EqualsAndHashCode(callSuper = true) | ||
| 9 | +@ToString(callSuper = true) | ||
| 10 | +public class NotifyTemplateCreateReqVO extends NotifyTemplateBaseVO { | ||
| 11 | + | ||
| 12 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.annotations.*; | ||
| 6 | + | ||
| 7 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 8 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 9 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 10 | + | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 站内信模版 Excel VO | ||
| 14 | + * | ||
| 15 | + * @author 芋道源码 | ||
| 16 | + */ | ||
| 17 | +@Data | ||
| 18 | +public class NotifyTemplateExcelVO { | ||
| 19 | + | ||
| 20 | + @ExcelProperty("ID") | ||
| 21 | + private Long id; | ||
| 22 | + | ||
| 23 | + @ExcelProperty("模版编码") | ||
| 24 | + private String code; | ||
| 25 | + | ||
| 26 | + @ExcelProperty("模版标题") | ||
| 27 | + private String title; | ||
| 28 | + | ||
| 29 | + @ExcelProperty("模版内容") | ||
| 30 | + private String content; | ||
| 31 | + | ||
| 32 | + @ExcelProperty(value = "状态:1-启用 0-禁用", converter = DictConvert.class) | ||
| 33 | + @DictFormat("common_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 | ||
| 34 | + private String status; | ||
| 35 | + | ||
| 36 | + @ExcelProperty("备注") | ||
| 37 | + private String remarks; | ||
| 38 | + | ||
| 39 | + @ExcelProperty("创建时间") | ||
| 40 | + private Date createTime; | ||
| 41 | + | ||
| 42 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateExportReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.annotations.*; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | + | ||
| 11 | +@ApiModel(value = "管理后台 - 站内信模版 Excel 导出 Request VO", description = "参数和 NotifyTemplatePageReqVO 是一致的") | ||
| 12 | +@Data | ||
| 13 | +public class NotifyTemplateExportReqVO { | ||
| 14 | + | ||
| 15 | + @ApiModelProperty(value = "模版编码") | ||
| 16 | + private String code; | ||
| 17 | + | ||
| 18 | + @ApiModelProperty(value = "模版标题") | ||
| 19 | + private String title; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty(value = "状态:1-启用 0-禁用") | ||
| 22 | + private String status; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty(value = "创建时间") | ||
| 25 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 26 | + private Date[] createTime; | ||
| 27 | + | ||
| 28 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplatePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.annotations.*; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 10 | + | ||
| 11 | +@ApiModel("管理后台 - 站内信模版分页 Request VO") | ||
| 12 | +@Data | ||
| 13 | +@EqualsAndHashCode(callSuper = true) | ||
| 14 | +@ToString(callSuper = true) | ||
| 15 | +public class NotifyTemplatePageReqVO extends PageParam { | ||
| 16 | + | ||
| 17 | + @ApiModelProperty(value = "模版编码") | ||
| 18 | + private String code; | ||
| 19 | + | ||
| 20 | + @ApiModelProperty(value = "模版标题") | ||
| 21 | + private String title; | ||
| 22 | + | ||
| 23 | + @ApiModelProperty(value = "状态:1-启用 0-禁用") | ||
| 24 | + private String status; | ||
| 25 | + | ||
| 26 | + @ApiModelProperty(value = "创建时间") | ||
| 27 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 28 | + private Date[] createTime; | ||
| 29 | + | ||
| 30 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import io.swagger.annotations.*; | ||
| 6 | + | ||
| 7 | +@ApiModel("管理后台 - 站内信模版 Response VO") | ||
| 8 | +@Data | ||
| 9 | +@EqualsAndHashCode(callSuper = true) | ||
| 10 | +@ToString(callSuper = true) | ||
| 11 | +public class NotifyTemplateRespVO extends NotifyTemplateBaseVO { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty(value = "ID", required = true) | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @ApiModelProperty(value = "创建时间", required = true) | ||
| 17 | + private Date createTime; | ||
| 18 | + | ||
| 19 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/notify/vo/template/NotifyTemplateUpdateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.controller.admin.notify.vo.template; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import io.swagger.annotations.*; | ||
| 5 | +import javax.validation.constraints.*; | ||
| 6 | + | ||
| 7 | +@ApiModel("管理后台 - 站内信模版更新 Request VO") | ||
| 8 | +@Data | ||
| 9 | +@EqualsAndHashCode(callSuper = true) | ||
| 10 | +@ToString(callSuper = true) | ||
| 11 | +public class NotifyTemplateUpdateReqVO extends NotifyTemplateBaseVO { | ||
| 12 | + | ||
| 13 | + @ApiModelProperty(value = "ID", required = true) | ||
| 14 | + @NotNull(message = "ID不能为空") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/notify/NotifyMessageConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.convert.notify; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | + | ||
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageCreateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageRespVO; | ||
| 9 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageUpdateReqVO; | ||
| 10 | +import org.mapstruct.Mapper; | ||
| 11 | +import org.mapstruct.factory.Mappers; | ||
| 12 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * 站内信 Convert | ||
| 16 | + * | ||
| 17 | + * @author xrcoder | ||
| 18 | + */ | ||
| 19 | +@Mapper | ||
| 20 | +public interface NotifyMessageConvert { | ||
| 21 | + | ||
| 22 | + NotifyMessageConvert INSTANCE = Mappers.getMapper(NotifyMessageConvert.class); | ||
| 23 | + | ||
| 24 | + NotifyMessageDO convert(NotifyMessageCreateReqVO bean); | ||
| 25 | + | ||
| 26 | + NotifyMessageDO convert(NotifyMessageUpdateReqVO bean); | ||
| 27 | + | ||
| 28 | + NotifyMessageRespVO convert(NotifyMessageDO bean); | ||
| 29 | + | ||
| 30 | + List<NotifyMessageRespVO> convertList(List<NotifyMessageDO> list); | ||
| 31 | + | ||
| 32 | + PageResult<NotifyMessageRespVO> convertPage(PageResult<NotifyMessageDO> page); | ||
| 33 | + | ||
| 34 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/notify/NotifyTemplateConvert.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.convert.notify; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | + | ||
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateExcelVO; | ||
| 9 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateRespVO; | ||
| 10 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO; | ||
| 11 | +import org.mapstruct.Mapper; | ||
| 12 | +import org.mapstruct.factory.Mappers; | ||
| 13 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 站内信模版 Convert | ||
| 17 | + * | ||
| 18 | + * @author xrcoder | ||
| 19 | + */ | ||
| 20 | +@Mapper | ||
| 21 | +public interface NotifyTemplateConvert { | ||
| 22 | + | ||
| 23 | + NotifyTemplateConvert INSTANCE = Mappers.getMapper(NotifyTemplateConvert.class); | ||
| 24 | + | ||
| 25 | + NotifyTemplateDO convert(NotifyTemplateCreateReqVO bean); | ||
| 26 | + | ||
| 27 | + NotifyTemplateDO convert(NotifyTemplateUpdateReqVO bean); | ||
| 28 | + | ||
| 29 | + NotifyTemplateRespVO convert(NotifyTemplateDO bean); | ||
| 30 | + | ||
| 31 | + List<NotifyTemplateRespVO> convertList(List<NotifyTemplateDO> list); | ||
| 32 | + | ||
| 33 | + PageResult<NotifyTemplateRespVO> convertPage(PageResult<NotifyTemplateDO> page); | ||
| 34 | + | ||
| 35 | + List<NotifyTemplateExcelVO> convertList02(List<NotifyTemplateDO> list); | ||
| 36 | + | ||
| 37 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/notify/NotifyMessageDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.dataobject.notify; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 站内信 DO | ||
| 10 | + * | ||
| 11 | + * @author xrcoder | ||
| 12 | + */ | ||
| 13 | +@TableName("system_notify_message") | ||
| 14 | +@KeySequence("system_notify_message_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 15 | +@Data | ||
| 16 | +@EqualsAndHashCode(callSuper = true) | ||
| 17 | +@ToString(callSuper = true) | ||
| 18 | +@Builder | ||
| 19 | +@NoArgsConstructor | ||
| 20 | +@AllArgsConstructor | ||
| 21 | +public class NotifyMessageDO extends BaseDO { | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * ID | ||
| 25 | + */ | ||
| 26 | + @TableId | ||
| 27 | + private Long id; | ||
| 28 | + /** | ||
| 29 | + * 站内信模版编号 | ||
| 30 | + */ | ||
| 31 | + private Long templateId; | ||
| 32 | + /** | ||
| 33 | + * 用户编号 | ||
| 34 | + */ | ||
| 35 | + private Long userId; | ||
| 36 | + /** | ||
| 37 | + * 用户类型 | ||
| 38 | + */ | ||
| 39 | + private Integer userType; | ||
| 40 | + /** | ||
| 41 | + * 标题 | ||
| 42 | + */ | ||
| 43 | + private String title; | ||
| 44 | + /** | ||
| 45 | + * 内容 | ||
| 46 | + */ | ||
| 47 | + private String content; | ||
| 48 | + /** | ||
| 49 | + * 是否已读 0-未读 1-已读 | ||
| 50 | + * | ||
| 51 | + * 枚举 {@link TODO system_notify_message_read_status 对应的类} | ||
| 52 | + */ | ||
| 53 | + private Boolean readStatus; | ||
| 54 | + /** | ||
| 55 | + * 阅读时间 | ||
| 56 | + */ | ||
| 57 | + private Date readTime; | ||
| 58 | + | ||
| 59 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/notify/NotifyTemplateDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.dataobject.notify; | ||
| 2 | + | ||
| 3 | +import lombok.*; | ||
| 4 | +import java.util.*; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.*; | ||
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * 站内信模版 DO | ||
| 10 | + * | ||
| 11 | + * @author xrcoder | ||
| 12 | + */ | ||
| 13 | +@TableName("system_notify_template") | ||
| 14 | +@KeySequence("system_notify_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 15 | +@Data | ||
| 16 | +@EqualsAndHashCode(callSuper = true) | ||
| 17 | +@ToString(callSuper = true) | ||
| 18 | +@Builder | ||
| 19 | +@NoArgsConstructor | ||
| 20 | +@AllArgsConstructor | ||
| 21 | +public class NotifyTemplateDO extends BaseDO { | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * ID | ||
| 25 | + */ | ||
| 26 | + @TableId | ||
| 27 | + private Long id; | ||
| 28 | + /** | ||
| 29 | + * 模版编码 | ||
| 30 | + */ | ||
| 31 | + private String code; | ||
| 32 | + /** | ||
| 33 | + * 模版标题 | ||
| 34 | + */ | ||
| 35 | + private String title; | ||
| 36 | + /** | ||
| 37 | + * 模版内容 | ||
| 38 | + */ | ||
| 39 | + private String content; | ||
| 40 | + /** | ||
| 41 | + * 参数数组 | ||
| 42 | + */ | ||
| 43 | + private String params; | ||
| 44 | + /** | ||
| 45 | + * 状态:1-启用 0-禁用 | ||
| 46 | + * | ||
| 47 | + * 枚举 {@link TODO common_status 对应的类} | ||
| 48 | + */ | ||
| 49 | + private String status; | ||
| 50 | + /** | ||
| 51 | + * 备注 | ||
| 52 | + */ | ||
| 53 | + private String remarks; | ||
| 54 | + | ||
| 55 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyMessageMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.mysql.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * 站内信 Mapper | ||
| 12 | + * | ||
| 13 | + * @author xrcoder | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface NotifyMessageMapper extends BaseMapperX<NotifyMessageDO> { | ||
| 17 | + | ||
| 18 | + default PageResult<NotifyMessageDO> selectPage(NotifyMessagePageReqVO reqVO) { | ||
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<NotifyMessageDO>() | ||
| 20 | + .likeIfPresent(NotifyMessageDO::getTitle, reqVO.getTitle()) | ||
| 21 | + .eqIfPresent(NotifyMessageDO::getReadStatus, reqVO.getReadStatus()) | ||
| 22 | + .betweenIfPresent(NotifyMessageDO::getCreateTime, reqVO.getCreateTime()) | ||
| 23 | + .orderByDesc(NotifyMessageDO::getId)); | ||
| 24 | + } | ||
| 25 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/notify/NotifyTemplateMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.dal.mysql.notify; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 7 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateExportReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO; | ||
| 11 | +import org.apache.ibatis.annotations.Mapper; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 站内信模版 Mapper | ||
| 15 | + * | ||
| 16 | + * @author xrcoder | ||
| 17 | + */ | ||
| 18 | +@Mapper | ||
| 19 | +public interface NotifyTemplateMapper extends BaseMapperX<NotifyTemplateDO> { | ||
| 20 | + | ||
| 21 | + default PageResult<NotifyTemplateDO> selectPage(NotifyTemplatePageReqVO reqVO) { | ||
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<NotifyTemplateDO>() | ||
| 23 | + .eqIfPresent(NotifyTemplateDO::getCode, reqVO.getCode()) | ||
| 24 | + .eqIfPresent(NotifyTemplateDO::getTitle, reqVO.getTitle()) | ||
| 25 | + .eqIfPresent(NotifyTemplateDO::getStatus, reqVO.getStatus()) | ||
| 26 | + .betweenIfPresent(NotifyTemplateDO::getCreateTime, reqVO.getCreateTime()) | ||
| 27 | + .orderByDesc(NotifyTemplateDO::getId)); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + default List<NotifyTemplateDO> selectList(NotifyTemplateExportReqVO reqVO) { | ||
| 31 | + return selectList(new LambdaQueryWrapperX<NotifyTemplateDO>() | ||
| 32 | + .eqIfPresent(NotifyTemplateDO::getCode, reqVO.getCode()) | ||
| 33 | + .eqIfPresent(NotifyTemplateDO::getTitle, reqVO.getTitle()) | ||
| 34 | + .eqIfPresent(NotifyTemplateDO::getStatus, reqVO.getStatus()) | ||
| 35 | + .betweenIfPresent(NotifyTemplateDO::getCreateTime, reqVO.getCreateTime()) | ||
| 36 | + .orderByDesc(NotifyTemplateDO::getId)); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.notify; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | +import javax.validation.*; | ||
| 5 | + | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageCreateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageUpdateReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 10 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 站内信 Service 接口 | ||
| 14 | + * | ||
| 15 | + * @author xrcoder | ||
| 16 | + */ | ||
| 17 | +public interface NotifyMessageService { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 创建站内信 | ||
| 21 | + * | ||
| 22 | + * @param createReqVO 创建信息 | ||
| 23 | + * @return 编号 | ||
| 24 | + */ | ||
| 25 | + Long createNotifyMessage(@Valid NotifyMessageCreateReqVO createReqVO); | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 更新站内信 | ||
| 29 | + * | ||
| 30 | + * @param updateReqVO 更新信息 | ||
| 31 | + */ | ||
| 32 | + void updateNotifyMessage(@Valid NotifyMessageUpdateReqVO updateReqVO); | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 删除站内信 | ||
| 36 | + * | ||
| 37 | + * @param id 编号 | ||
| 38 | + */ | ||
| 39 | + void deleteNotifyMessage(Long id); | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 获得站内信 | ||
| 43 | + * | ||
| 44 | + * @param id 编号 | ||
| 45 | + * @return 站内信 | ||
| 46 | + */ | ||
| 47 | + NotifyMessageDO getNotifyMessage(Long id); | ||
| 48 | + | ||
| 49 | + /** | ||
| 50 | + * 获得站内信列表 | ||
| 51 | + * | ||
| 52 | + * @param ids 编号 | ||
| 53 | + * @return 站内信列表 | ||
| 54 | + */ | ||
| 55 | + List<NotifyMessageDO> getNotifyMessageList(Collection<Long> ids); | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 获得站内信分页 | ||
| 59 | + * | ||
| 60 | + * @param pageReqVO 分页查询 | ||
| 61 | + * @return 站内信分页 | ||
| 62 | + */ | ||
| 63 | + PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO); | ||
| 64 | + | ||
| 65 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyMessageServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageCreateReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessagePageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.message.NotifyMessageUpdateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.convert.notify.NotifyMessageConvert; | ||
| 8 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyMessageDO; | ||
| 9 | +import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyMessageMapper; | ||
| 10 | +import org.springframework.stereotype.Service; | ||
| 11 | +import org.springframework.validation.annotation.Validated; | ||
| 12 | + | ||
| 13 | +import javax.annotation.Resource; | ||
| 14 | +import java.util.Collection; | ||
| 15 | +import java.util.List; | ||
| 16 | + | ||
| 17 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 18 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.NOTIFY_MESSAGE_NOT_EXISTS; | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * 站内信 Service 实现类 | ||
| 22 | + * | ||
| 23 | + * @author xrcoder | ||
| 24 | + */ | ||
| 25 | +@Service | ||
| 26 | +@Validated | ||
| 27 | +public class NotifyMessageServiceImpl implements NotifyMessageService { | ||
| 28 | + | ||
| 29 | + @Resource | ||
| 30 | + private NotifyMessageMapper notifyMessageMapper; | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public Long createNotifyMessage(NotifyMessageCreateReqVO createReqVO) { | ||
| 34 | + // 插入 | ||
| 35 | + NotifyMessageDO notifyMessage = NotifyMessageConvert.INSTANCE.convert(createReqVO); | ||
| 36 | + notifyMessageMapper.insert(notifyMessage); | ||
| 37 | + // 返回 | ||
| 38 | + return notifyMessage.getId(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @Override | ||
| 42 | + public void updateNotifyMessage(NotifyMessageUpdateReqVO updateReqVO) { | ||
| 43 | + // 校验存在 | ||
| 44 | + this.validateNotifyMessageExists(updateReqVO.getId()); | ||
| 45 | + // 更新 | ||
| 46 | + NotifyMessageDO updateObj = NotifyMessageConvert.INSTANCE.convert(updateReqVO); | ||
| 47 | + notifyMessageMapper.updateById(updateObj); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @Override | ||
| 51 | + public void deleteNotifyMessage(Long id) { | ||
| 52 | + // 校验存在 | ||
| 53 | + this.validateNotifyMessageExists(id); | ||
| 54 | + // 删除 | ||
| 55 | + notifyMessageMapper.deleteById(id); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + private void validateNotifyMessageExists(Long id) { | ||
| 59 | + if (notifyMessageMapper.selectById(id) == null) { | ||
| 60 | + throw exception(NOTIFY_MESSAGE_NOT_EXISTS); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public NotifyMessageDO getNotifyMessage(Long id) { | ||
| 66 | + return notifyMessageMapper.selectById(id); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public List<NotifyMessageDO> getNotifyMessageList(Collection<Long> ids) { | ||
| 71 | + return notifyMessageMapper.selectBatchIds(ids); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public PageResult<NotifyMessageDO> getNotifyMessagePage(NotifyMessagePageReqVO pageReqVO) { | ||
| 76 | + return notifyMessageMapper.selectPage(pageReqVO); | ||
| 77 | + } | ||
| 78 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.notify; | ||
| 2 | + | ||
| 3 | +import java.util.*; | ||
| 4 | +import javax.validation.*; | ||
| 5 | + | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateExportReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO; | ||
| 11 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 站内信模版 Service 接口 | ||
| 15 | + * | ||
| 16 | + * @author xrcoder | ||
| 17 | + */ | ||
| 18 | +public interface NotifyTemplateService { | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 创建站内信模版 | ||
| 22 | + * | ||
| 23 | + * @param createReqVO 创建信息 | ||
| 24 | + * @return 编号 | ||
| 25 | + */ | ||
| 26 | + Long createNotifyTemplate(@Valid NotifyTemplateCreateReqVO createReqVO); | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 更新站内信模版 | ||
| 30 | + * | ||
| 31 | + * @param updateReqVO 更新信息 | ||
| 32 | + */ | ||
| 33 | + void updateNotifyTemplate(@Valid NotifyTemplateUpdateReqVO updateReqVO); | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 删除站内信模版 | ||
| 37 | + * | ||
| 38 | + * @param id 编号 | ||
| 39 | + */ | ||
| 40 | + void deleteNotifyTemplate(Long id); | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * 获得站内信模版 | ||
| 44 | + * | ||
| 45 | + * @param id 编号 | ||
| 46 | + * @return 站内信模版 | ||
| 47 | + */ | ||
| 48 | + NotifyTemplateDO getNotifyTemplate(Long id); | ||
| 49 | + | ||
| 50 | + /** | ||
| 51 | + * 获得站内信模版列表 | ||
| 52 | + * | ||
| 53 | + * @param ids 编号 | ||
| 54 | + * @return 站内信模版列表 | ||
| 55 | + */ | ||
| 56 | + List<NotifyTemplateDO> getNotifyTemplateList(Collection<Long> ids); | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 获得站内信模版分页 | ||
| 60 | + * | ||
| 61 | + * @param pageReqVO 分页查询 | ||
| 62 | + * @return 站内信模版分页 | ||
| 63 | + */ | ||
| 64 | + PageResult<NotifyTemplateDO> getNotifyTemplatePage(NotifyTemplatePageReqVO pageReqVO); | ||
| 65 | + | ||
| 66 | + /** | ||
| 67 | + * 获得站内信模版列表, 用于 Excel 导出 | ||
| 68 | + * | ||
| 69 | + * @param exportReqVO 查询条件 | ||
| 70 | + * @return 站内信模版列表 | ||
| 71 | + */ | ||
| 72 | + List<NotifyTemplateDO> getNotifyTemplateList(NotifyTemplateExportReqVO exportReqVO); | ||
| 73 | + | ||
| 74 | +} |
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/notify/NotifyTemplateServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.system.service.notify; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateCreateReqVO; | ||
| 4 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateExportReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplatePageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.system.controller.admin.notify.vo.template.NotifyTemplateUpdateReqVO; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | +import javax.annotation.Resource; | ||
| 9 | +import org.springframework.validation.annotation.Validated; | ||
| 10 | + | ||
| 11 | +import java.util.*; | ||
| 12 | + | ||
| 13 | +import cn.iocoder.yudao.module.system.dal.dataobject.notify.NotifyTemplateDO; | ||
| 14 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 15 | + | ||
| 16 | +import cn.iocoder.yudao.module.system.convert.notify.NotifyTemplateConvert; | ||
| 17 | +import cn.iocoder.yudao.module.system.dal.mysql.notify.NotifyTemplateMapper; | ||
| 18 | + | ||
| 19 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 20 | +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * 站内信模版 Service 实现类 | ||
| 24 | + * | ||
| 25 | + * @author xrcoder | ||
| 26 | + */ | ||
| 27 | +@Service | ||
| 28 | +@Validated | ||
| 29 | +public class NotifyTemplateServiceImpl implements NotifyTemplateService { | ||
| 30 | + | ||
| 31 | + @Resource | ||
| 32 | + private NotifyTemplateMapper notifyTemplateMapper; | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public Long createNotifyTemplate(NotifyTemplateCreateReqVO createReqVO) { | ||
| 36 | + // 插入 | ||
| 37 | + NotifyTemplateDO notifyTemplate = NotifyTemplateConvert.INSTANCE.convert(createReqVO); | ||
| 38 | + notifyTemplateMapper.insert(notifyTemplate); | ||
| 39 | + // 返回 | ||
| 40 | + return notifyTemplate.getId(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public void updateNotifyTemplate(NotifyTemplateUpdateReqVO updateReqVO) { | ||
| 45 | + // 校验存在 | ||
| 46 | + this.validateNotifyTemplateExists(updateReqVO.getId()); | ||
| 47 | + // 更新 | ||
| 48 | + NotifyTemplateDO updateObj = NotifyTemplateConvert.INSTANCE.convert(updateReqVO); | ||
| 49 | + notifyTemplateMapper.updateById(updateObj); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public void deleteNotifyTemplate(Long id) { | ||
| 54 | + // 校验存在 | ||
| 55 | + this.validateNotifyTemplateExists(id); | ||
| 56 | + // 删除 | ||
| 57 | + notifyTemplateMapper.deleteById(id); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + private void validateNotifyTemplateExists(Long id) { | ||
| 61 | + if (notifyTemplateMapper.selectById(id) == null) { | ||
| 62 | + throw exception(NOTIFY_TEMPLATE_NOT_EXISTS); | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + public NotifyTemplateDO getNotifyTemplate(Long id) { | ||
| 68 | + return notifyTemplateMapper.selectById(id); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + @Override | ||
| 72 | + public List<NotifyTemplateDO> getNotifyTemplateList(Collection<Long> ids) { | ||
| 73 | + return notifyTemplateMapper.selectBatchIds(ids); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @Override | ||
| 77 | + public PageResult<NotifyTemplateDO> getNotifyTemplatePage(NotifyTemplatePageReqVO pageReqVO) { | ||
| 78 | + return notifyTemplateMapper.selectPage(pageReqVO); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public List<NotifyTemplateDO> getNotifyTemplateList(NotifyTemplateExportReqVO exportReqVO) { | ||
| 83 | + return notifyTemplateMapper.selectList(exportReqVO); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | +} |