From 4bf0676b2d14cd0bd762b59581fb2798d59400b4 Mon Sep 17 00:00:00 2001 From: geek Date: Sat, 20 Jul 2019 22:00:32 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9A=8C=EC=9B=90=20=EC=BF=BC=EB=A6=AC=20?= =?UTF-8?q?=EB=A9=94=EC=86=8C=EB=93=9C=20=EC=9E=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/totopia/server/user/model/User.java | 56 ++++++++++++++++--- .../user/repository/UserRepository.java | 34 +++++++++++ .../server/user/service/UserService.java | 4 ++ src/main/resources/application.yml | 40 +++++++++++++ 4 files changed, 125 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/totopia/server/user/model/User.java b/src/main/java/com/totopia/server/user/model/User.java index a0538cc..539ba3b 100644 --- a/src/main/java/com/totopia/server/user/model/User.java +++ b/src/main/java/com/totopia/server/user/model/User.java @@ -29,26 +29,30 @@ public class User implements Serializable { private Long id; @Basic - @Column(name = "name", nullable = false, length = 255) - private String name; - - @Basic - @Column(name = "username", nullable = false, length = 150) + @Column(name = "username", unique = true, nullable = false, length = 150) private String username; - @Basic - @Column(name = "email", nullable = false, length = 100) - private String email; - @Basic @Column(name = "password", nullable = false, length = 100) @JsonIgnore private String password; + @Basic + @Column(name = "name", nullable = false, length = 255) + private String nickname; + + @Basic + @Column(name = "email", nullable = false, length = 100) + private String email; + @Basic @Column(name = "block", nullable = false, columnDefinition = "bool default false") private Boolean block; + @Basic + @Column(name = "is_admin", nullable = false, columnDefinition = "bool default false") + private Boolean isAdmin; + @Basic @Column(name = "send_email", nullable = true, columnDefinition = "bool default false") private Boolean sendEmail; @@ -86,3 +90,37 @@ public class User implements Serializable { private Boolean requireReset; } + +// 아이디 +// 로그인 아이디 +// 로그인 패스워드 +// 로그인 패스워드 문자 +// 이메일 +// 닉네임 +// 은행명 +// 계좌번호 +// 예금주 +// 추천인 +// 추천수 +// 게시판 제한 여부 +// 쿠폰 +// 충전방식 +// 비고 +// 종목별 베팅제한 +// 상태표기 +// 휴대폰번호 +// 추천권한 여부 +// 가입상태 +// 소속 +// 레벨 +// 보유머니 +// 포인트 +// 회원상태 +// 룰렛개수 +// 계좌순번 +// 가입날짜 +// 최근접속 날짜 +// 가입 아이피 +// 최근 접속 아이피 +// 베팅 알림 +// API 연결 diff --git a/src/main/java/com/totopia/server/user/repository/UserRepository.java b/src/main/java/com/totopia/server/user/repository/UserRepository.java index 8b82fc9..da8d6a4 100644 --- a/src/main/java/com/totopia/server/user/repository/UserRepository.java +++ b/src/main/java/com/totopia/server/user/repository/UserRepository.java @@ -2,7 +2,41 @@ package com.totopia.server.user.repository; import com.totopia.server.user.model.User; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; +import java.util.Date; + +@Repository public interface UserRepository extends JpaRepository { + // 회원 아이디로 조회 + User findByUsername(String userName) throws Exception; + User findByEmail(String email) throws Exception; + + Page findAllByNickname(String nickName, Pageable pageable) throws Exception; + + // 접속 제한 상태 유저 리스트 + Page findAllByBlockTrue(Pageable pageable) throws Exception; + // 접속 제한 상태가 아닌 유저 리스트 + Page findAllByBlockFalse(Pageable pageable) throws Exception; + // 어드민 유저 리스 + Page findAllByIsAdminTrue(Pageable pageable) throws Exception; + // 패스워드 리셋이 트루인 유저 리스 + Page findAllByRequireResetTrue(Pageable pageable) throws Exception; + // 어드민이 펄스이며, 활동중인 현재 회원 리스트 + Page findAllByIsAdminFalseAndActivationEquals(String activation, Pageable pageable) throws Exception; + // 날짜 검색 + Page findAllByRegisterDateBetween(Date starDate, Date endDate, Pageable pageable) throws Exception; + Page findAllByLastvisitDateBetween(Date starDate, Date endDate, Pageable pageable) throws Exception; + Page findAllByLastResetTimeBetween(Date starDate, Date endDate, Pageable pageable) throws Exception; + + // 현재 날짜 이후 가입된 회원의 총 수 리턴 + Long countByRegisterDateGreaterThanEqual(Date date) throws Exception; + + // 유저 그룹별 회원 리스트 + + // 유저 소속별 회원 리스트 + } diff --git a/src/main/java/com/totopia/server/user/service/UserService.java b/src/main/java/com/totopia/server/user/service/UserService.java index 1c1c325..3627f3a 100644 --- a/src/main/java/com/totopia/server/user/service/UserService.java +++ b/src/main/java/com/totopia/server/user/service/UserService.java @@ -1,5 +1,9 @@ package com.totopia.server.user.service; +import org.springframework.stereotype.Service; + +@Service public class UserService { + } \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 73b0884..12e2b9f 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,4 @@ +# Spring Boot configuration spring: application: name: totopia-server @@ -5,10 +6,49 @@ spring: console: enabled: true path: /h2-console + datasource: + driver-class-name: org.postgresql.Driver + url: jdbc:postgresql://localhost:15432/postgres + data-username: postgres + password: qwer5795 + # JPA properties jpa: + hibernate: + ddl-auto: update + database: postgresql show-sql: true + database-platform: org.hibernate.dialect.PostgreSQLDialect +# Logger configuration +logging: + pattern: + console: "%d %-5level %logger : %msg%n" + level: + org.springframework: INFO + org.hibernate: DEBUG + +# Server configuration server: port: 8088 servlet: context-path: /api + + +# spring.datasource.url=jdbc:postgresql://localhost:54320/postgres +# spring.datasource.username=postgres +# spring.datasource.password=root +# spring.jpa.show-sql=true +# +# ## Hibernate Properties +# # The SQL dialect makes Hibernate generate better SQL for the chosen database +# spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect +# spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false +# +# # Hibernate ddl auto (create, create-drop, validate, update) +# spring.jpa.hibernate.ddl-auto=update +# spring.jpa.database=postgresql +# +# logging.level.root=info +# logging.pattern.console=%d{dd-MM-yyyy HH:mm:ss.SSS} %magenta([%thread]) %highlight(%-5level) %logger.%M - %msg%n +# +# server.port=8282 \ No newline at end of file