diff --git a/src/main/java/com/xit/biz/ctgy/auth/MinPasswordEncoder.java b/src/main/java/com/xit/biz/ctgy/auth/MinPasswordEncoder.java index a0b001e..8270951 100644 --- a/src/main/java/com/xit/biz/ctgy/auth/MinPasswordEncoder.java +++ b/src/main/java/com/xit/biz/ctgy/auth/MinPasswordEncoder.java @@ -1,6 +1,6 @@ package com.xit.biz.ctgy.auth; -import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; +import com.xit.biz.ctgy.v2.repository.UserDao; import lombok.RequiredArgsConstructor; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -17,7 +17,7 @@ public class MinPasswordEncoder implements PasswordEncoder { @Setter private String userid; - private final MinUserinfoDao minUserinfoDao; + private final UserDao minUserinfoDao; /** * 비밀번호 암호화 diff --git a/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java b/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java index ca124f2..a9955e7 100644 --- a/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java +++ b/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java @@ -5,7 +5,7 @@ import com.xit.biz.ctgy.auth.service.IAuthMinService; import com.xit.biz.ctgy.dto.LoginMinRequestDto; import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.entity.MinUserinfo; -import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; +import com.xit.biz.ctgy.v2.repository.UserDao; import com.xit.core.constant.ErrorCode; import com.xit.core.constant.XitConstants; import com.xit.core.exception.TokenAuthException; @@ -50,7 +50,7 @@ public class AuthMinService implements IAuthMinService { private final AppProperties appProperties; private final AuthenticationManager authenticationManager; - private final MinUserinfoDao userinfoDao; + private final UserDao userinfoDao; private final JwtTokenProvider jwtTokenProvider; private final RefreshTokenDao refreshTokenDao; diff --git a/src/main/java/com/xit/biz/ctgy/auth/service/impl/CustomMinUserDetailsService.java b/src/main/java/com/xit/biz/ctgy/auth/service/impl/CustomMinUserDetailsService.java index f117214..f6a9d48 100644 --- a/src/main/java/com/xit/biz/ctgy/auth/service/impl/CustomMinUserDetailsService.java +++ b/src/main/java/com/xit/biz/ctgy/auth/service/impl/CustomMinUserDetailsService.java @@ -3,7 +3,7 @@ package com.xit.biz.ctgy.auth.service.impl; import com.xit.biz.ctgy.auth.UserMinPrincipal; import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.entity.MinUserinfo; -import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; +import com.xit.biz.ctgy.v2.repository.UserDao; import com.xit.core.constant.ErrorCode; import com.xit.core.exception.CustomBaseException; import lombok.RequiredArgsConstructor; @@ -16,7 +16,7 @@ import org.springframework.stereotype.Service; @RequiredArgsConstructor public class CustomMinUserDetailsService implements UserDetailsService { - private final MinUserinfoDao minUserinfoDao; + private final UserDao minUserinfoDao; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { diff --git a/src/main/java/com/xit/biz/ctgy/v2/repository/MinUserinfoDao.java b/src/main/java/com/xit/biz/ctgy/v2/repository/UserDao.java similarity index 92% rename from src/main/java/com/xit/biz/ctgy/v2/repository/MinUserinfoDao.java rename to src/main/java/com/xit/biz/ctgy/v2/repository/UserDao.java index 20dd7ac..024a5dd 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/repository/MinUserinfoDao.java +++ b/src/main/java/com/xit/biz/ctgy/v2/repository/UserDao.java @@ -12,7 +12,7 @@ import java.util.Optional; @Repository @Slf4j -public class MinUserinfoDao extends BaseMpowerDaoSupport { +public class UserDao extends BaseMpowerDaoSupport { public Optional findByUserid(final String userid){ String sql = QueryGenerator.createNamedQuery("user", "selectUserInfo") .setParameter("userid", userid) @@ -36,9 +36,9 @@ public class MinUserinfoDao extends BaseMpowerDaoSupport { return selectOneColumn(sql); } - public MinUserinfo findMinUserinfoByUserid(final String userid){ - return null; - } +// public MinUserinfo findMinUserinfoByUserid(final String userid){ +// return null; +// } //------------------------------------------------------------------------- // 주정차위반 심사대상 등록 - 등록 대상 심사자 조회 diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/IMinUserService.java b/src/main/java/com/xit/biz/ctgy/v2/service/IMinUserService.java index 0e8083e..21389c9 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/IMinUserService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/IMinUserService.java @@ -9,9 +9,9 @@ public interface IMinUserService { Page findMinUsers(final MinUserinfo minUserinfo, Pageable pageable); - MinUserinfo findMinUser(); + MinUserinfoDto findMinUser(); - MinUserinfo findMinUserByUserid(final String userId); + MinUserinfoDto findMinUserByUserid(final String userId); void saveMinUser(MinUserinfoDto dto); diff --git a/src/main/java/com/xit/biz/ctgy/v2/service/impl/MinUserService.java b/src/main/java/com/xit/biz/ctgy/v2/service/impl/MinUserService.java index b44450c..2e1a1c2 100644 --- a/src/main/java/com/xit/biz/ctgy/v2/service/impl/MinUserService.java +++ b/src/main/java/com/xit/biz/ctgy/v2/service/impl/MinUserService.java @@ -2,18 +2,19 @@ package com.xit.biz.ctgy.v2.service.impl; import com.xit.biz.ctgy.dto.MinUserinfoDto; import com.xit.biz.ctgy.entity.MinUserinfo; -import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; +import com.xit.biz.ctgy.v2.repository.UserDao; import com.xit.biz.ctgy.v2.service.IMinUserService; import com.xit.core.constant.ErrorCode; import com.xit.core.exception.CustomBaseException; import com.xit.core.oauth2.utils.HeaderUtil; import lombok.AllArgsConstructor; -import org.mapstruct.factory.Mappers; import org.springframework.data.domain.*; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; + import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains; @AllArgsConstructor @@ -21,7 +22,7 @@ import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatc public class MinUserService implements IMinUserService { private final PasswordEncoder passwordEncoder; - private final MinUserinfoDao minUserinfoDao; + private final UserDao minUserinfoDao; @Transactional//(readOnly = true) public Page findMinUsers(final MinUserinfo minUserinfo, Pageable pageable) { @@ -39,16 +40,16 @@ public class MinUserService implements IMinUserService { @Override @Transactional(readOnly = true) - public MinUserinfo findMinUser() { + public MinUserinfoDto findMinUser() { //cmmUserRepos //return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId()); - return minUserinfoDao.findMinUserinfoByUserid(HeaderUtil.getUserId()); + return minUserinfoDao.findByUserid(HeaderUtil.getUserId()).orElse(null); } @Override @Transactional(readOnly = true) - public MinUserinfo findMinUserByUserid(final String userid) { - return minUserinfoDao.findMinUserinfoByUserid(userid); + public MinUserinfoDto findMinUserByUserid(final String userid) { + return minUserinfoDao.findByUserid(userid).orElse(null); } @Override diff --git a/src/main/java/com/xit/core/config/SecurityConfig.java b/src/main/java/com/xit/core/config/SecurityConfig.java index 1bdc0e1..b02444d 100644 --- a/src/main/java/com/xit/core/config/SecurityConfig.java +++ b/src/main/java/com/xit/core/config/SecurityConfig.java @@ -3,7 +3,7 @@ package com.xit.core.config; import com.xit.biz.ctgy.auth.MinPasswordEncoder; import com.xit.biz.ctgy.auth.service.impl.CustomMinOAuth2UserService; import com.xit.biz.ctgy.auth.service.impl.CustomMinUserDetailsService; -import com.xit.biz.ctgy.v2.repository.MinUserinfoDao; +import com.xit.biz.ctgy.v2.repository.UserDao; import com.xit.core.oauth2.api.dao.RefreshTokenDao; import com.xit.core.oauth2.config.properties.AppProperties; import com.xit.core.oauth2.config.properties.CorsProperties; @@ -105,7 +105,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { private final CustomMinOAuth2UserService customOAuth2UserService; private final TokenAccessDeniedHandler tokenAccessDeniedHandler; private final RefreshTokenDao refreshTokenDao; - private final MinUserinfoDao minUserinfoDao; + private final UserDao minUserinfoDao; /** * 1. configure( WebSecurity) : 서비스 전체에 영향을 미치는 설정