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); 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; package com.ktg.system.service.impl;
import java.util.List; import java.util.List;
import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -10,87 +11,95 @@ import com.ktg.system.service.ISysMessageService;
/** /**
* 消息Service业务层处理 * 消息Service业务层处理
* *
* @author yinjinlu * @author yinjinlu
* @date 2023-03-06 * @date 2023-03-06
*/ */
@Service @Service
public class SysMessageServiceImpl implements ISysMessageService public class SysMessageServiceImpl implements ISysMessageService {
{
@Autowired @Autowired
private SysMessageMapper sysMessageMapper; private SysMessageMapper sysMessageMapper;
/** /**
* 查询消息 * 查询消息
* *
* @param messageId 消息主键 * @param messageId 消息主键
* @return 消息 * @return 消息
*/ */
@Override @Override
public SysMessage selectSysMessageByMessageId(Long messageId) public SysMessage selectSysMessageByMessageId(Long messageId) {
{
return sysMessageMapper.selectSysMessageByMessageId(messageId); return sysMessageMapper.selectSysMessageByMessageId(messageId);
} }
/** /**
* 查询消息列表 * 查询消息列表
* *
* @param sysMessage 消息 * @param sysMessage 消息
* @return 消息 * @return 消息
*/ */
@Override @Override
public List<SysMessage> selectSysMessageList(SysMessage sysMessage) public List<SysMessage> selectSysMessageList(SysMessage sysMessage) {
{
return sysMessageMapper.selectSysMessageList(sysMessage); return sysMessageMapper.selectSysMessageList(sysMessage);
} }
/** /**
* 新增消息 * 新增消息
* *
* @param sysMessage 消息 * @param sysMessage 消息
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertSysMessage(SysMessage sysMessage) public int insertSysMessage(SysMessage sysMessage) {
{
sysMessage.setCreateTime(DateUtils.getNowDate()); sysMessage.setCreateTime(DateUtils.getNowDate());
return sysMessageMapper.insertSysMessage(sysMessage); 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);
}
/** /**
* 修改消息 * 修改消息
* *
* @param sysMessage 消息 * @param sysMessage 消息
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateSysMessage(SysMessage sysMessage) public int updateSysMessage(SysMessage sysMessage) {
{
sysMessage.setUpdateTime(DateUtils.getNowDate()); sysMessage.setUpdateTime(DateUtils.getNowDate());
return sysMessageMapper.updateSysMessage(sysMessage); return sysMessageMapper.updateSysMessage(sysMessage);
} }
/** /**
* 批量删除消息 * 批量删除消息
* *
* @param messageIds 需要删除的消息主键 * @param messageIds 需要删除的消息主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSysMessageByMessageIds(Long[] messageIds) public int deleteSysMessageByMessageIds(Long[] messageIds) {
{
return sysMessageMapper.deleteSysMessageByMessageIds(messageIds); return sysMessageMapper.deleteSysMessageByMessageIds(messageIds);
} }
/** /**
* 删除消息信息 * 删除消息信息
* *
* @param messageId 消息主键 * @param messageId 消息主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteSysMessageByMessageId(Long messageId) public int deleteSysMessageByMessageId(Long messageId) {
{
return sysMessageMapper.deleteSysMessageByMessageId(messageId); return sysMessageMapper.deleteSysMessageByMessageId(messageId);
} }
} }