Commit 99c88ec9 by 张晋雄

将所有消息标记为已读

parent be797c0c
......@@ -40,6 +40,14 @@ public class MessageApi {
return Response.success();
}
@ApiOperation("标记所有信息为已读")
@PutMapping("/messages/read")
public Response readMessages(@CurrentSubject Subject subject){
messageService.readMessages(String.valueOf(subject.getId()));
return Response.success();
}
}
......@@ -4,6 +4,8 @@ import cn.meteor.beyondclouds.core.exception.ServiceException;
import cn.meteor.beyondclouds.modules.message.entity.Message;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.Serializable;
/**
* <p>
* 服务类
......@@ -20,4 +22,9 @@ public interface IMessageService extends IService<Message> {
*/
void readMessage(String messageId) throws ServiceException;
/**
* 将所有消息标记为已读
* @param userId
*/
void readMessages(String userId);
}
......@@ -31,4 +31,12 @@ public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> impl
updateById(message);
}
@Override
public void readMessages(String userId) {
UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.eq("user_id", userId);
updateWrapper.set("status", 1);
update(updateWrapper);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment