본문 바로가기
개발/Spring

[SpringBoot] WebSocket 채팅방 구현(7) - vo, table

by 코딩하는 흰둥이 2024. 8. 18.

이전글

https://greed-yb.tistory.com/285

 

[SpringBoot] WebSocket 채팅방 구현(6) - mapper

이전글https://greed-yb.tistory.com/284 [SpringBoot] WebSocket 채팅방 구현(5) - service이전글https://greed-yb.tistory.com/283 [SpringBoot] WebSocket 채팅방 구현(4) - controller이전글 https://greed-yb.tistory.com/282 [SpringBoot] WebSo

greed-yb.tistory.com

 

 

vo
@Getter
@Setter
// 접속한 채팅방 정보
public class MessageVo {
    private Long roomId;
    private String roomUserId;
    private String roomDetail;
    private String detailRead;
    private Date sendTime;
    private String sendUserId;
}





@Getter
@Setter
// 채팅방 목록에 사용
public class RoomVo {
    private Long roomId;
    private String userId;
    private String roomTitle;
    private String profile;
    private String roomDetail;
    private String unreadCount;
}

 

 

 

table - oracle
-- 채팅방
CREATE TABLE MESSENGER	(
    ROOM_ID     NUMBER PRIMARY KEY
)


-- 채팅장 참여 유저
CREATE TABLE ROOM_USER  (
    ROOM_ID     NUMBER,
    USER_ID     VARCHAR2(20),
    ROOM_TITLE  VARCHAR2(20),
    CONSTRAINT PK_ROOM_USER PRIMARY KEY (ROOM_ID, USER_ID),
    CONSTRAINT FK_ROOM_USER FOREIGN KEY (ROOM_ID) REFERENCES MESSENGER (ROOM_ID)
)


-- 채팅방 상세
CREATE TABLE MESSENGER_DETAIL (
    DETAIL_NO   NUMBER NOT NULL,
    ROOM_ID     NUMBER,
    ROOM_DETAIL VARCHAR2(4000),
    DETAIL_READ CHAR(1) DEFAULT 'N',
    SEND_TIME TIMESTAMP (6) DEFAULT SYSDATE,
    SEND_USER_ID VARCHAR2(20),
    CONSTRAINT FK_MESSENGER FOREIGN KEY (ROOM_ID) REFERENCES MESSENGER (ROOM_ID)
)

PK와 FK와 몇몇 컬럼들이 더 있었는데 

기능구현하면서 간단하게 만들려고 중간에 삭제하였다

구조가 이렇다 정도만 참고하길 바란다

댓글