refactor: 패키지 변경 적용
parent
d0881b869d
commit
a936f4833d
@ -1,52 +0,0 @@
|
|||||||
package com.xit.biz.ctgy.controller;
|
|
||||||
|
|
||||||
import com.xit.biz.ctgy.dto.MinCivBoard680Dto;
|
|
||||||
import com.xit.biz.ctgy.dto.struct.MinCivBoard680Mapstruct;
|
|
||||||
import com.xit.biz.ctgy.service.IMinCivBoard680Service;
|
|
||||||
import com.xit.core.api.IRestResponse;
|
|
||||||
import com.xit.core.api.RestResponse;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
|
||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Tag(name = "MinCivBoard680Controller", description = "게시글 관리")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/v1/ctgy/board")
|
|
||||||
@Validated
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MinCivBoard680Controller {
|
|
||||||
|
|
||||||
private final IMinCivBoard680Service service;
|
|
||||||
|
|
||||||
private final MinCivBoard680Mapstruct mapstruct = Mappers.getMapper(MinCivBoard680Mapstruct.class);
|
|
||||||
|
|
||||||
// TODO :: 파라메터 정의 필요
|
|
||||||
@Operation(summary = "게시글 목록 조회" , description = "게시글 목록 조회")
|
|
||||||
@Parameters({
|
|
||||||
@Parameter(in = ParameterIn.QUERY, name = "ciTitle", description = "제목", required = false, example = " "),
|
|
||||||
@Parameter(in = ParameterIn.QUERY, name = "ciName", description = "이름", required = false, example = " "),
|
|
||||||
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
|
|
||||||
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
|
|
||||||
})
|
|
||||||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public ResponseEntity<? extends IRestResponse> findMinCivBoard680s(
|
|
||||||
@Parameter(hidden = true)
|
|
||||||
final MinCivBoard680Dto dto,
|
|
||||||
@Parameter(hidden = true)
|
|
||||||
final Pageable pageable) {
|
|
||||||
return RestResponse.of(service.findAll(mapstruct.toEntity(dto), pageable));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
package com.xit.biz.ctgy.controller;
|
|
||||||
|
|
||||||
import com.xit.biz.ctgy.dto.MinCivBoard680Dto;
|
|
||||||
import com.xit.biz.ctgy.dto.MinUserinfoDto;
|
|
||||||
import com.xit.biz.ctgy.dto.struct.MinCivBoard680Mapstruct;
|
|
||||||
import com.xit.biz.ctgy.dto.struct.MinUserinfoMapstruct;
|
|
||||||
import com.xit.biz.ctgy.service.IMinCivBoard680Service;
|
|
||||||
import com.xit.biz.ctgy.service.IMinUserinfoService;
|
|
||||||
import com.xit.core.annotation.Secured;
|
|
||||||
import com.xit.core.annotation.SecurityPolicy;
|
|
||||||
import com.xit.core.api.IRestResponse;
|
|
||||||
import com.xit.core.api.RestResponse;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
|
||||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@Tag(name = "MinUserinfoController", description = "사용자 관리")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/api/v1/ctgy/user")
|
|
||||||
@Validated
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MinUserinfoController {
|
|
||||||
|
|
||||||
private final IMinUserinfoService service;
|
|
||||||
|
|
||||||
private final MinUserinfoMapstruct mapstruct = Mappers.getMapper(MinUserinfoMapstruct.class);
|
|
||||||
|
|
||||||
// TODO :: 파라메터 정의 필요
|
|
||||||
@Operation(summary = "사용자 목록 조회" , description = "사용자 목록 조회")
|
|
||||||
@Parameters({
|
|
||||||
@Parameter(in = ParameterIn.QUERY, name = "userid", description = "사용자ID", required = false, example = " "),
|
|
||||||
@Parameter(in = ParameterIn.QUERY, name = "name", description = "이름", required = false, example = " "),
|
|
||||||
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
|
|
||||||
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
|
|
||||||
})
|
|
||||||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public ResponseEntity<? extends IRestResponse> findMinUserinfos(
|
|
||||||
@Parameter(hidden = true)
|
|
||||||
@ModelAttribute("minUserinfoDto")
|
|
||||||
final MinUserinfoDto minUserinfoDto,
|
|
||||||
@Parameter(hidden = true)
|
|
||||||
final Pageable pageable) {
|
|
||||||
return RestResponse.of(service.findMinUserinfos(mapstruct.toEntity(minUserinfoDto), pageable));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
|
|
||||||
@GetMapping("/info")
|
|
||||||
@Secured(policy = SecurityPolicy.TOKEN)
|
|
||||||
@Transactional(readOnly = true)
|
|
||||||
public ResponseEntity<? extends IRestResponse> getUserInfo() {
|
|
||||||
return RestResponse.of(service.findMyUserWithoutAuthorities());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.xit.biz.ctgy.repository;
|
|
||||||
|
|
||||||
import com.xit.biz.ctgy.entity.MinUserinfo;
|
|
||||||
import com.xit.core.oauth2.utils.SecurityUtil;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public interface IMinUserinfoRepository extends JpaRepository<MinUserinfo, String> {
|
|
||||||
Optional<MinUserinfo> findByUserid(String userid);
|
|
||||||
|
|
||||||
@Query(value = "SELECT TRAFFIC.ECL_ENCRYPT(?1) AS passwd FROM DUAL C", nativeQuery = true)
|
|
||||||
//@Query(value = "SELECT ECL_ENCRYPT(?1) AS passwd", nativeQuery = true)
|
|
||||||
String queryGetPasswdEncode(@Param("passwd") String passwd);
|
|
||||||
|
|
||||||
@Query(value = "SELECT ECL_DECRYPT(MU.passwd) AS passwd FROM min_userinfo MU WHERE MU.userid = ?1", nativeQuery = true)
|
|
||||||
String queryGetPasswd(@Param("userid") String userid);
|
|
||||||
|
|
||||||
MinUserinfo findMinUserinfoByUserid(String userid);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package com.xit.biz.ctgy.service;
|
|
||||||
|
|
||||||
import com.xit.biz.ctgy.entity.MinCivBoard680;
|
|
||||||
import com.xit.core.support.jpa.IJpaOperation;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
|
|
||||||
public interface IMinCivBoard680Service {
|
|
||||||
|
|
||||||
Page<MinCivBoard680> findAll(MinCivBoard680 minCivBoard680, Pageable pageable);
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.xit.biz.ctgy.service;
|
|
||||||
|
|
||||||
import com.xit.biz.cmm.entity.CmmUser;
|
|
||||||
import com.xit.biz.ctgy.entity.MinUserinfo;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
public interface IMinUserinfoService {
|
|
||||||
|
|
||||||
Page<MinUserinfo> findMinUserinfos(MinUserinfo minUserinfo, Pageable pageable);
|
|
||||||
|
|
||||||
MinUserinfo findMyUserWithoutAuthorities();
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
package com.xit.biz.ctgy.service.impl;
|
|
||||||
|
|
||||||
import com.xit.biz.cmm.entity.CmmUser;
|
|
||||||
import com.xit.biz.ctgy.entity.MinUserinfo;
|
|
||||||
import com.xit.biz.ctgy.repository.IMinUserinfoRepository;
|
|
||||||
import com.xit.biz.ctgy.service.IMinUserinfoService;
|
|
||||||
import com.xit.core.oauth2.utils.HeaderUtil;
|
|
||||||
import com.xit.core.oauth2.utils.SecurityUtil;
|
|
||||||
import com.xit.core.support.jpa.JpaUtil;
|
|
||||||
import org.springframework.data.domain.Example;
|
|
||||||
import org.springframework.data.domain.ExampleMatcher;
|
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class MinUserinfoService implements IMinUserinfoService {
|
|
||||||
|
|
||||||
private final IMinUserinfoRepository repository;
|
|
||||||
|
|
||||||
public MinUserinfoService(IMinUserinfoRepository repository) {
|
|
||||||
this.repository = repository;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional//(readOnly = true)
|
|
||||||
public Page<MinUserinfo> findMinUserinfos(MinUserinfo minUserinfo, Pageable pageable) {
|
|
||||||
//Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
|
|
||||||
pageable = JpaUtil.getPagingInfo(pageable);
|
|
||||||
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll()
|
|
||||||
.withMatcher("userid", contains())
|
|
||||||
.withMatcher("name", contains());
|
|
||||||
Example<MinUserinfo> example = Example.of(minUserinfo, exampleMatcher);
|
|
||||||
Page<MinUserinfo> page = repository.findAll(example, pageable);
|
|
||||||
// List<CmmUser> userList = page.getContent();
|
|
||||||
return page;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional(readOnly = true)
|
|
||||||
public MinUserinfo findMyUserWithoutAuthorities() {
|
|
||||||
//cmmUserRepos
|
|
||||||
//return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId());
|
|
||||||
return repository.findMinUserinfoByUserid(HeaderUtil.getUserId());
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue