feat(消息): 增加“新增消息提示”方法

This commit is contained in:
Kelvin 2025-01-06 17:22:19 +08:00
parent 60357038df
commit 9736e66955
2 changed files with 39 additions and 21 deletions

View File

@ -35,6 +35,15 @@ public interface ISysMessageService
*/
public int insertSysMessage(SysMessage sysMessage);
/**
* 新增消息提示
*
* @param title 标题
* @param content 内容
* @return 结果
*/
public int insertSysPromptMessage(String title,String content);
/**
* 修改消息
*

View File

@ -1,6 +1,7 @@
package com.ktg.system.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -15,8 +16,7 @@ import com.ktg.system.service.ISysMessageService;
* @date 2023-03-06
*/
@Service
public class SysMessageServiceImpl implements ISysMessageService
{
public class SysMessageServiceImpl implements ISysMessageService {
@Autowired
private SysMessageMapper sysMessageMapper;
@ -27,8 +27,7 @@ public class SysMessageServiceImpl implements ISysMessageService
* @return 消息
*/
@Override
public SysMessage selectSysMessageByMessageId(Long messageId)
{
public SysMessage selectSysMessageByMessageId(Long messageId) {
return sysMessageMapper.selectSysMessageByMessageId(messageId);
}
@ -39,8 +38,7 @@ public class SysMessageServiceImpl implements ISysMessageService
* @return 消息
*/
@Override
public List<SysMessage> selectSysMessageList(SysMessage sysMessage)
{
public List<SysMessage> selectSysMessageList(SysMessage sysMessage) {
return sysMessageMapper.selectSysMessageList(sysMessage);
}
@ -51,12 +49,26 @@ public class SysMessageServiceImpl implements ISysMessageService
* @return 结果
*/
@Override
public int insertSysMessage(SysMessage sysMessage)
{
public int insertSysMessage(SysMessage sysMessage) {
sysMessage.setCreateTime(DateUtils.getNowDate());
return sysMessageMapper.insertSysMessage(sysMessage);
}
@Override
public int insertSysPromptMessage(String title, String content) {
// 创建消息通知
SysMessage sysMessage = new SysMessage();
sysMessage.setMessageType("PROMPT");
sysMessage.setMessageLevel("A");
sysMessage.setMessageTitle(title);
sysMessage.setMessageContent(content);
// TODO 当前仅向admin用户推送消息后续会指定用户
sysMessage.setRecipientId(1L);
sysMessage.setRecipientName("admin");
sysMessage.setRecipientNick("若依");
return sysMessageMapper.insertSysMessage(sysMessage);
}
/**
* 修改消息
*
@ -64,8 +76,7 @@ public class SysMessageServiceImpl implements ISysMessageService
* @return 结果
*/
@Override
public int updateSysMessage(SysMessage sysMessage)
{
public int updateSysMessage(SysMessage sysMessage) {
sysMessage.setUpdateTime(DateUtils.getNowDate());
return sysMessageMapper.updateSysMessage(sysMessage);
}
@ -77,8 +88,7 @@ public class SysMessageServiceImpl implements ISysMessageService
* @return 结果
*/
@Override
public int deleteSysMessageByMessageIds(Long[] messageIds)
{
public int deleteSysMessageByMessageIds(Long[] messageIds) {
return sysMessageMapper.deleteSysMessageByMessageIds(messageIds);
}
@ -89,8 +99,7 @@ public class SysMessageServiceImpl implements ISysMessageService
* @return 结果
*/
@Override
public int deleteSysMessageByMessageId(Long messageId)
{
public int deleteSysMessageByMessageId(Long messageId) {
return sysMessageMapper.deleteSysMessageByMessageId(messageId);
}
}