Skip to content

Commit

Permalink
[#58]Feat: DB 테이블 변경 및 user_status 통합
Browse files Browse the repository at this point in the history
  • Loading branch information
redhi committed Mar 25, 2022
1 parent 0a4e29b commit af17aa4
Show file tree
Hide file tree
Showing 25 changed files with 98 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.AllArgsConstructor;
import lombok.Data;
import moviegoods.movie.domain.entity.User.UserStatus;

import java.time.LocalDateTime;

Expand All @@ -15,9 +16,9 @@ public class Comments {
private String comment_content;
private Boolean is_mine;
private LocalDateTime comment_written_date;
private Byte user_status;
private UserStatus user_status;

public Comments(Long user_id, String comment_nickname, String comment_content, LocalDateTime comment_written_date, Long comment_id,Byte status){
public Comments(Long user_id, String comment_nickname, String comment_content, LocalDateTime comment_written_date, Long comment_id, UserStatus status){
this.comment_id=comment_id;
this.user_id=user_id;
this.comment_nickname=comment_nickname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import lombok.Getter;
import lombok.Setter;
import org.springframework.web.multipart.MultipartFile;

import java.time.LocalDateTime;

Expand All @@ -11,7 +10,6 @@
@Setter
public class DirectMessage {


private String image_url;
private String content;
private Long chat_room_id;
Expand All @@ -20,6 +18,4 @@ public class DirectMessage {
private LocalDateTime written_date;




}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import moviegoods.movie.domain.entity.User.UserStatus;

import java.time.LocalDateTime;

Expand All @@ -17,10 +18,11 @@ public class DirectMessageListResponseDto {
private String not_mine_nickname;
private String not_mine_profile_url;
private Long not_mine_reliability;
private UserStatus not_mine_user_status;

private Long transaction_id;
private Boolean is_complete;

private String recent_message;
private LocalDateTime recent_message_date;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import lombok.Data;
import moviegoods.movie.domain.dto.comments.Comments;
import moviegoods.movie.domain.entity.User.UserStatus;

import java.time.LocalDateTime;
import java.util.ArrayList;
Expand All @@ -22,7 +23,7 @@ public class InformationShareResponseDetail {
private String cinema_area;
private String cinema_branch;
private Boolean is_mine;
private Byte status;
private UserStatus user_status;
List<Comments> comment=new ArrayList<>(); //댓글리스트

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package moviegoods.movie.domain.dto.informationShare;

import lombok.Data;
import moviegoods.movie.domain.entity.User.UserStatus;

import java.time.LocalDateTime;

Expand All @@ -13,5 +14,5 @@ public class InformationShareResponseSearch {
private String nickname; //user
private LocalDateTime written_date; //content-detail
private Long view; //post
private Byte status;
private UserStatus user_status;
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package moviegoods.movie.domain.dto.signin;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import moviegoods.movie.domain.entity.User.UserStatus;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class SignInResponseDto {
private String nickname;
private String image_url;
private Boolean status;
private UserStatus user_status;
private Boolean result;
private String authority;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import moviegoods.movie.domain.entity.User.UserStatus;

import java.time.LocalDateTime;

Expand All @@ -13,7 +14,7 @@ public class TransactionsSearchResponseDto {
private Long user_id;
private String content;
private String status;
private Byte user_status;
private UserStatus user_status;
private Long transaction_id;
private Long reliability;
private LocalDateTime written_date;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package moviegoods.movie.domain.entity.ChatRoom;

import javax.persistence.*;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import moviegoods.movie.domain.entity.ChatRoomJoin.Chat_Room_Join;
import moviegoods.movie.domain.entity.Message.Message;
import moviegoods.movie.domain.entity.Transaction.Transaction;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -21,6 +23,10 @@ public class Chat_Room {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long chat_room_id;

@NotNull
@DateTimeFormat
private LocalDateTime create_date;

@OneToMany(mappedBy = "chat_room", cascade = CascadeType.ALL)
private List<Chat_Room_Join> chat_room_joins = new ArrayList<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,4 @@ public class Comment {
private Content_Detail content_detail;




}
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
package moviegoods.movie.domain.entity.Content_Detail;

import java.time.LocalDateTime;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import moviegoods.movie.domain.entity.Comment.Comment;
import moviegoods.movie.domain.entity.Message.Message;
import moviegoods.movie.domain.entity.Post.Post;
import moviegoods.movie.domain.entity.Report.Report;
import moviegoods.movie.domain.entity.Transaction.Transaction;
import org.springframework.format.annotation.DateTimeFormat;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

@Entity(name = "content_detail")
@Data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package moviegoods.movie.domain.entity.Message;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -11,6 +8,8 @@
import moviegoods.movie.domain.entity.Content_Detail.Content_Detail;
import moviegoods.movie.domain.entity.User.User;

import javax.persistence.*;

@Entity(name = "message")
@Data
@NoArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public class User {
private Long reliability;

@NotNull
@Column(columnDefinition = "tinyint default 1")
private Byte status;
@Enumerated(EnumType.STRING)
private UserStatus user_status;

@NotNull
@Enumerated(EnumType.STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public interface UserRepository extends JpaRepository<User, Long> {
Optional<User> findByEmail(String email);
Optional<User> findByNickname(String nickname);

Optional<Object> findByEmailAndMethod(String email, String method);
Optional<Object> findByEmailAndMethod(String email, Method method);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package moviegoods.movie.domain.entity.User;

public enum UserStatus {
정상, 정지, 탈퇴
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@
import moviegoods.movie.domain.dto.directMessage.DirectMessageCreateRoomRequestDto;
import moviegoods.movie.domain.dto.directMessage.DirectMessageCreateRoomResponseDto;
import moviegoods.movie.domain.dto.directMessage.DirectMessageListResponseDto;
import moviegoods.movie.domain.dto.manager.ManagerResponseDto;
import moviegoods.movie.domain.entity.ChatRoom.Chat_Room;
import moviegoods.movie.domain.entity.ChatRoom.ChatRoomRepository;
import moviegoods.movie.domain.entity.ChatRoom.Chat_Room;
import moviegoods.movie.domain.entity.ChatRoomJoin.ChatRoomJoinRepository;
import moviegoods.movie.domain.entity.ChatRoomJoin.Chat_Room_Join;
import moviegoods.movie.domain.entity.Event.Event;
import moviegoods.movie.domain.entity.Message.Message;
import moviegoods.movie.domain.entity.Transaction.Status;
import moviegoods.movie.domain.entity.Transaction.Transaction;
import moviegoods.movie.domain.entity.Transaction.TransactionRepository;
import moviegoods.movie.domain.entity.User.User;
import moviegoods.movie.domain.entity.User.UserRepository;
import moviegoods.movie.domain.entity.User.UserStatus;
import org.springframework.stereotype.Service;

import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import java.time.LocalDate;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.*;

Expand Down Expand Up @@ -144,6 +142,7 @@ public List<DirectMessageListResponseDto> findMessageRooms(User loginUser, Long
String not_mine_nickname = null;
String not_mine_profile_url = null;
Long not_mine_reliability = null;
@NotNull UserStatus not_mine_status = null;
Long transaction_id = null;
Boolean is_complete = false;
String recent_message = null;
Expand All @@ -158,6 +157,7 @@ public List<DirectMessageListResponseDto> findMessageRooms(User loginUser, Long
not_mine_nickname = user1.getNickname();
not_mine_profile_url = user1.getProfile_url();
not_mine_reliability = user1.getReliability();
not_mine_status = user1.getUser_status();
}
}

Expand All @@ -182,6 +182,7 @@ public List<DirectMessageListResponseDto> findMessageRooms(User loginUser, Long
not_mine_nickname,
not_mine_profile_url,
not_mine_reliability,
not_mine_status,
transaction_id,
is_complete,
recent_message,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.firebase.auth.FirebaseAuthException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import moviegoods.movie.domain.dto.directMessage.*;
import moviegoods.movie.domain.entity.ChatRoom.ChatRoomRepository;
import moviegoods.movie.domain.entity.ChatRoom.Chat_Room;
Expand All @@ -19,15 +18,11 @@
import moviegoods.movie.domain.entity.User.UserRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.net.URLDecoder;
import java.time.LocalDateTime;
import java.util.*;

import static moviegoods.movie.domain.entity.Transaction.Status.진행중;


@Slf4j
@Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import moviegoods.movie.domain.dto.generalBoard.*;
import moviegoods.movie.domain.entity.Comment.Comment;
import moviegoods.movie.domain.entity.Comment.CommentRepository;
import moviegoods.movie.domain.entity.Content_Detail.ContentDetailRepository;
import moviegoods.movie.domain.entity.Content_Detail.Content_Detail;
import moviegoods.movie.domain.entity.Post.Post;
import moviegoods.movie.domain.entity.Post.PostRepository;
import moviegoods.movie.domain.entity.User.UserStatus;
import moviegoods.movie.domain.entity.User.User;
import moviegoods.movie.domain.entity.User.UserRepository;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -80,12 +80,12 @@ public List<GeneralBoardSearchResponseDto> search(GeneralBoardSearchRequestDto r
search_word = "";
}

String searchJpql = "select p from post p join p.user u join p.content_detail c where p.category = '자유' and ";
String searchJpql = "select p from post p join p.user u join p.content_detail c where p.category = '자유' ";

String criteriaJpql = "";
String criteriaJpql2 = "";
log.info("search_criteria={}", search_criteria);
if (search_criteria != null) {
if (search_criteria != "") {
if (Objects.equals(search_criteria, "작성자")) {
criteriaJpql = "u.nickname";
}
Expand All @@ -100,14 +100,15 @@ public List<GeneralBoardSearchResponseDto> search(GeneralBoardSearchRequestDto r
criteriaJpql2 = "p.title";
}
if (criteriaJpql2 != "") {
searchJpql += "("+criteriaJpql + " like '%" + search_word + "%' "+"OR "+criteriaJpql2 + " like '%" + search_word + "%') ";
searchJpql += "and ("+criteriaJpql + " like '%" + search_word + "%' "+"OR "+criteriaJpql2 + " like '%" + search_word + "%') ";
}
else {
searchJpql += criteriaJpql + " like '%" + search_word + "%' ";
searchJpql += "and "+criteriaJpql + " like '%" + search_word + "%' ";
}

}


searchJpql += "order by c.written_date desc";
log.info("searchJpql={}", searchJpql);

Expand Down Expand Up @@ -157,7 +158,7 @@ public GeneralBoardDetailResponseDto detailInfo(User loginUser, GeneralBoardDeta
String comment_nickname = comment.getUser().getNickname();
String comment_content = comment.getContent_detail().getContent();
LocalDateTime comment_written_date = comment.getContent_detail().getWritten_date();
Byte user_status = comment.getUser().getStatus();
UserStatus user_status = comment.getUser().getUser_status();

Boolean comment_is_mine = Boolean.FALSE;
if (search_user_id == user_id) {
Expand Down
Loading

0 comments on commit af17aa4

Please sign in to comment.