초기소스
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package com.wb.domainserver.domain.auth.controller;
|
||||
|
||||
|
||||
import com.wb.domainserver.domain.auth.vo.AuthVO;
|
||||
import com.wb.domainserver.response.WnbtResponse;
|
||||
import com.wb.domainserver.response.WnbtResponseBody;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import jakarta.servlet.http.Cookie;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/mngr/auth")
|
||||
public class AuthController {
|
||||
|
||||
|
||||
/**
|
||||
* 관리자 > 쇼핑몰 변경
|
||||
* @param vo
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/selectMngrSopmalSite")
|
||||
public ResponseEntity<WnbtResponse> selectMngrSopmalSite(@RequestBody AuthVO vo, HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
//기존 쿠기값 변경
|
||||
if(request.getCookies() != null) {
|
||||
for(Cookie cookie : request.getCookies()){
|
||||
if("authSopmalCd".equals(cookie.getName())){
|
||||
cookie.setPath("/");
|
||||
cookie.setValue(vo.getSopmalCd());
|
||||
response.addCookie(cookie);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
message.put("result", "success");
|
||||
|
||||
return ResponseEntity.ok(WnbtResponse.builder()
|
||||
.resBody(new WnbtResponseBody(message))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.wb.domainserver.domain.auth.mapper;
|
||||
|
||||
|
||||
import com.wb.domainserver.domain.auth.vo.AuthVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface AuthMapper {
|
||||
|
||||
/*관리자 > 접근 가능한 쇼핑몰 리스트 조회*/
|
||||
List<String> selectAuthorSopmalList(AuthVO vo);
|
||||
/*관리자 > 쇼핑몰 페이지 권한 여부*/
|
||||
Integer selectAuthorSiteAt(AuthVO vo);
|
||||
|
||||
/*인트라넷 > 인트라넷 페이지 권한 여부*/
|
||||
Integer selectItrntAuthorSiteAt(AuthVO vo);
|
||||
|
||||
|
||||
/*사용자 -> 접근권한 조회*/
|
||||
public int selectUserAuthor(AuthVO vo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.wb.domainserver.domain.auth.service;
|
||||
|
||||
import com.wb.domainserver.domain.auth.mapper.AuthMapper;
|
||||
import com.wb.domainserver.domain.auth.vo.AuthVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AuthService {
|
||||
|
||||
|
||||
private final AuthMapper mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 관리자 > 접근 가능한 쇼핑몰 리스트 조회
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public List<String> selectAuthorSopmalList(AuthVO vo){
|
||||
return mapper.selectAuthorSopmalList(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 관리자 > 쇼핑몰 페이지 권한 여부
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public Boolean selectAuthorSiteAt(AuthVO vo){
|
||||
int result = mapper.selectAuthorSiteAt(vo);
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 인트라넷 > 인트라넷 페이지 권한 여부
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
public Boolean selectItrntAuthorSiteAt(AuthVO vo){
|
||||
int result = mapper.selectItrntAuthorSiteAt(vo);
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
public Map<String, Object> selectUserAuthor(AuthVO vo){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
int authAt = mapper.selectUserAuthor(vo);
|
||||
|
||||
if(authAt > 0){
|
||||
result.put("authAt", "Y");
|
||||
}else{
|
||||
result.put("authAt", "N");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
44
src/main/java/com/wb/domainserver/domain/auth/vo/AuthVO.java
Normal file
44
src/main/java/com/wb/domainserver/domain/auth/vo/AuthVO.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.wb.domainserver.domain.auth.vo;
|
||||
|
||||
|
||||
import com.wb.domainserver.domain.comm.vo.AbstractVO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class AuthVO extends AbstractVO {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/*관리자 고유번호*/
|
||||
private int mngrInnb;
|
||||
|
||||
/*쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
|
||||
|
||||
/*관리자 로그인 구분 */
|
||||
private String sysDvCd;
|
||||
|
||||
/*권한 url*/
|
||||
private String fnctUri;
|
||||
|
||||
|
||||
private String uri;
|
||||
|
||||
|
||||
/*인트라넷*/
|
||||
|
||||
//매장고유번호
|
||||
private int strInnb;
|
||||
|
||||
//대표브랜드
|
||||
private String reprsntBrand;
|
||||
|
||||
//매장운영구분
|
||||
private String strOperDv;
|
||||
|
||||
//본사 입점사 구분
|
||||
private String tentGroup;
|
||||
}
|
||||
Reference in New Issue
Block a user