package com.backendsys.modules.sse.entity; import cn.hutool.json.JSONUtil; import lombok.Data; @Data public class SseResponse { private String type; private String message; private Object data; public SseResponse() { } public SseResponse(SseResponseEnum responseEnum) { this.type = responseEnum.getType(); this.message = responseEnum.getMessage(); } public SseResponse(SseResponseEnum responseEnum, Object data) { this.type = responseEnum.getType(); this.message = responseEnum.getMessage(); this.data = data; } public SseResponse(String message) { this.type = SseResponseEnum.NOTICE.getType(); this.message = message; } public String toJsonStr() { return JSONUtil.toJsonStr(this); } }