init commit
parent
aec2526c7d
commit
18d468c8a2
@ -0,0 +1 @@
|
|||||||
|
inoremap jj <ESC>
|
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
Binary file not shown.
@ -0,0 +1,81 @@
|
|||||||
|
package com.xit;
|
||||||
|
|
||||||
|
//import com.xit.core.config.ignore.DataJdbcConfig;
|
||||||
|
|
||||||
|
import com.xit.core.api.CustomBeanNameGenerator;
|
||||||
|
import com.xit.core.oauth2.config.properties.AppProperties;
|
||||||
|
import com.xit.core.oauth2.config.properties.CorsProperties;
|
||||||
|
import com.xit.core.util.Checks;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
|
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.FilterType;
|
||||||
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 설정에서 제외하는 경우
|
||||||
|
* 자동설정에서 제외할 자동설정 클래스 제외 설정 : Security chain 비활성
|
||||||
|
* SpringBootApplication(exclude = {SecurityAutoConfiguration.class, UserDetailsServiceAutoConfiguration.class})
|
||||||
|
* excludeFilters 설정 :
|
||||||
|
* type = FilterType.ASSIGNABLE_TYPE 인 경우 value = {WebMvcConfig.class, ThymeleafWebViewResolverConfig.class}
|
||||||
|
* type = FilterType.REGEX 인 경우 pattern = {"com.xit.core.config.ignore.*"} 형식으로
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@SpringBootApplication //(exclude = {SecurityAutoConfiguration.class, UserDetailsServiceAutoConfiguration.class})
|
||||||
|
@EnableTransactionManagement
|
||||||
|
// @WebFilter load
|
||||||
|
@ServletComponentScan
|
||||||
|
@EnableConfigurationProperties({
|
||||||
|
CorsProperties.class,
|
||||||
|
AppProperties.class
|
||||||
|
})
|
||||||
|
@ComponentScan(
|
||||||
|
basePackages = {"com.xit.biz", "com.xit.core"},
|
||||||
|
excludeFilters = @ComponentScan.Filter(
|
||||||
|
type = FilterType.ASPECTJ,
|
||||||
|
pattern = {
|
||||||
|
"com.xit.._ignore..*"
|
||||||
|
//"com..support.auth.jwt..*"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
public class Application { //WebApplicationInitializer {
|
||||||
|
static final String BEAN_GEN_BASE_PACKAGE = "com.xit.**.controller";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebFlux main application
|
||||||
|
* @param args String[]
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) throws IOException {
|
||||||
|
log.info("xitApplication Application load start...");
|
||||||
|
if(Checks.isEmpty(System.getProperty("spring.profiles.active"))) {
|
||||||
|
log.error("====================================================================");
|
||||||
|
log.error(">>>>>>>>>>>>>> Undefined start option <<<<<<<<<<<<<<");
|
||||||
|
log.error(">>>>>>>>>>>>>> -Dspring.profiles.active=local|dev|prd <<<<<<<<<<<<<<");
|
||||||
|
log.error("============== xitApplication Application start fail ===============");
|
||||||
|
log.error("====================================================================");
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
SpringApplicationBuilder applicationBuilder = new SpringApplicationBuilder(Application.class);
|
||||||
|
|
||||||
|
// beanName Generator 등록 : API v1, v2 등으로 분류하는 경우
|
||||||
|
// Bean 이름 식별시 풀패키지 명으로 식별 하도록 함
|
||||||
|
CustomBeanNameGenerator beanNameGenerator = new CustomBeanNameGenerator();
|
||||||
|
beanNameGenerator.addBasePackages(BEAN_GEN_BASE_PACKAGE);
|
||||||
|
applicationBuilder.beanNameGenerator(beanNameGenerator);
|
||||||
|
|
||||||
|
//TODO : 이벤트 실행 시점이 Application context 실행 이전인 경우 리스너 추가
|
||||||
|
//application.listeners(new xitCoreApplicationListner());
|
||||||
|
applicationBuilder.build().run(args);
|
||||||
|
|
||||||
|
log.info("=========================================================================================");
|
||||||
|
log.info("========== xitApplication Application load Complete :: active profiles - {} ==========", System.getProperty("spring.profiles.active"));
|
||||||
|
log.info("=========================================================================================");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.xit;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
public class ServletInitializer extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(Application.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
//import com.xit.biz.cmm.domain.CmmAddress;
|
||||||
|
//import com.xit.biz.cmm.service.impl.CmmAddressMgtService;
|
||||||
|
//import com.xit.core.api.ApiResponseDto;
|
||||||
|
//import io.swagger.annotations.Api;
|
||||||
|
//import io.swagger.annotations.ApiOperation;
|
||||||
|
//import lombok.RequiredArgsConstructor;
|
||||||
|
//import org.springframework.web.bind.annotation.*;
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * @author Lim, Jong Uk (minuk926)
|
||||||
|
// * @since 2021-07-16
|
||||||
|
// */
|
||||||
|
//
|
||||||
|
//@RestController
|
||||||
|
//@RequiredArgsConstructor
|
||||||
|
//@RequestMapping("/api/biz/cmm/addr")
|
||||||
|
//@Api(tags = "CmmAddressMgtController")
|
||||||
|
//public class CmmAddressMgtController {
|
||||||
|
//
|
||||||
|
// private final CmmAddressMgtService cmmAddressMgtService;
|
||||||
|
//
|
||||||
|
// @Operation(description = "주소 등록")
|
||||||
|
// @PostMapping
|
||||||
|
// public ResponseEntity<? extends RestResponse> save(@RequestBody CmmAddress cmmAddress){
|
||||||
|
// return ResponseEntity.ok().body(RestResult.of(cmmAddressMgtService.save(cmmAddress));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(description = "주소 조회")
|
||||||
|
// @GetMapping
|
||||||
|
// public ResponseEntity<? extends RestResponse> findAll(){
|
||||||
|
// return ResponseEntity.ok().body(RestResult.of(cmmAddressMgtService.findAll());
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//}
|
@ -0,0 +1,108 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmBoard;
|
||||||
|
import com.xit.biz.cmm.service.ICmmBoardService;
|
||||||
|
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.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* ResponseEntity(HttpStatus status)
|
||||||
|
* ResponseEntity(MultiValueMap<String, String> headers, HttpStatus status)
|
||||||
|
* ResponseEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers, HttpStatus status)
|
||||||
|
*
|
||||||
|
* ResponseEntity 에 헤더값 set ::
|
||||||
|
* MultiValueMap<String, String> header = new LinkedMultiValueMap<>();
|
||||||
|
* header.add("token", "xxxx");
|
||||||
|
* header.add("authcode", "xxxxx");
|
||||||
|
* return new ResponseEntity(header, HttpStatus.OK)
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Tag(name = "CmmBoardMgtController", description = "게시판 관리")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/biz/cmm/board")
|
||||||
|
public class CmmBoardMgtController {
|
||||||
|
|
||||||
|
private final ICmmBoardService cmmBoardService;
|
||||||
|
|
||||||
|
//private CmmBoardMapstruct mapstruct = Mappers.getMapper(CmmBoardMapstruct.class);
|
||||||
|
|
||||||
|
@Operation(summary = "게시판 목록 조회" , description = "등록된 게시판 목록 전체 조회")
|
||||||
|
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findAll() {
|
||||||
|
return RestResponse.of(cmmBoardService.findAll());
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Page<MovieCharacter> loadCharactersPage(
|
||||||
|
@PageableDefault(page = 0, size = 20)
|
||||||
|
@SortDefault.SortDefaults({
|
||||||
|
@SortDefault(sort = "name", direction = Sort.Direction.DESC),
|
||||||
|
@SortDefault(sort = "id", direction = Sort.Direction.ASC)
|
||||||
|
}) Pageable pageable)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pageable
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Operation(summary = "게시판 목록 조회(페이징)" , description = "등록된 게시판 목록 전체 조회(페이징)")
|
||||||
|
//@@Parameters({
|
||||||
|
// @Parameter(name = "pageNumber", value = "조회할 페이지", required = false), // dataType = "Pageable", paramType = "Integer", defaultValue = "0"),
|
||||||
|
// @Parameter(name = "pageSize", value = "페이지당 갯수", required = false) //, dataType = "Pageable", paramType = "Integer", defaultValue = "10")
|
||||||
|
//})
|
||||||
|
@GetMapping(value = "/page", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findAllPage(final Pageable pageable) {
|
||||||
|
|
||||||
|
Page<CmmBoard> page = cmmBoardService.findAll(pageable);
|
||||||
|
//log.debug("Page : {}", page);
|
||||||
|
log.debug("Page number : {}", page.getNumber());
|
||||||
|
log.debug("Page size : {}", page.getSize());
|
||||||
|
log.debug("Total size : {}", page.getTotalPages());
|
||||||
|
log.debug("Total count : {}", page.getTotalElements());
|
||||||
|
log.debug("Prev : {}", page.hasPrevious());
|
||||||
|
log.debug("Next : {}", page.hasNext());
|
||||||
|
List<CmmBoard> list = page.getContent();
|
||||||
|
return RestResponse.of(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "게시물 상세 조회" , description = "등록된 게시물 상세")
|
||||||
|
@GetMapping(value = "/{boardId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findByBoardId(@PathVariable Long boardId) {
|
||||||
|
Optional<CmmBoard> board = cmmBoardService.findById(boardId);
|
||||||
|
return RestResponse.of(board.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> saveBoard(@RequestBody CmmBoard board) {
|
||||||
|
return RestResponse.of(cmmBoardService.save(board));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> updateBoard(@RequestBody CmmBoard board) {
|
||||||
|
return RestResponse.of(cmmBoardService.update(board));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value="/{boardId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> deleteBoard(@PathVariable Long boardId) {
|
||||||
|
cmmBoardService.deleteById(boardId);
|
||||||
|
return RestResponse.of(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,158 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
//import com.xit.biz.adm.mapstruct.BoardJpaMapper;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmBoard;
|
||||||
|
import com.xit.biz.cmm.service.ICmmBoardService;
|
||||||
|
import com.xit.core.api.IRestResponse;
|
||||||
|
import com.xit.core.api.RestResponse;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* ResponseEntity(HttpStatus status)
|
||||||
|
* ResponseEntity(MultiValueMap<String, String> headers, HttpStatus status)
|
||||||
|
* ResponseEntity(@Nullable T body, @Nullable MultiValueMap<String, String> headers, HttpStatus status)
|
||||||
|
*
|
||||||
|
* ResponseEntity 에 헤더값 set ::
|
||||||
|
* MultiValueMap<String, String> header = new LinkedMultiValueMap<>();
|
||||||
|
* header.add("token", "xxxx");
|
||||||
|
* header.add("authcode", "xxxxx");
|
||||||
|
* return new ResponseEntity(header, HttpStatus.OK)
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/web/biz/cmm/board")
|
||||||
|
public class CmmBoardWebController {
|
||||||
|
|
||||||
|
private final ICmmBoardService cmmBoardService;
|
||||||
|
|
||||||
|
//private CmmBoardMapstruct mapstruct = Mappers.getMapper(CmmBoardMapstruct.class);
|
||||||
|
|
||||||
|
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public String boardForm(Model model) {
|
||||||
|
return "/biz/adm/boardManagement";
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Page<MovieCharacter> loadCharactersPage(
|
||||||
|
@PageableDefault(page = 0, size = 20)
|
||||||
|
@SortDefault.SortDefaults({
|
||||||
|
@SortDefault(sort = "name", direction = Sort.Direction.DESC),
|
||||||
|
@SortDefault(sort = "id", direction = Sort.Direction.ASC)
|
||||||
|
}) Pageable pageable)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param pageable Pageable
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/page") //, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public String findAllPage(final Pageable pageable, Model model) {
|
||||||
|
|
||||||
|
Page<CmmBoard> page = cmmBoardService.findAll(pageable);
|
||||||
|
//log.debug("Page : {}", page);
|
||||||
|
log.debug("Page number : {}", page.getNumber());
|
||||||
|
log.debug("Page size : {}", page.getSize());
|
||||||
|
log.debug("Total size : {}", page.getTotalPages());
|
||||||
|
log.debug("Total count : {}", page.getTotalElements());
|
||||||
|
log.debug("Prev : {}", page.hasPrevious());
|
||||||
|
log.debug("Next : {}", page.hasNext());
|
||||||
|
List<CmmBoard> list = page.getContent();
|
||||||
|
model.addAttribute("data", list);
|
||||||
|
model.addAttribute("pagination", page.getPageable());
|
||||||
|
model.addAttribute("title", "djdjjdjdjjd");
|
||||||
|
return "biz/adm/boardManagement";
|
||||||
|
}
|
||||||
|
|
||||||
|
// @GetMapping(value = "/page", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<Page<Board>> findByBoardIdGreaterThan(PageRequest pageRequest) {
|
||||||
|
// Page<Board> page = boardService.findByBoardIdGreaterThan(dto, pageRequest);
|
||||||
|
// log.debug("Page : {}", page);
|
||||||
|
// log.debug("Page number : {}", page.getNumber());
|
||||||
|
// log.debug("Page size : {}", page.getSize());
|
||||||
|
// log.debug("Total size : {}", page.getTotalPages());
|
||||||
|
// log.debug("Total count : {}", page.getTotalElements());
|
||||||
|
// log.debug("Prev : {}", page.hasPrevious());
|
||||||
|
// log.debug("Next : {}", page.hasNext());
|
||||||
|
// return ResponseEntity.ok(page);
|
||||||
|
// }
|
||||||
|
|
||||||
|
@GetMapping(value = "/{boardId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findByBoardId(@PathVariable final Long boardId) {
|
||||||
|
Optional<CmmBoard> board = cmmBoardService.findById(boardId);
|
||||||
|
return RestResponse.of(board.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> saveBoard(@RequestBody CmmBoard board) {
|
||||||
|
return RestResponse.of(cmmBoardService.save(board));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PutMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> updateBoard(@RequestBody CmmBoard board) {
|
||||||
|
return RestResponse.of(cmmBoardService.update(board));
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping(value="/{boardId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> deleteBoard(@PathVariable final Long boardId) {
|
||||||
|
cmmBoardService.deleteById(boardId);
|
||||||
|
return RestResponse.of(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(value = "/api", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> saveBoardApi(@RequestBody CmmBoard board) {
|
||||||
|
return RestResponse.of(cmmBoardService.save(board));
|
||||||
|
//return ResponseEntity.ok(boardService.save(board));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(value = "/api", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findAllApi() {
|
||||||
|
return RestResponse.of(cmmBoardService.findAll());
|
||||||
|
//return ResponseEntity.ok(boardService.findAll(), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Page<MovieCharacter> loadCharactersPage(
|
||||||
|
@PageableDefault(page = 0, size = 20)
|
||||||
|
@SortDefault.SortDefaults({
|
||||||
|
@SortDefault(sort = "name", direction = Sort.Direction.DESC),
|
||||||
|
@SortDefault(sort = "id", direction = Sort.Direction.ASC)
|
||||||
|
}) Pageable pageable)
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/api/page", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findAllPageApi(final Pageable pageable) {
|
||||||
|
|
||||||
|
// Page<Board> page = boardService.findAllPage(pageable);
|
||||||
|
// //log.debug("Page : {}", page);
|
||||||
|
// log.debug("Page number : {}", page.getNumber());
|
||||||
|
// log.debug("Page size : {}", page.getSize());
|
||||||
|
// log.debug("Total size : {}", page.getTotalPages());
|
||||||
|
// log.debug("Total count : {}", page.getTotalElements());
|
||||||
|
// log.debug("Prev : {}", page.hasPrevious());
|
||||||
|
// log.debug("Next : {}", page.hasNext());
|
||||||
|
// List<Board> list = page.getContent();
|
||||||
|
// return ResponseEntity.ok(page);
|
||||||
|
|
||||||
|
return RestResponse.of(cmmBoardService.findAll(pageable));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,115 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.*;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeSIds;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.biz.cmm.service.ICmmCodeService;
|
||||||
|
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.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@Tag(name = "CmmCodeMgtController", description = "코드 관리")
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/biz/cmm/code")
|
||||||
|
public class CmmCodeMgtController {
|
||||||
|
private final ICmmCodeService cmmCodeService;
|
||||||
|
|
||||||
|
@Operation(summary = "콤보코드조회" , description = "콤보코드를 조회")
|
||||||
|
@GetMapping("/combo")
|
||||||
|
public ResponseEntity<? extends IRestResponse> findComboCodes(@Nonnull final CmmCodeSIds searchKeyDto) {
|
||||||
|
Assert.notNull(searchKeyDto, "조회할 콤보코드 대상이 없습니다.");
|
||||||
|
Assert.notNull(searchKeyDto.getCodeGrpId(), "조회할 대분류 코드를 선택해 주세요.");
|
||||||
|
return RestResponse.of(cmmCodeService.findComboCodes(searchKeyDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "코드그룹 목록 조회")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeGrpId", description = "코드그룹ID", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeNm", description = "코드그룹명", required = false, example = " "),
|
||||||
|
@Parameter(name = "codeCd", hidden = true),
|
||||||
|
@Parameter(name = "codeMeta1", hidden = true),
|
||||||
|
@Parameter(name = "codeMeta2", hidden = true),
|
||||||
|
@Parameter(name = "codeMeta3", hidden = true),
|
||||||
|
@Parameter(name = "codeMeta4", hidden = true),
|
||||||
|
@Parameter(name = "codeMeta5", hidden = true),
|
||||||
|
@Parameter(name = "createdBy", hidden = true),
|
||||||
|
@Parameter(name = "modifiedBy", hidden = true),
|
||||||
|
@Parameter(name = "createdDate", hidden = true),
|
||||||
|
@Parameter(name = "modifiedDate", hidden = true),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "0"),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
|
||||||
|
//@Parameter(in = ParameterIn.QUERY, name = "sort", description = "정렬", required = true, example = "codeOrdr"),
|
||||||
|
})
|
||||||
|
@GetMapping("/grp")
|
||||||
|
public ResponseEntity<? extends IRestResponse> findCmmCodeGrps(
|
||||||
|
@Parameter(hidden = true)
|
||||||
|
final CmmCodeDto codeDto,
|
||||||
|
@Parameter(hidden = true)
|
||||||
|
@Nonnull final Pageable pageable) {
|
||||||
|
return RestResponse.of(cmmCodeService.findCmmCodeGrps(codeDto, pageable));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "코드 목록 조회")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeGrpId", description = "코드그룹ID", required = true, example = "G_CODE"),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeLcd", description = "대분류코드", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeMcd", description = "중분류코드", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeCd", description = "코드", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeNm", description = "코드명", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeMeta1", description = "코드메타1", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeMeta2", description = "코드메타2", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeMeta3", description = "코드메타3", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeMeta4", description = "코드메타4", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "codeMeta5", description = "코드메타5", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "createdBy", hidden = true),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "modifiedBy", hidden = true),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "createdDate", hidden = true),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "modifiedDate", hidden = true)
|
||||||
|
})
|
||||||
|
@GetMapping
|
||||||
|
public ResponseEntity<? extends IRestResponse> findCmmCodes(@Parameter(hidden = true) @Nonnull final CmmCodeDto codeDto) {
|
||||||
|
return RestResponse.of(cmmCodeService.findCmmCodes(codeDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "코드그룹저장" , description = "코드그룹저장")
|
||||||
|
@PostMapping("/grp")
|
||||||
|
public ResponseEntity<? extends IRestResponse> saveCmmCodeGrp(@RequestBody @Nonnull CmmCodeGrp cmmCodeGrp) {
|
||||||
|
return RestResponse.of(cmmCodeService.saveCmmCodeGrp(cmmCodeGrp));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Operation(summary = "대분류코드저장" , description = "대분류코드저장")
|
||||||
|
// @PostMapping("/lcode")
|
||||||
|
// public ResponseEntity<? extends RestResponse> saveCmmCodeL(@RequestBody @Nonnull CmmCodeL cmmCodeL) {
|
||||||
|
// return RestResult.of(cmmCodeService.saveCmmCodeL(cmmCodeL));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(summary = "중분류코드저장" , description = "중분류코드저장")
|
||||||
|
// @PostMapping("/mcode")
|
||||||
|
// public ResponseEntity<? extends RestResponse> saveCmmCodeM(@RequestBody @Nonnull CmmCodeM cmmCodeM) {
|
||||||
|
// return RestResult.of(cmmCodeService.saveCmmCodeM(cmmCodeM));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(summary = "소분류코드저장" , description = "소분류코드저장")
|
||||||
|
// @PostMapping("/scode")
|
||||||
|
// public ResponseEntity<? extends RestResponse> saveCmmCodeS(@RequestBody @Nonnull CmmCodeS cmmCodeS) {
|
||||||
|
// return RestResult.of(cmmCodeService.saveCmmCodeS(cmmCodeS));
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Operation(summary = "코드 저장")
|
||||||
|
@PostMapping
|
||||||
|
public ResponseEntity<? extends IRestResponse> saveCmmCode(@RequestBody @Nonnull CmmCodeDto cmmCodeDto) {
|
||||||
|
return RestResponse.of(cmmCodeService.saveCmmCode(cmmCodeDto));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,70 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmFileMst;
|
||||||
|
import com.xit.biz.cmm.dto.CmmFileDto;
|
||||||
|
import com.xit.biz.cmm.service.ICmmFileService;
|
||||||
|
import com.xit.core.api.IRestResponse;
|
||||||
|
import com.xit.core.api.RestResponse;
|
||||||
|
import com.xit.core.util.AssertUtils;
|
||||||
|
import com.xit.core.util.Checks;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@Tag(name = "CmmFileMgtController", description = "파일 관리")
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/biz/cmm/file")
|
||||||
|
public class CmmFileMgtController {
|
||||||
|
private final ICmmFileService cmmFileService;
|
||||||
|
|
||||||
|
@Operation(summary = "파일 조회" , description = "등록된 파일 조회")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ResponseEntity<? extends IRestResponse> findFiles(@PathVariable("id") @NonNull final String fileMstId) {
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(fileMstId), "대상 파일[fileMstId]을 선택해 주세요.");
|
||||||
|
return RestResponse.of(cmmFileService.findFiles(fileMstId));
|
||||||
|
}
|
||||||
|
|
||||||
|
//@Operation(summary = "파일 저장" , description = "파일 저장")
|
||||||
|
//@PostMapping()
|
||||||
|
public ResponseEntity<? extends IRestResponse> saveFiles2(CmmFileMst cmmFileMst, @RequestParam("files") MultipartFile[] files) {
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmFileMst), "파일 정보가 존재하지 않습니다.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmFileMst.getFileCtgCd()), "파일 구분 코드[fileCtgCd] 정보가 존재하지 않습니다.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmFileMst.getFileBizId()), "파일 업무 ID[fileBizId] 정보가 존재하지 않습니다.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(files), "대상 파일이 존재하지 않습니다.");
|
||||||
|
return RestResponse.of(cmmFileService.saveFiles(cmmFileMst, files));
|
||||||
|
|
||||||
|
// RedirectAttributes redirectAttributes
|
||||||
|
// redirectAttributes.addFlashAttribute("message",
|
||||||
|
// "You successfully uploaded " + file.getOriginalFilename() + "!");
|
||||||
|
//
|
||||||
|
// return "redirect:/";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "파일 저장" , description = "파일 저장")
|
||||||
|
@PostMapping(consumes = "multipart/form-data")
|
||||||
|
public ResponseEntity<? extends IRestResponse> saveFiles(@ModelAttribute @Nonnull CmmFileDto cmmFileDto) {
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmFileDto), "파일 정보가 존재하지 않습니다.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmFileDto.getFileCtgCd()), "파일 구분 코드[fileCtgCd] 정보가 존재하지 않습니다.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmFileDto.getFileBizId()), "파일 업무 ID[fileBizId] 정보가 존재하지 않습니다.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmFileDto.getFiles()), "대상 파일이 존재하지 않습니다.");
|
||||||
|
CmmFileMst cmmFileMst = CmmFileMst.builder()
|
||||||
|
.fileMstId(cmmFileDto.getFileMstId())
|
||||||
|
.fileCtgCd(cmmFileDto.getFileCtgCd())
|
||||||
|
.fileBizId(cmmFileDto.getFileBizId())
|
||||||
|
.build();
|
||||||
|
return RestResponse.of(cmmFileService.saveFiles(cmmFileMst, cmmFileDto.getFiles()));
|
||||||
|
|
||||||
|
// RedirectAttributes redirectAttributes
|
||||||
|
// redirectAttributes.addFlashAttribute("message",
|
||||||
|
// "You successfully uploaded " + file.getOriginalFilename() + "!");
|
||||||
|
//
|
||||||
|
// return "redirect:/";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.service.ICmmRoleMenuService;
|
||||||
|
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.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Tag(name = "CmmRoleMenuMgtController", description = "권한별 메뉴 관리")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/biz/cmm/role/menu")
|
||||||
|
public class CmmRoleMenuMgtController {
|
||||||
|
private final ICmmRoleMenuService cmmRoleUserService;
|
||||||
|
|
||||||
|
@Operation(description = "권한별 메뉴 목록")
|
||||||
|
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findAll() {
|
||||||
|
|
||||||
|
return RestResponse.of(cmmRoleUserService.findAll());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Operation(description = "권한 메뉴 목록 조회")
|
||||||
|
// @GetMapping(value="/{roleId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<? extends RestResponse> findByCmmUserId(
|
||||||
|
// @Parameter(name="roleId", description = "권한ID", example = "")
|
||||||
|
// @PathVariable final String cmmUserId) {
|
||||||
|
// return RestResult.of(cmmRoleUserService.findById(cmmUserId));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(description = "권한 메뉴 추가")
|
||||||
|
// @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<? extends RestResponse> save(@RequestBody CmmRoleUer cmmRoleUer) {
|
||||||
|
//
|
||||||
|
// return RestResult.of(cmmRoleUserService.save(cmmRoleUer));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(description = "권한 메뉴 삭제")
|
||||||
|
// @DeleteMapping(value="/{roleId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<? extends RestResponse> deleteByCmmUserId(@PathVariable final String cmmUserId) {
|
||||||
|
// cmmRoleUserService.deleteById(cmmUserId);
|
||||||
|
// return RestResult.of(HttpStatus.OK);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRole;
|
||||||
|
import com.xit.biz.cmm.service.ICmmRoleService;
|
||||||
|
import com.xit.biz.cmm.service.ICmmRoleUserService;
|
||||||
|
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.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Tag(name = "CmmRoleMgtController", description = "권한 관리")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/biz/cmm/role")
|
||||||
|
public class CmmRoleMgtController {
|
||||||
|
private final ICmmRoleService cmmRoleService;
|
||||||
|
private final ICmmRoleUserService cmmRoleUserService;
|
||||||
|
|
||||||
|
@Operation(summary = "권한 목록 조회")
|
||||||
|
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findAll() {
|
||||||
|
|
||||||
|
return RestResponse.of(cmmRoleService.findAll());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Operation(summary = "권한 목록 조회")
|
||||||
|
// @GetMapping(value="/page", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<? extends RestResponse> findAllPage(final Pageable pageable) {
|
||||||
|
//
|
||||||
|
// Page<CmmRoleGrp> page = cmmRoleRepository.findAll(PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()));
|
||||||
|
// return ResponseEntity.ok().body(RestResult.of(page);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Operation(summary = "권한 정보 조회")
|
||||||
|
@GetMapping(value="/{roleId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findByRoleId(@PathVariable final String roleId) {
|
||||||
|
return RestResponse.of(cmmRoleService.findById(roleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "권한 추가")
|
||||||
|
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> save(@RequestBody CmmRole cmmRole) {
|
||||||
|
|
||||||
|
return RestResponse.of(cmmRoleService.save(cmmRole));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "궘한 정보 변경")
|
||||||
|
@PutMapping(value="/{roleId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> modify(@PathVariable final String roleId, @RequestBody CmmRole cmmRoleEntity) {
|
||||||
|
return RestResponse.of(cmmRoleService.save(cmmRoleEntity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "권한 삭제")
|
||||||
|
@DeleteMapping(value="/{roleId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> deleteByRoleId(@PathVariable final String roleId) {
|
||||||
|
cmmRoleService.deleteById(roleId);
|
||||||
|
return RestResponse.of(HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Operation(summary = "권한그룹 사용자 목록 조회")
|
||||||
|
// @GetMapping(value="/user/{roleId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<? extends RestResponse> findUserMstByroleId(
|
||||||
|
// @Parameter(name = "roleId", description = "권한그룹 ID", example = "1")
|
||||||
|
// @PathVariable final String roleId) {
|
||||||
|
// return RestResult.of(cmmRoleUserService.findById(roleId));
|
||||||
|
// }
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRoleUer;
|
||||||
|
import com.xit.biz.cmm.service.ICmmRoleUserService;
|
||||||
|
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.tags.Tag;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
@Tag(name = "CmmRoleUserMgtController", description = "권한별 사용자 관리")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/biz/cmm/role/user")
|
||||||
|
public class CmmRoleUserMgtController {
|
||||||
|
private final ICmmRoleUserService cmmRoleUserService;
|
||||||
|
|
||||||
|
@Operation(description = "사용자 권한 목록 조회")
|
||||||
|
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findAll() {
|
||||||
|
|
||||||
|
return RestResponse.of(cmmRoleUserService.findAll());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Operation(description = "사용자 권한 목록 조회")
|
||||||
|
// @GetMapping(value="/page", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<? extends RestResponse> findAllPage(final Pageable pageable) {
|
||||||
|
//
|
||||||
|
// Page<CmmUserRole> page = cmmUserRoleRepository.findAll(PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()));
|
||||||
|
// return RestResult.of(page);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
// @Operation(description = "사용자 권한 그룹 목록 조회")
|
||||||
|
// @GetMapping(value="/{cmmUserId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<? extends RestResponse> findByCmmUserId(
|
||||||
|
// @Parameter(name="cmmUserId", description = "사용자 ID(PK)", example = "1")
|
||||||
|
// @PathVariable final String cmmUserId) {
|
||||||
|
// return RestResult.of(cmmRoleUserService.findById(cmmUserId));
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Operation(description = "사용자 권한 추가")
|
||||||
|
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> save(@RequestBody CmmRoleUer cmmRoleUer) {
|
||||||
|
|
||||||
|
return RestResponse.of(cmmRoleUserService.save(cmmRoleUer));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Operation(description = "사용자 권한 삭제")
|
||||||
|
// @DeleteMapping(value="/{roleId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public ResponseEntity<? extends RestResponse> deleteByCmmUserId(@PathVariable final String cmmUserId) {
|
||||||
|
// cmmRoleUserService.deleteById(cmmUserId);
|
||||||
|
// return RestResult.of(HttpStatus.OK);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.dto.struct.CmmUserMapstruct;
|
||||||
|
import com.xit.biz.cmm.entity.CmmUser;
|
||||||
|
import com.xit.biz.cmm.dto.CmmUserDto;
|
||||||
|
import com.xit.biz.cmm.service.ICmmRoleUserService;
|
||||||
|
import com.xit.biz.cmm.service.ICmmUserService;
|
||||||
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
@Tag(name = "CmmUserMgtController", description = "사용자 관리")
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/api/biz/cmm/user")
|
||||||
|
public class CmmUserMgtController {
|
||||||
|
private final ICmmUserService cmmUserService;
|
||||||
|
private final ICmmRoleUserService cmmRoleUerService;
|
||||||
|
private final PasswordEncoder encoder;
|
||||||
|
|
||||||
|
private CmmUserMapstruct cmmUserMapstruct = Mappers.getMapper(CmmUserMapstruct.class);
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 전체 목록 조회" , description = "등록된 사용자 전체 목록 조회")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "1"),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
|
||||||
|
})
|
||||||
|
@GetMapping(value="/page1", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findAll(@Parameter(hidden = true) final Pageable pageable) {
|
||||||
|
//Page<CmmUser> page = cmmUserRepository.findAll(PageRequest.of(paging.getPage(), paging.getSize()));
|
||||||
|
return RestResponse.of(cmmUserService.findAll(pageable));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 목록 조회" , description = "등록된 사용자 목록 조회")
|
||||||
|
// @Parameter(description="CmmUserDto to add. Cannot null or empty.",
|
||||||
|
// required=true, schema=@Schema(implementation = CmmUserDto.class))
|
||||||
|
// @Parameter(description="Pageable to add. Cannot null or empty.",
|
||||||
|
// required=true, schema=@Schema(implementation = Pageable.class))
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "userId", description = "사용자id", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "userName", description = "사용자이름", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "userMbl", description = "전화(핸드폰)번호", required = false, example = " "),
|
||||||
|
@Parameter(name = "userEmail", hidden = true),
|
||||||
|
@Parameter(name = "userPswd", hidden = true),
|
||||||
|
@Parameter(name = "authority", hidden = true),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "1"),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10")
|
||||||
|
//@Parameter(in = ParameterIn.QUERY, name = "sort", description = "정렬", required = true, example = "codeOrdr"),
|
||||||
|
})
|
||||||
|
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findCmmUsers(
|
||||||
|
@Parameter(hidden = true)
|
||||||
|
@ModelAttribute("cmmUserDto")
|
||||||
|
final CmmUserDto cmmUserDto,
|
||||||
|
@Parameter(hidden = true)
|
||||||
|
final Pageable pageable) {
|
||||||
|
return RestResponse.of(cmmUserService.findCmmUsers(cmmUserMapstruct.toEntity(cmmUserDto), pageable));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
|
||||||
|
@Parameter(in = ParameterIn.PATH, name = "cmmUserId", description = "사용자 ID(PK)", example = "1")
|
||||||
|
@GetMapping(value="/{cmmUserId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findByCmmUserId(
|
||||||
|
@PathVariable final String cmmUserId) {
|
||||||
|
return RestResponse.of(cmmUserService.findById(cmmUserId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 등록" , description = "신규 사용자 등록")
|
||||||
|
@PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> save(@RequestBody @Valid CmmUser cmmUser) {
|
||||||
|
cmmUser.setPassword(encoder.encode(cmmUser.getPassword()));
|
||||||
|
return RestResponse.of(cmmUserService.save(cmmUser));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 정보 변경" , description = "사용자 정보 변경")
|
||||||
|
@PutMapping(value="/{cmmUserId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> modify(
|
||||||
|
@Parameter(name = "cmmUserId", description = "사용자 ID(PK)", example = "1", required = true)
|
||||||
|
@PathVariable final Long cmmUserId, @RequestBody CmmUser cmmUser) {
|
||||||
|
return RestResponse.of(cmmUserService.save(cmmUser));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 삭제" , description = "사용자 제거")
|
||||||
|
@DeleteMapping(value="/{cmmUserId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> deleteById(
|
||||||
|
@Parameter(name = "cmmUserId", description = "사용자 ID(PK)", example = "1")
|
||||||
|
@PathVariable final String cmmUserId) {
|
||||||
|
cmmUserService.deleteByCmmUserId(cmmUserId);
|
||||||
|
return RestResponse.of(HttpStatus.OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "사용자 권한 그룹 목록 조회")
|
||||||
|
@GetMapping(value="/role/{cmmUserId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public ResponseEntity<? extends IRestResponse> findRoleGroupByCmmUserId(
|
||||||
|
@Parameter(name = "cmmUserId", description = "사용자 ID(PK)", example = "1")
|
||||||
|
@PathVariable final Long cmmUserId) {
|
||||||
|
return RestResponse.of(cmmRoleUerService.findById(cmmUserId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.xit.biz.cmm.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.service.ICmmUserService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RequestMapping("/web/biz/cmm/user")
|
||||||
|
public class CmmUserWebController {
|
||||||
|
|
||||||
|
private final ICmmUserService cmmUserService;
|
||||||
|
|
||||||
|
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
public String userForm() {
|
||||||
|
return "/biz/cmm/userManagement";
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Operation(summary = "사용자 정보 조회", description = "사용자 정보 조회")
|
||||||
|
// @GetMapping(value = "/{cmmUserId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public Mono<?> findByCmmUserId(@PathVariable final Long cmmUserId) {
|
||||||
|
// CmmUser cmmUser = cmmUserRepository.findByCmmUserId(cmmUserId);
|
||||||
|
// return Mono.just(
|
||||||
|
// Rendering.view("/biz/cmm/userManagement.html")
|
||||||
|
// .modelAttribute("data", cmmUserRepository.findByCmmUserId(cmmUserId))
|
||||||
|
// .build());
|
||||||
|
// }
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.xit.biz.cmm.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.springframework.data.domain.Sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MapStruct 사용을 위해 아래 사항 반드시 지킬 것
|
||||||
|
* 1. @NoArgsConstructor
|
||||||
|
* 2. @Builder 사용
|
||||||
|
* --> @Setter이 필요하나 사용을 지양하는 추세이므로 Builder 방식으로 generate 되도록 한다
|
||||||
|
*/
|
||||||
|
@Schema(name = "CmmBoardDto", description = "게시판 관리용 DTO")
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor // Builder 사용시 필요
|
||||||
|
@Builder
|
||||||
|
public class CmmBoardDto {
|
||||||
|
|
||||||
|
@Schema(name = "board ID")
|
||||||
|
private Long boardId;
|
||||||
|
private String ctgCd;
|
||||||
|
private String title;
|
||||||
|
private String content;
|
||||||
|
private String fileBizId;
|
||||||
|
private String fileId;
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
private int pageNum;
|
||||||
|
private int pageSize;
|
||||||
|
private Sort.Direction direction;
|
||||||
|
private String[] sortArr;
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package com.xit.biz.cmm.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MapStruct 사용을 위해 아래 사항 반드시 지킬 것
|
||||||
|
* 1. @NoArgsConstructor
|
||||||
|
* 2. @Builder 사용
|
||||||
|
* --> @Setter이 필요하나 사용을 지양하는 추세이므로 Builder 방식으로 generate 되도록 한다
|
||||||
|
*/
|
||||||
|
@Schema(name = "CmmCodeDto", description = "공통코드 DTO")
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmCodeDto implements Serializable {
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(title = "코드그룹ID", example = " ", description = "대분류코드조회시 필수")
|
||||||
|
private String codeGrpId;
|
||||||
|
|
||||||
|
@Schema(title = "대분류코드", example = " ", description = "중분류코드조회시 필수")
|
||||||
|
private String codeLcd;
|
||||||
|
|
||||||
|
@Schema(title = "중분류코드", example = " ", description = "소분류코드조회시 필수")
|
||||||
|
private String codeMcd;
|
||||||
|
|
||||||
|
@Schema(title = "코드", example = " ")
|
||||||
|
private String codeCd;
|
||||||
|
|
||||||
|
@Schema(title = "코드명", example = " ")
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "코드설명", example = " ")
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
@Schema(title = "코드메타1", example = " ")
|
||||||
|
private String codeMeta1;
|
||||||
|
|
||||||
|
@Schema(title = "코드메타2", example = " ")
|
||||||
|
private String codeMeta2;
|
||||||
|
|
||||||
|
@Schema(title = "코드메타3", example = " ")
|
||||||
|
private String codeMeta3;
|
||||||
|
|
||||||
|
@Schema(title = "코드메타4", example = " ")
|
||||||
|
private String codeMeta4;
|
||||||
|
|
||||||
|
@Schema(title = "코드메타5", example = " ")
|
||||||
|
private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(title = "코드정렬순서", example = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
|
||||||
|
@Schema(title = "사용여부", example = "Y")
|
||||||
|
private String useYn;
|
||||||
|
|
||||||
|
@Schema(title = "생성자", example = " ")
|
||||||
|
private String createdBy;
|
||||||
|
|
||||||
|
@Schema(title = "생성일시", example = " ")
|
||||||
|
private String createdDate;
|
||||||
|
|
||||||
|
@Schema(title = "변경자", example = " ")
|
||||||
|
private String modifiedBy;
|
||||||
|
|
||||||
|
@Schema(title = "변경일시", example = " ")
|
||||||
|
private String modifiedDate;
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.xit.biz.cmm.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MapStruct 사용을 위해 아래 사항 반드시 지킬 것
|
||||||
|
* 1. @NoArgsConstructor
|
||||||
|
* 2. @Builder 사용
|
||||||
|
* --> @Setter이 필요하나 사용을 지양하는 추세이므로 Builder 방식으로 generate 되도록 한다
|
||||||
|
*/
|
||||||
|
@Schema(name = "CmmFileDto", description = "파일 관리용 DTO")
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor // Builder 사용시 필요
|
||||||
|
@Builder
|
||||||
|
public class CmmFileDto implements Serializable {
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(title = "파일 마스터 ID", description = "변경시 nonNull")
|
||||||
|
private String fileMstId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일구분코드", example = "BOARD", description = "파일분류구분코드")
|
||||||
|
private String fileCtgCd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일업무ID", example = "BOARD001", description = "업무테이블 PK조합")
|
||||||
|
private String fileBizId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일객체", example = "null", description = "업로드 파일 객체")
|
||||||
|
private MultipartFile[] files;
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
package com.xit.biz.cmm.dto;
|
||||||
|
|
||||||
|
//import com.xit.core.annotation.EnumTypeValid;
|
||||||
|
import com.xit.biz.cmm.entity.CmmUser;
|
||||||
|
import com.xit.core.support.valid.EnumNamePattern;
|
||||||
|
import com.xit.core.support.valid.Enums;
|
||||||
|
import com.xit.core.oauth2.oauth.entity.ProviderType;
|
||||||
|
import com.xit.core.oauth2.oauth.entity.RoleType;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
//import org.hibernate.validator.constraints.Email;
|
||||||
|
//import org.hibernate.validator.constraints.NotEmpty;
|
||||||
|
|
||||||
|
import javax.persistence.EnumType;
|
||||||
|
import javax.persistence.Enumerated;
|
||||||
|
import javax.validation.constraints.Email;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MapStruct 사용을 위해 아래 사항 반드시 지킬 것
|
||||||
|
* 1. @NoArgsConstructor
|
||||||
|
* 2. @Builder 사용
|
||||||
|
* --> @Setter이 필요하나 사용을 지양하는 추세이므로 Builder 방식으로 generate 되도록 한다
|
||||||
|
*/
|
||||||
|
@Schema(name = "CmmUserDto", description = "사용자 Dto") //, parent = AuditEntity.class)
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmUserDto implements Serializable { //extends RepresentationModel<CmmUserEntity> implements Serializable {
|
||||||
|
|
||||||
|
@Schema(title = "사용자ID(PK)", example = " ", description = "실제 PK(unique)")
|
||||||
|
private String cmmUserId;
|
||||||
|
|
||||||
|
@Schema(title = "사용자ID(실제ID)", example = "minuk926", description = "논리적인 PK(unique)")
|
||||||
|
@NotEmpty(message = "{userId.not.empty}")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Schema(title = "사용자 이름", example = "홍길동")
|
||||||
|
@NotEmpty(message = "{userName.not.empty}")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@Schema(title = "사용자 비밀번호", example = "Minuk926!@")
|
||||||
|
@Pattern(
|
||||||
|
regexp = "(?=.*[0-9])(?=.*[a-zA-Z])(?=.*\\W)(?=\\S+$).{8,20}",
|
||||||
|
message = "비밀번호는 영문 대소문자와 숫자, 특수기호가 적어도 1개 이상씩 포함된 8자 ~ 20자의 비밀번호여야 합니다."
|
||||||
|
)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Schema(title = "전화번호", example = "01012341234")
|
||||||
|
@Pattern(regexp = "[0-9]{11}", message = "{mobile.pattern}")
|
||||||
|
private String userMbl;
|
||||||
|
|
||||||
|
@Schema(title = "사용자 이메일", example = "a@b.com", description = "unique")
|
||||||
|
@NotBlank(message = "메일 주소는 필수 입니다")
|
||||||
|
@Email(message = "{mail.pattern}")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "권한", example = "USER", description = "권한 - ROLE_USER, ROLE_ADMIN")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@EnumNamePattern(regexp = "ADMIN|USER|GUEST", message = "{auth.user.pattern.RoleType}")
|
||||||
|
private RoleType roleType;
|
||||||
|
|
||||||
|
////////////////////////// Socail 사용시 ////////////////////////////////////////////////////////////////
|
||||||
|
@Schema(required = true, title = "ProviderType Type", example = "LOCAL", description = "SNS TYPE")
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
@Enums(enumClass = ProviderType.class, ignoreCase = false, message = "{auth.user.pattern.ProviderType}")
|
||||||
|
private ProviderType providerType;
|
||||||
|
|
||||||
|
@Schema(title = "프로필 이미지 RL", example = "NO_IMAGE_URL", description = "SNS 사용시")
|
||||||
|
private String profileImageUrl;
|
||||||
|
|
||||||
|
@Schema(title = "이메일 확인 여부", example = "N", description = "SNS 사용시sms 'Y'")
|
||||||
|
@NotBlank
|
||||||
|
@Builder.Default
|
||||||
|
String emailVerifiedYn = "N";
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
public CmmUser toUser(PasswordEncoder passwordEncoder) {
|
||||||
|
return CmmUser.builder()
|
||||||
|
.providerType(providerType)
|
||||||
|
//.providerType(ProviderType.valueOf(providerType))
|
||||||
|
.userId(userId)
|
||||||
|
.userName(userName)
|
||||||
|
.password(passwordEncoder.encode(password))
|
||||||
|
.userMbl(userMbl)
|
||||||
|
.email(email)
|
||||||
|
.roleType(roleType)
|
||||||
|
//.roleType(RoleType.valueOf(roleType))
|
||||||
|
.emailVerifiedYn(emailVerifiedYn)
|
||||||
|
.profileImageUrl(profileImageUrl)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.xit.biz.cmm.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
@Schema(name = "CmmCodeDto", description = "콤보공통코드 DTO")
|
||||||
|
public interface ComboCodeDto {
|
||||||
|
public String getCode();
|
||||||
|
public String getValue();
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.xit.biz.cmm.dto.struct;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmBoard;
|
||||||
|
import com.xit.biz.cmm.dto.CmmBoardDto;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.IMapstruct;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.MapStructMapperConfig;
|
||||||
|
import org.mapstruct.Builder;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@Mapper(config = MapStructMapperConfig.class)
|
||||||
|
public interface CmmBoardMapstruct extends IMapstruct<CmmBoardDto, CmmBoard> {
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.xit.biz.cmm.dto.struct;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeGrp;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.IMapstruct;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.MapStructMapperConfig;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@Mapper(config = MapStructMapperConfig.class)
|
||||||
|
public interface CmmCodeGrpMapstruct extends IMapstruct<CmmCodeDto, CmmCodeGrp> {
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.xit.biz.cmm.dto.struct;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeL;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.IMapstruct;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.MapStructMapperConfig;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@Mapper(config = MapStructMapperConfig.class)
|
||||||
|
public interface CmmCodeLMapstruct extends IMapstruct<CmmCodeDto, CmmCodeL> {
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.xit.biz.cmm.dto.struct;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeM;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.IMapstruct;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.MapStructMapperConfig;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@Mapper(config = MapStructMapperConfig.class)
|
||||||
|
public interface CmmCodeMMapstruct extends IMapstruct<CmmCodeDto, CmmCodeM> {
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.xit.biz.cmm.dto.struct;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeS;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.IMapstruct;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.MapStructMapperConfig;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@Mapper(config = MapStructMapperConfig.class)
|
||||||
|
public interface CmmCodeSMapstruct extends IMapstruct<CmmCodeDto, CmmCodeS> {
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.xit.biz.cmm.dto.struct;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmUser;
|
||||||
|
import com.xit.biz.cmm.dto.CmmUserDto;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.IMapstruct;
|
||||||
|
import com.xit.core.support.jpa.mapstruct.MapStructMapperConfig;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@Mapper(config = MapStructMapperConfig.class)
|
||||||
|
public interface CmmUserMapstruct extends IMapstruct<CmmUserDto, CmmUser> {
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmAddressIds;
|
||||||
|
import com.xit.core.constant.XitConstants;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmAddress", description = "주소")
|
||||||
|
@Table(name = "tb_cmm_address")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@IdClass(CmmAddressIds.class)
|
||||||
|
public class CmmAddress extends AuditEntity implements Serializable {
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@JoinColumn(name = "cmm_user_id")
|
||||||
|
private String cmmUserId;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Schema(required = true, title = "주소일련번호", example = "001", description = "사용자별 일련번호")
|
||||||
|
@Column(name = "addr_seq", nullable = false, length = 3)
|
||||||
|
private String addrSeq;
|
||||||
|
|
||||||
|
// @MapsId("userId")
|
||||||
|
// @ManyToOne
|
||||||
|
// @JoinColumn(name = "user_id")
|
||||||
|
// private CmmUser cmmUser;
|
||||||
|
//
|
||||||
|
// @EmbeddedId
|
||||||
|
// private CmmAddressIds addrSeq;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "주소 구분", example = "STREET", description = "지번 / 도로명")
|
||||||
|
@Column(nullable = false, length = 10)
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private XitConstants.AddressType addressType;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "우편번호", example = "03001", description = "우편번호")
|
||||||
|
@Column(nullable = false, length = 6)
|
||||||
|
private String zipCode;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "기본 주소", example = "경기도 일산 동구 호수로 336", description = "기본 주소")
|
||||||
|
@Column(nullable = false, length = 100)
|
||||||
|
private String address1;
|
||||||
|
|
||||||
|
@Schema(title = "상세 주소", example = "xxx아파트 xx동 xx호", description = "상세 주소")
|
||||||
|
@Column(nullable = false, length = 100)
|
||||||
|
private String address2;
|
||||||
|
|
||||||
|
@Schema(title = "부가 주소", example = "null", description = "부가 주소 - 외국 주소인 경우 필요")
|
||||||
|
@Column(nullable = false, length = 100)
|
||||||
|
private String address3;
|
||||||
|
|
||||||
|
@Schema(title = "기본주소 여부", example = "Y", description = "기본주소 여부")
|
||||||
|
//@Column(name = "default_yn", columnDefinition = "CHAR(1)", nullable = false, length = 1)
|
||||||
|
@Column(name = "default_yn", nullable = false, length = 1)
|
||||||
|
private String defaultYn;
|
||||||
|
|
||||||
|
// public void setCmmUser(CmmUser cmmUser){
|
||||||
|
// this.cmmUser = cmmUser;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmAddress that = (CmmAddress) o;
|
||||||
|
|
||||||
|
if (!Objects.equals(cmmUserId, that.cmmUserId)) return false;
|
||||||
|
return Objects.equals(addrSeq, that.addrSeq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = Objects.hashCode(cmmUserId);
|
||||||
|
result = 31 * result + (Objects.hashCode(addrSeq));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmBoard", description = "게시판")
|
||||||
|
@Table(
|
||||||
|
name = "tb_cmm_board",
|
||||||
|
indexes = {
|
||||||
|
@Index(name = "idx_tb_cmm_board_01", columnList ="ctg_cd,title")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmBoard extends AuditEntity implements Serializable{
|
||||||
|
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "게시판 ID", example = " ", description = "자동부여")
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(name = "board_id")
|
||||||
|
private Long boardId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "카테고리 구분 코드", example = "ctg_1")
|
||||||
|
@Column(name = "ctg_cd", length = 20, nullable = false)
|
||||||
|
private String ctgCd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "게시판 제목", example = "제목")
|
||||||
|
@Column(length = 128, nullable = false)
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "게시판 내용", example = "내용")
|
||||||
|
//@Column(columnDefinition = "TEXT", nullable = false)
|
||||||
|
@Column(nullable = false)
|
||||||
|
@Lob
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private int pageNum;
|
||||||
|
@Transient
|
||||||
|
private int pageSize;
|
||||||
|
@Transient
|
||||||
|
private int totalPage;
|
||||||
|
@Transient
|
||||||
|
private int totalCount;
|
||||||
|
|
||||||
|
@Transient // DB에 저장도 조회도 하지 않는다
|
||||||
|
private String firstName;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private String lastName;
|
||||||
|
|
||||||
|
@Access(AccessType.PROPERTY) // FULLNAME 컬럼에 firstName+lastName의 결과가 저장됨 getter를 이용해서 접근한다.
|
||||||
|
public String getFullName(){
|
||||||
|
return firstName + lastName;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmBoard cmmBoard = (CmmBoard) o;
|
||||||
|
|
||||||
|
return Objects.equals(boardId, cmmBoard.boardId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 1566954134;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,111 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmCodeGrp", description = "코드그룹") //, parent = AuditEntity.class)
|
||||||
|
@Table(name = "tb_cmm_code_grp")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmCodeGrp extends AuditEntity implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드그룹ID", example = "G_CODE_SAM")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_grp_id", nullable = false, length = 20)
|
||||||
|
private String codeGrpId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드그룹명", example = "코드그룹예제")
|
||||||
|
@Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "코드그룹상세", example = "코드그룹상세")
|
||||||
|
@Column(name = "code_remark", length = 50)
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
// @Schema(title = "추가필드1", example = " ")
|
||||||
|
// @Column(name = "code_meta_1", length = 10)
|
||||||
|
// private String codeMeta1;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드2", example = " ")
|
||||||
|
// @Column(name = "code_meta_2", length = 10)
|
||||||
|
// private String codeMeta2;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드3", example = " ")
|
||||||
|
// @Column(name = "code_meta_3", length = 10)
|
||||||
|
// private String codeMeta3;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드4", example = " ")
|
||||||
|
// @Column(name = "code_meta_4", length = 10)
|
||||||
|
// private String codeMeta4;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드5", example = " ")
|
||||||
|
// @Column(name = "code_meta_5", length = 10)
|
||||||
|
// private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
@Column(name = "code_ordr", nullable = false, length = 3) // columnDefinition = "int(3)")
|
||||||
|
@ColumnDefault(value = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Schema(required = true, title = "그룹코드명", example = "코드예제", description = "코드그룹명")
|
||||||
|
@Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "그룹코드상세", example = "공통 코드 예제", description = "공통 코드 예제")
|
||||||
|
@Column(name = "code_remark", length = 50)
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드1")
|
||||||
|
@Column(name = "code_meta_1", length = 10)
|
||||||
|
private String codeMeta1;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드2")
|
||||||
|
@Column(name = "code_meta_2", length = 10)
|
||||||
|
private String codeMeta2;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드3")
|
||||||
|
@Column(name = "code_meta_3", length = 10)
|
||||||
|
private String codeMeta3;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드4")
|
||||||
|
@Column(name = "code_meta_4", length = 10)
|
||||||
|
private String codeMeta4;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드5")
|
||||||
|
@Column(name = "code_meta_5", length = 10)
|
||||||
|
private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
@Column(name = "code_ordr", nullable = false, length = 3) @ColumnDefault(value = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmCodeGrp that = (CmmCodeGrp) o;
|
||||||
|
|
||||||
|
return Objects.equals(codeGrpId, that.codeGrpId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 1946457019;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,118 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeLIds;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmCodeL", description = "대분류코드") //, parent = AuditEntity.class)
|
||||||
|
@Table(name = "tb_cmm_code_l")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@IdClass(CmmCodeLIds.class)
|
||||||
|
public class CmmCodeL extends AuditEntity implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드그룹ID", example = "G_CODE_SAM", description = "공통코드그룹ID")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_grp_id", nullable = false, length = 20)
|
||||||
|
private String codeGrpId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "대분류코드", example = "L0001", description = "대분류 코드값")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_cd", nullable = false, length = 10)
|
||||||
|
private String codeCd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "대분류코드명", example = "대분류코드명")
|
||||||
|
@Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "대분류코드상세", example = "대분류코드상세")
|
||||||
|
@Column(name = "code_remark", length = 50)
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드1", example = " ")
|
||||||
|
@Column(name = "code_meta_1", length = 10)
|
||||||
|
private String codeMeta1;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드2", example = " ")
|
||||||
|
@Column(name = "code_meta_2", length = 10)
|
||||||
|
private String codeMeta2;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드3", example = " ")
|
||||||
|
@Column(name = "code_meta_3", length = 10)
|
||||||
|
private String codeMeta3;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드4", example = " ")
|
||||||
|
@Column(name = "code_meta_4", length = 10)
|
||||||
|
private String codeMeta4;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드5", example = " ")
|
||||||
|
@Column(name = "code_meta_5", length = 10)
|
||||||
|
private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
@Column(name = "code_ordr", nullable = false, length = 3) //columnDefinition = "int(3)")
|
||||||
|
@ColumnDefault(value = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Schema(required = true, title = "그룹코드명", example = "코드예제", description = "코드그룹명")
|
||||||
|
@Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "그룹코드상세", example = "공통 코드 예제", description = "공통 코드 예제")
|
||||||
|
@Column(name = "code_remark", length = 50)
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드1")
|
||||||
|
@Column(name = "code_meta_1", length = 10)
|
||||||
|
private String codeMeta1;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드2")
|
||||||
|
@Column(name = "code_meta_2", length = 10)
|
||||||
|
private String codeMeta2;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드3")
|
||||||
|
@Column(name = "code_meta_3", length = 10)
|
||||||
|
private String codeMeta3;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드4")
|
||||||
|
@Column(name = "code_meta_4", length = 10)
|
||||||
|
private String codeMeta4;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드5")
|
||||||
|
@Column(name = "code_meta_5", length = 10)
|
||||||
|
private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
@Column(name = "code_ordr", nullable = false, length = 3) @ColumnDefault(value = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmCodeL cmmCodeL = (CmmCodeL) o;
|
||||||
|
|
||||||
|
if (!Objects.equals(codeGrpId, cmmCodeL.codeGrpId)) return false;
|
||||||
|
return Objects.equals(codeCd, cmmCodeL.codeCd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = Objects.hashCode(codeGrpId);
|
||||||
|
result = 31 * result + (Objects.hashCode(codeCd));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,123 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeMIds;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmCodeM", description = "중분류코드") //, parent = AuditEntity.class)
|
||||||
|
@Table(name = "tb_cmm_code_m")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@IdClass(CmmCodeMIds.class)
|
||||||
|
public class CmmCodeM extends AuditEntity implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드그룹ID", example = "G_CODE_SAM", description = "공통코드그룹ID")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_grp_id", nullable = false, length = 20)
|
||||||
|
private String codeGrpId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "대분류코드", example = "L0001", description = "대분류코드값")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_lcd", nullable = false, length = 10)
|
||||||
|
private String codeLcd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "중분류코드", example = "M0001", description = "중분류 코드값")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_cd", nullable = false, length = 10)
|
||||||
|
private String codeCd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "중분류코드명", example = "중분류코드명")
|
||||||
|
@Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "중분류코드상세", example = "중분류코드상세")
|
||||||
|
@Column(name = "code_remark", length = 50)
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드1", example = " ")
|
||||||
|
@Column(name = "code_meta_1", length = 10)
|
||||||
|
private String codeMeta1;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드2", example = " ")
|
||||||
|
@Column(name = "code_meta_2", length = 10)
|
||||||
|
private String codeMeta2;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드3", example = " ")
|
||||||
|
@Column(name = "code_meta_3", length = 10)
|
||||||
|
private String codeMeta3;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드4", example = " ")
|
||||||
|
@Column(name = "code_meta_4", length = 10)
|
||||||
|
private String codeMeta4;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드5", example = " ")
|
||||||
|
@Column(name = "code_meta_5", length = 10)
|
||||||
|
private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
@Column(name = "code_ordr", nullable = false, length = 3) //columnDefinition = "int(3)")
|
||||||
|
// @ColumnDefault(value = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Schema(required = true, title = "그룹코드명", example = "코드예제", description = "코드그룹명")
|
||||||
|
@Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "그룹코드상세", example = "공통 코드 예제", description = "공통 코드 예제")
|
||||||
|
@Column(name = "code_remark", length = 50)
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드1")
|
||||||
|
@Column(name = "code_meta_1", length = 10)
|
||||||
|
private String codeMeta1;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드2")
|
||||||
|
@Column(name = "code_meta_2", length = 10)
|
||||||
|
private String codeMeta2;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드3")
|
||||||
|
@Column(name = "code_meta_3", length = 10)
|
||||||
|
private String codeMeta3;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드4")
|
||||||
|
@Column(name = "code_meta_4", length = 10)
|
||||||
|
private String codeMeta4;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드5")
|
||||||
|
@Column(name = "code_meta_5", length = 10)
|
||||||
|
private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
@Column(name = "code_ordr", nullable = false, length = 3) @ColumnDefault(value = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmCodeM cmmCodeM = (CmmCodeM) o;
|
||||||
|
|
||||||
|
if (!Objects.equals(codeGrpId, cmmCodeM.codeGrpId)) return false;
|
||||||
|
if (!Objects.equals(codeLcd, cmmCodeM.codeLcd)) return false;
|
||||||
|
return Objects.equals(codeCd, cmmCodeM.codeCd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = Objects.hashCode(codeGrpId);
|
||||||
|
result = 31 * result + (Objects.hashCode(codeLcd));
|
||||||
|
result = 31 * result + (Objects.hashCode(codeCd));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,131 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeSIds;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmCodeS", description = "소분류코드") //, parent = AuditEntity.class)
|
||||||
|
@Table(name = "tb_cmm_code_s")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@IdClass(CmmCodeSIds.class)
|
||||||
|
public class CmmCodeS extends AuditEntity implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드그룹ID", example = "G_CODE_SAM", description = "공통코드그룹ID")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_grp_id", nullable = false, length = 20)
|
||||||
|
private String codeGrpId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "대분류코드", example = "L0001", description = "대분류코드값")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_lcd", nullable = false, length = 10)
|
||||||
|
private String codeLcd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "중분류코드", example = "M0001", description = "중분류 코드값")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_mcd", nullable = false, length = 10)
|
||||||
|
private String codeMcd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "소분류코드", example = "001", description = "소분류 코드값")
|
||||||
|
@Id
|
||||||
|
@Column(name = "code_cd", nullable = false, length = 10)
|
||||||
|
private String codeCd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "소분류코드명", example = "소분류코드예시")
|
||||||
|
@Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "소분류코드상세", example = "소분류코드상세예시")
|
||||||
|
@Column(name = "code_remark", length = 50)
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드1", example = " ")
|
||||||
|
@Column(name = "code_meta_1", length = 10)
|
||||||
|
private String codeMeta1;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드2", example = " ")
|
||||||
|
@Column(name = "code_meta_2", length = 10)
|
||||||
|
private String codeMeta2;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드3", example = " ")
|
||||||
|
@Column(name = "code_meta_3", length = 10)
|
||||||
|
private String codeMeta3;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드4", example = " ")
|
||||||
|
@Column(name = "code_meta_4", length = 10)
|
||||||
|
private String codeMeta4;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드5", example = " ")
|
||||||
|
@Column(name = "code_meta_5", length = 10)
|
||||||
|
private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
@Column(name = "code_ordr", nullable = false, length = 3) //columnDefinition = "int(3)")
|
||||||
|
@ColumnDefault(value = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Schema(required = true, title = "그룹코드명", example = "코드예제", description = "코드그룹명")
|
||||||
|
@Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
private String codeNm;
|
||||||
|
|
||||||
|
@Schema(title = "그룹코드상세", example = "공통 코드 예제", description = "공통 코드 예제")
|
||||||
|
@Column(name = "code_remark", length = 50)
|
||||||
|
private String codeRemark;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드1")
|
||||||
|
@Column(name = "code_meta_1", length = 10)
|
||||||
|
private String codeMeta1;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드2")
|
||||||
|
@Column(name = "code_meta_2", length = 10)
|
||||||
|
private String codeMeta2;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드3")
|
||||||
|
@Column(name = "code_meta_3", length = 10)
|
||||||
|
private String codeMeta3;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드4")
|
||||||
|
@Column(name = "code_meta_4", length = 10)
|
||||||
|
private String codeMeta4;
|
||||||
|
|
||||||
|
@Schema(title = "추가필드5")
|
||||||
|
@Column(name = "code_meta_5", length = 10)
|
||||||
|
private String codeMeta5;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
@Column(name = "code_ordr", nullable = false, length = 3) @ColumnDefault(value = "99")
|
||||||
|
private Integer codeOrdr;
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmCodeS codeS = (CmmCodeS) o;
|
||||||
|
|
||||||
|
if (!Objects.equals(codeGrpId, codeS.codeGrpId)) return false;
|
||||||
|
if (!Objects.equals(codeLcd, codeS.codeLcd)) return false;
|
||||||
|
if (!Objects.equals(codeMcd, codeS.codeMcd)) return false;
|
||||||
|
return Objects.equals(codeCd, codeS.codeCd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = Objects.hashCode(codeGrpId);
|
||||||
|
result = 31 * result + (Objects.hashCode(codeLcd));
|
||||||
|
result = 31 * result + (Objects.hashCode(codeMcd));
|
||||||
|
result = 31 * result + (Objects.hashCode(codeCd));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmFileDtlIds;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmFileDtl", description = "파일 상세") //, parent = AuditEntity.class)
|
||||||
|
@Table(
|
||||||
|
name = "tb_cmm_file_dtl"
|
||||||
|
)
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@IdClass(CmmFileDtlIds.class)
|
||||||
|
public class CmmFileDtl extends AuditEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = -543086850590535341L;
|
||||||
|
|
||||||
|
// @MapsId(value = "fileMstId")
|
||||||
|
@Id
|
||||||
|
@Schema(required = true, title = "파일MstID", example = " ", description = "FileMst ID")
|
||||||
|
@Column(name = "file_mst_id", nullable = false)
|
||||||
|
private String fileMstId;
|
||||||
|
//
|
||||||
|
// @EmbeddedId
|
||||||
|
@Id
|
||||||
|
@Schema(required = true, title = "파일ID", example = " ", description = "UUID로 자동 생성")
|
||||||
|
@Column(name = "file_id", nullable = false, length = 50)
|
||||||
|
private String fileId;// = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
|
|
||||||
|
// @EmbeddedId
|
||||||
|
// private CmmFileDtlIds cmmFileDtlIds;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "원본파일명", example = "sample.jpg", description = "서버에서 처리")
|
||||||
|
@Column(name = "org_file_nm", nullable = false, length = 100)
|
||||||
|
private String orgFileNm;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일콘텐츠타입", example = "image/jpeg", description = "서버에서 처리")
|
||||||
|
@Column(name = "content_type", nullable = false, length = 200)
|
||||||
|
private String contentType;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일확장자", example = "jpg", description = "서버에서 처리")
|
||||||
|
@Column(name = "file_ext", nullable = false, length = 50)
|
||||||
|
private String fileExt;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일용량", example = " ", description = "서버에서 처리")
|
||||||
|
@Column(name = "file_size", nullable = false)
|
||||||
|
private Long fileSize;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일경로", example = " ", description = "서버에서 처리")
|
||||||
|
@Column(name = "file_upld_path", nullable = false, length = 100)
|
||||||
|
private String fileUpldPath;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
@JsonIgnore
|
||||||
|
@ManyToOne
|
||||||
|
private CmmFileMst cmmFileMst;
|
||||||
|
|
||||||
|
public void setCmmFileMst(CmmFileMst cmmFileMst){
|
||||||
|
this.cmmFileMst = cmmFileMst;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmFileDtl that = (CmmFileDtl) o;
|
||||||
|
|
||||||
|
if (!Objects.equals(fileMstId, that.fileMstId)) return false;
|
||||||
|
return Objects.equals(fileId, that.fileId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
int result = Objects.hashCode(fileMstId);
|
||||||
|
result = 31 * result + (Objects.hashCode(fileId));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Schema(name = "CmmFileMst", description = "파일 마스터") //, parent = AuditEntity.class)
|
||||||
|
@Table(
|
||||||
|
name = "tb_cmm_file_mst",
|
||||||
|
indexes = {
|
||||||
|
@Index(unique = true, name = "idx_tb_file_mst_01", columnList ="file_ctg_cd, file_biz_id")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmFileMst extends AuditEntity implements Serializable {
|
||||||
|
private static final long serialVersionUID = 5741919760452445573L;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일 마스터 ID", example = " ", description = "UUID로 생성")
|
||||||
|
@Id
|
||||||
|
@Setter
|
||||||
|
@Column(name = "file_mst_id", nullable = false, length = 40)
|
||||||
|
private String fileMstId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일분류코드", example = "BOARD", description = "업무별분류코드")
|
||||||
|
@Column(name = "file_ctg_cd", nullable = false, length = 50)
|
||||||
|
private String fileCtgCd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일업무ID", example = "1", description = "각업무테이블PK조합")
|
||||||
|
@Column(name = "file_biz_id", nullable = false, length = 50)
|
||||||
|
private String fileBizId;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
@JsonIgnore
|
||||||
|
@OneToMany(targetEntity = CmmFileDtl.class, mappedBy = "cmmFileMst")
|
||||||
|
@Builder.Default
|
||||||
|
private Set<CmmFileDtl> cmmFileDtls = new HashSet<>();
|
||||||
|
|
||||||
|
public void setCmmFileDtls(CmmFileDtl cmmFileDtl){
|
||||||
|
this.getCmmFileDtls().add(cmmFileDtl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addCmmFileDtls(CmmFileDtl cmmFileDtl){
|
||||||
|
this.getCmmFileDtls().add(cmmFileDtl);
|
||||||
|
cmmFileDtl.setCmmFileMst(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeCmmFileDtls(CmmFileDtl cmmFileDtl){
|
||||||
|
this.getCmmFileDtls().remove(cmmFileDtl);
|
||||||
|
cmmFileDtl.setCmmFileMst(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmFileMst that = (CmmFileMst) o;
|
||||||
|
|
||||||
|
return Objects.equals(fileMstId, that.fileMstId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 761862093;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Schema(name = "CmmMenu", description = "메뉴") //, parent = AuditEntity.class)
|
||||||
|
@Table(name = "tb_cmm_menu")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmMenu extends AuditEntity implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "메뉴ID", example = "C000000000", description = "메뉴ID")
|
||||||
|
@Id
|
||||||
|
@Column(name = "menu_id", nullable = false, length = 10)
|
||||||
|
private String menuId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "상위메뉴ID", example = "ROOT", description = "ROOT - 최상위메뉴는 null")
|
||||||
|
@Column(name = "upr_menu_id", length = 10)
|
||||||
|
private String uprMenuId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "메뉴명", example = "파일관리")
|
||||||
|
@Column(name = "menu_nm", nullable = false, length = 20)
|
||||||
|
private String menuNm;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "메뉴상세", example = "파일관리메뉴")
|
||||||
|
@Column(name = "menu_remark", length = 20)
|
||||||
|
private String menuRemark;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "메뉴URL", example = "/api/biz/cmm/file")
|
||||||
|
@Column(name = "menu_url", length = 200)
|
||||||
|
private String menuUrl;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "노출여부", example = "Y")
|
||||||
|
@Column(name = "expo_yn", nullable = false, length = 1) //, columnDefinition = "char(1)")
|
||||||
|
@ColumnDefault(value = "'Y'")
|
||||||
|
@Builder.Default
|
||||||
|
private String expoYn = "Y";
|
||||||
|
|
||||||
|
@Schema(required = true, title = "메뉴정렬순서", example = "99")
|
||||||
|
@Column(name = "menuOrdr", nullable = false, length = 3) //columnDefinition = "int(3)")
|
||||||
|
@ColumnDefault(value = "99")
|
||||||
|
private Integer menuOrdr;
|
||||||
|
|
||||||
|
@Schema(hidden = true)
|
||||||
|
@Transient
|
||||||
|
@JsonIgnore
|
||||||
|
@OneToMany(targetEntity = CmmRoleMenu.class, mappedBy = "cmmMenuGrp")
|
||||||
|
@Builder.Default
|
||||||
|
private Set<CmmRole> cmmRoles = new HashSet<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmMenu cmmMenu = (CmmMenu) o;
|
||||||
|
|
||||||
|
return Objects.equals(menuId, cmmMenu.menuId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 1856257695;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
, BTN_GRP_ID
|
||||||
|
, BTN_GRP_NM
|
||||||
|
, BTN_CSS_NM
|
||||||
|
, EVNT_NM
|
||||||
|
, DEL_YN
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@Schema(name = "CmmRole", description = "권한")
|
||||||
|
@Table(name = "tb_cmm_role")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmRole extends AuditEntity implements Serializable {
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "권한ID", example = "ADMIN_01")
|
||||||
|
@Id
|
||||||
|
@Column(name = "role_id", length = 10, nullable = false)
|
||||||
|
private String roleId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "권한 이름", example = "ROLE_ADMIN")
|
||||||
|
@Column(name = "role_name", length = 20, nullable = false)
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
|
@Schema(name = "권한 설명", example = "관리자")
|
||||||
|
@Column(name = "role_remark", length = 100, nullable = true)
|
||||||
|
private String roleRemark;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
@JsonIgnore
|
||||||
|
@OneToMany(targetEntity = CmmUser.class, mappedBy = "cmmUserMst")
|
||||||
|
private final Set<CmmUser> cmmUsers = new HashSet<>();
|
||||||
|
|
||||||
|
public void setCmmUsers(CmmUser cmmUser){
|
||||||
|
this.getCmmUsers().add(cmmUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmRole cmmRole = (CmmRole) o;
|
||||||
|
|
||||||
|
return Objects.equals(roleId, cmmRole.roleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 904897982;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,77 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmRoleMenu", description = "권한별메뉴")
|
||||||
|
@Table(name = "tb_cmm_role_menu")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmRoleMenu extends AuditEntity implements Serializable {
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
// @Schema(required = true, title = "메뉴그룹ID", example = "G_MENU_1", description = "메뉴그룹ID")
|
||||||
|
// @Id
|
||||||
|
// @Column(name = "menu_grp_id", nullable = false, length = 10)
|
||||||
|
// private String menuGrpId;
|
||||||
|
//
|
||||||
|
// @Schema(required = true, title = "메뉴ID", example = "C000000000", description = "메뉴ID")
|
||||||
|
// @Id
|
||||||
|
// @Column(name = "menu_id", nullable = false, length = 10)
|
||||||
|
// private String menuId;
|
||||||
|
|
||||||
|
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "권한ID", example = "ADMIN_01")
|
||||||
|
@Column(name = "role_id", nullable = false, length = 10)
|
||||||
|
private String roleId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "메뉴ID", example = "C000000000")
|
||||||
|
@Column(name = "menu_id", nullable = false, length = 10)
|
||||||
|
private String menuId;
|
||||||
|
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "role_id", insertable = false, updatable = false)
|
||||||
|
private CmmRole cmmRole;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "menu_id", insertable = false, updatable = false)
|
||||||
|
private CmmMenu cmmMenu;
|
||||||
|
|
||||||
|
// @Schema(hidden = true)
|
||||||
|
// //@Transient
|
||||||
|
// @ManyToOne(targetEntity = CmmRole.class, fetch = FetchType.LAZY)
|
||||||
|
// @JoinColumn(name="role_id", insertable = false, updatable = false)
|
||||||
|
// private CmmRole cmmRole;
|
||||||
|
//
|
||||||
|
// @Schema(hidden = true)
|
||||||
|
// //@Transient
|
||||||
|
// @ManyToOne(targetEntity = CmmMenu.class, fetch = FetchType.LAZY)
|
||||||
|
// @JoinColumn(name = "menu_id", insertable = false, updatable = false)
|
||||||
|
// private CmmMenu cmmMenu;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmRoleMenu that = (CmmRoleMenu) o;
|
||||||
|
|
||||||
|
return Objects.equals(id, that.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 1632561512;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmRoleUer", description = "권한별사용자")
|
||||||
|
@Table(name = "tb_cmm_role_user")
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmRoleUer implements Serializable {
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "권한ID", example = "ADMIN_01")
|
||||||
|
@Column(name = "role_id", nullable = false, length = 10)
|
||||||
|
private String roleId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "시스템사용자ID", example = "W000000001")
|
||||||
|
@Column(name = "cmm_user_id", nullable = false, length = 10)
|
||||||
|
private String cmmUserId;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "role_id", insertable = false, updatable = false)
|
||||||
|
private CmmRole cmmRole;
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "cmm_user_id", insertable = false, updatable = false)
|
||||||
|
private CmmUser cmmUser;
|
||||||
|
|
||||||
|
// @Schema(hidden = true)
|
||||||
|
// //@Transient
|
||||||
|
// @ManyToOne(targetEntity = CmmRole.class, fetch = FetchType.LAZY)
|
||||||
|
// @JoinColumn(name="role_id", insertable = false, updatable = false)
|
||||||
|
// private CmmRole cmmRole;
|
||||||
|
//
|
||||||
|
// @Schema(hidden = true)
|
||||||
|
// //@Transient
|
||||||
|
// @ManyToOne(targetEntity = CmmUser.class, fetch = FetchType.LAZY)
|
||||||
|
// @JoinColumn(name="cmm_user_id", insertable = false, updatable = false)
|
||||||
|
// private CmmUser cmmUser;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmRoleUer that = (CmmRoleUer) o;
|
||||||
|
|
||||||
|
return Objects.equals(id, that.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 2024097714;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,181 @@
|
|||||||
|
package com.xit.biz.cmm.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.xit.core.oauth2.oauth.entity.ProviderType;
|
||||||
|
import com.xit.core.oauth2.oauth.entity.RoleType;
|
||||||
|
import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.Hibernate;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Schema(name = "CmmUserMst", description = "사용자 마스터") //, parent = AuditEntity.class)
|
||||||
|
@Table(
|
||||||
|
name = "tb_cmm_user_mst",
|
||||||
|
indexes = {
|
||||||
|
@Index(unique = true, name = "idx_tb_cmm_user_mst_01", columnList ="user_id")
|
||||||
|
//@Index(name = "idx_tb_cmm_user_mst_02", columnList ="user_id,user_name,user_email")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class CmmUser extends AuditEntity implements Serializable { //extends RepresentationModel<CmmUserEntity> implements Serializable {
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
|
||||||
|
@Schema(required = true, title = "사용자ID(PK)", example = "W000000001")
|
||||||
|
@Id
|
||||||
|
@Column(name = "cmm_user_id", length = 64)
|
||||||
|
private String cmmUserId;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Schema(required = true, title = "사용자ID(실제ID)", example = "minuk926", description = "논리적인 실제 PK(unique)")
|
||||||
|
@Column(name = "user_id", length = 64, nullable = false, unique = true)
|
||||||
|
//@NotNull
|
||||||
|
//@Size(max = 64)
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Schema(required = true, title = "사용자 이름", example = "홍길동")
|
||||||
|
@Column(name="user_name", length = 100, nullable = false)
|
||||||
|
//@NotNull
|
||||||
|
//@Size(max = 100)
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
//TODO : ???
|
||||||
|
@Setter
|
||||||
|
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||||
|
@Schema(required = true, title = "사용자 비밀번호", example = "minuk926")
|
||||||
|
@Column(name="password", length = 128, nullable = false)
|
||||||
|
//@NotNull
|
||||||
|
//@Size(max = 128)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Schema(title = "전화번호", example = "01012341234")
|
||||||
|
@Column(name="user_mbl", length = 100)
|
||||||
|
//@Size(max = 128)
|
||||||
|
private String userMbl;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Schema(title = "사용자 이메일", example = "a@b.com")
|
||||||
|
@Column(name="email", length = 100, nullable = false)
|
||||||
|
//@Size(max = 100)
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Column(name = "role_type", length = 20, nullable = false)
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
//@NotNull
|
||||||
|
private RoleType roleType;
|
||||||
|
|
||||||
|
/////////////////////////// Social login 관련 ////////////////////////////////////
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Column(name = "provider_type", length = 50, nullable = false)
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
//@NotNull
|
||||||
|
private ProviderType providerType;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Schema(title = "프로필이미지URL", example = " ", description = "SNS로 로그인시 필수")
|
||||||
|
@Column(name = "profile_image_url", length = 256)
|
||||||
|
//@NotNull
|
||||||
|
//@Size(max = 256)
|
||||||
|
private String profileImageUrl;
|
||||||
|
|
||||||
|
@Builder.Default
|
||||||
|
@Setter
|
||||||
|
@Column(name = "email_verified_yn", length = 1, nullable = false)
|
||||||
|
//@NotNull
|
||||||
|
//@Size(min = 1, max = 1)
|
||||||
|
private String emailVerifiedYn = "N";
|
||||||
|
|
||||||
|
public CmmUser(
|
||||||
|
@NotNull @Size(max = 64) String userId,
|
||||||
|
@NotNull @Size(max = 100) String userName,
|
||||||
|
@NotNull @Size(max = 100) String email,
|
||||||
|
@NotNull @Size(max = 1) String emailVerifiedYn,
|
||||||
|
@NotNull @Size(max = 256) String profileImageUrl,
|
||||||
|
@NotNull ProviderType providerType,
|
||||||
|
@NotNull RoleType roleType
|
||||||
|
) {
|
||||||
|
this.userId = userId;
|
||||||
|
this.userName = userName;
|
||||||
|
this.password = "NO_PASS";
|
||||||
|
this.email = email != null ? email : "NO_EMAIL";
|
||||||
|
this.emailVerifiedYn = emailVerifiedYn;
|
||||||
|
this.profileImageUrl = profileImageUrl != null ? profileImageUrl : "";
|
||||||
|
this.providerType = providerType;
|
||||||
|
this.roleType = roleType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ManyToMany(fetch = FetchType.LAZY)
|
||||||
|
// @JoinTable(
|
||||||
|
// name = "tb_cmm_role_user",
|
||||||
|
// joinColumns = {@JoinColumn(name="cmm_user_id", referencedColumnName = "cmm_user_id")},
|
||||||
|
// inverseJoinColumns = {@JoinColumn(name="role_id", referencedColumnName = "role_id")}
|
||||||
|
// )
|
||||||
|
// private Set<CmmRole> cmmRoles;
|
||||||
|
|
||||||
|
//
|
||||||
|
// @Schema(hidden = true)
|
||||||
|
// @Transient
|
||||||
|
// //@JsonIgnore
|
||||||
|
// @OneToMany(targetEntity = CmmAddress.class, mappedBy = "cmmUserMst")
|
||||||
|
// private final Set<CmmAddress> cmmAddresses = new HashSet<>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// public void setCmmRoles(CmmRole cmmRole){
|
||||||
|
// this.getCmmRoles().add(cmmRole);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setCmmAddresses(CmmAddress cmmAddress){
|
||||||
|
// this.getCmmAddresses().add(cmmAddress);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void addCmmAddress(CmmAddress cmmAddress){
|
||||||
|
// this.getCmmAddresses().add(cmmAddress);
|
||||||
|
// cmmAddress.setCmmUser(this);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void removeCmmAddress(CmmAddress cmmAddress){
|
||||||
|
// this.getCmmAddresses().remove(cmmAddress);
|
||||||
|
// cmmAddress.setCmmUser(this);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void addRoleGrps(CmmRole cmmRole){
|
||||||
|
// this.getCmmRoles().add(cmmRole);
|
||||||
|
// cmmRole.setCmmUsers(this);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// public void removeRoleGrps(CmmRole cmmRole){
|
||||||
|
// this.getCmmRoles().remove(cmmRole);
|
||||||
|
// cmmRole.setCmmUsers(this);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
||||||
|
CmmUser cmmUser = (CmmUser) o;
|
||||||
|
|
||||||
|
return Objects.equals(cmmUserId, cmmUser.cmmUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return 880966850;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.xit.biz.cmm.entity.ids;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//@Embeddable
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CmmAddressIds implements Serializable {
|
||||||
|
private String cmmUserId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "주소일련번호", example = "001", description = "사용자별 일련번호")
|
||||||
|
@Column(name = "addr_seq", nullable = false, length = 3)
|
||||||
|
private String addrSeq;
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.xit.biz.cmm.entity.ids;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CmmCodeLIds implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드그룹ID", example = "CODE_SAM", description = "공통코드그룹ID")
|
||||||
|
@Column(name = "code_grp_id", nullable = false, length = 20)
|
||||||
|
private String codeGrpId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "공통코드 코드", example = "00001", description = "공통코드의 코드값")
|
||||||
|
@Column(name = "code_cd", nullable = false, length = 10)
|
||||||
|
private String codeCd;
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.xit.biz.cmm.entity.ids;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CmmCodeMIds implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드그룹ID", example = "CODE_SAM", description = "공통코드그룹ID")
|
||||||
|
@Column(name = "code_grp_id", nullable = false, length = 20)
|
||||||
|
private String codeGrpId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "대분류코드", example = "00001", description = "대분류 코드값")
|
||||||
|
@Column(name = "code_lcd", nullable = false, length = 10)
|
||||||
|
private String codeLcd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "공통코드 코드", example = "001", description = "공통코드의 코드값")
|
||||||
|
@Column(name = "code_cd", nullable = false, length = 10)
|
||||||
|
private String codeCd;
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.xit.biz.cmm.entity.ids;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Schema(name = "CmmCodeSIds", description = "소분류코드 PK(ClassIds) && 콤보코드 조회시 파라메터(searchKeyDto)로 사용")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CmmCodeSIds implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "코드그룹ID", example = "G_CODE_SAM", description = "공통코드그룹ID")
|
||||||
|
@Column(name = "code_grp_id", nullable = false, length = 20)
|
||||||
|
private String codeGrpId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "대분류코드", example = "L0001", description = "대분류 코드값")
|
||||||
|
@Column(name = "code_lcd", nullable = false, length = 10)
|
||||||
|
private String codeLcd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "중분류코드", example = "M0001", description = "중분류 코드값")
|
||||||
|
@Column(name = "code_mcd", nullable = false, length = 10)
|
||||||
|
private String codeMcd;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "공통코드 코드", example = "001", description = "공통코드의 코드값")
|
||||||
|
@Column(name = "code_cd", nullable = false, length = 10)
|
||||||
|
private String codeCd;
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.xit.biz.cmm.entity.ids;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
//@Embeddable
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@EqualsAndHashCode
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CmmFileDtlIds implements Serializable {
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일MstID", example = " ", description = "FileMst ID")
|
||||||
|
@Column(name = "file_mst_id", nullable = false)
|
||||||
|
private String fileMstId;
|
||||||
|
|
||||||
|
@Schema(required = true, title = "파일ID", example = " ", description = "UUID로 생성")
|
||||||
|
@Column(name = "file_id", nullable = false, length = 50)
|
||||||
|
private String fileId;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.xit.biz.cmm.entity.ids;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class CmmUserRolePK implements Serializable {
|
||||||
|
private static final long SerialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long cmmUserId;
|
||||||
|
|
||||||
|
private Long roleId;
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
//package com.xit.biz.cmm.domain.ids;
|
||||||
|
//
|
||||||
|
//import com.xit.core.support.jpa.AuditEntity;
|
||||||
|
//import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
//import lombok.*;
|
||||||
|
//import org.hibernate.annotations.ColumnDefault;
|
||||||
|
//
|
||||||
|
//import javax.persistence.*;
|
||||||
|
//import java.io.Serializable;
|
||||||
|
//
|
||||||
|
//@Embeddable
|
||||||
|
//@Getter
|
||||||
|
//@Setter
|
||||||
|
//@NoArgsConstructor
|
||||||
|
//@EqualsAndHashCode(callSuper = false)
|
||||||
|
//public class CodeCmmField implements Serializable {
|
||||||
|
//
|
||||||
|
// @Schema(required = true, title = "코드명", example = "코드예제", description = "각 분류에 해당하는 코드명")
|
||||||
|
// @Column(name = "code_nm", nullable = false, length = 20)
|
||||||
|
// private String codeNm;
|
||||||
|
//
|
||||||
|
// @Schema(title = "코드상세", example = "공통 코드 상세 예제", description = "각 분류에 해당하는 코드 상세")
|
||||||
|
// @Column(name = "code_remark", length = 50)
|
||||||
|
// private String codeRemark;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드1")
|
||||||
|
// @Column(name = "code_meta_1", length = 10)
|
||||||
|
// private String codeMeta1;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드2")
|
||||||
|
// @Column(name = "code_meta_2", length = 10)
|
||||||
|
// private String codeMeta2;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드3")
|
||||||
|
// @Column(name = "code_meta_3", length = 10)
|
||||||
|
// private String codeMeta3;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드4")
|
||||||
|
// @Column(name = "code_meta_4", length = 10)
|
||||||
|
// private String codeMeta4;
|
||||||
|
//
|
||||||
|
// @Schema(title = "추가필드5")
|
||||||
|
// @Column(name = "code_meta_5", length = 10)
|
||||||
|
// private String codeMeta5;
|
||||||
|
//
|
||||||
|
// @Schema(required = true, title = "코드정렬순서", example = "99")
|
||||||
|
// @Column(name = "code_ordr", nullable = false, columnDefinition = "int(3)") @ColumnDefault(value = "99")
|
||||||
|
// private Integer codeOrdr;
|
||||||
|
//
|
||||||
|
//}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.xit.biz.cmm.entity.spec;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lim, Jong Uk (minuk926)
|
||||||
|
* @since 2021-08-10
|
||||||
|
*/
|
||||||
|
public class CmmCodeSpecification {
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeGrpId(String codeGrpId){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeGrpId"), codeGrpId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeLcd(String codeLcd){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeLcd"), codeLcd);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeMcd(String codeMcd){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeMcd"), codeMcd);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeCd(String codeCd){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeCd"), codeCd);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeNm(String codeNm){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeNm"), codeNm);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> likeCodeRemark(String codeRemark){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.like(root.get("codeRemark"), codeRemark + "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeMeta1(String codeMeta1){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeMeta1"), codeMeta1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeMeta2(String codeMeta2){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeMeta2"), codeMeta2);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeMeta3(String codeMeta3){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeMeta3"), codeMeta3);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeMeta4(String codeMeta4){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeMeta4"), codeMeta4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqCodeMeta5(String codeMeta5){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("codeMeta5"), codeMeta5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> eqUseYn(String useYn){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.equal(root.get("useYn"), useYn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Specification<CmmCodeDto> betweenCreatedBy(LocalDateTime startDatetime, LocalDateTime endDatetime){
|
||||||
|
return (root, query, criteriaBuilder) -> criteriaBuilder.between(root.get("createdBy"), startDatetime, endDatetime);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.xit.biz.cmm.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface ICmmBoardMapper {
|
||||||
|
List<Map<String, Object>> selectBoardList(Map<String, Object> map);
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmAddress;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmAddressIds;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
public interface ICmmAddressRepository extends CrudRepository<CmmAddress, CmmAddressIds> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmBoard;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface ICmmBoardRepository extends JpaRepository<CmmBoard, Long> {
|
||||||
|
// Page<CmmBoard> findByBoardIdGreaterThan(final Long boardId, final Pageable paging);
|
||||||
|
// Optional<CmmBoard> findByBoardId(final Long boardId);
|
||||||
|
// void deleteByBoardId(Long boardId);
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeGrp;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
||||||
|
public interface ICmmCodeGrpRepository extends JpaRepository<CmmCodeGrp, String>, JpaSpecificationExecutor<CmmCodeDto> {
|
||||||
|
CmmCodeGrp findByCodeGrpId(String codeGrpId);
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeL;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeLIds;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.biz.cmm.dto.ComboCodeDto;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ICmmCodeLRepostory extends JpaRepository<CmmCodeL, CmmCodeLIds>, JpaSpecificationExecutor<CmmCodeDto> {
|
||||||
|
@Query(value = "select c.codeCd as code, c.codeNm as value from #{#entityName} c where c.codeGrpId = :codeGrpId and c.useYn = 'Y' order by c.codeOrdr asc")
|
||||||
|
List<ComboCodeDto> queryComboCode(@Param("codeGrpId") String codeGrpId);
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeM;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeMIds;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.biz.cmm.dto.ComboCodeDto;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ICmmCodeMRepository extends JpaRepository<CmmCodeM, CmmCodeMIds>, JpaSpecificationExecutor<CmmCodeDto> {
|
||||||
|
@Query(value = "select c.codeCd as code, c.codeNm as value from #{#entityName} c where c.codeGrpId = :codeGrpId and c.codeLcd = :codeLcd and c.useYn = 'Y' order by c.codeOrdr asc")
|
||||||
|
List<ComboCodeDto> queryComboCode(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd);
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeS;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeSIds;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.biz.cmm.dto.ComboCodeDto;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ICmmCodeSRepository extends JpaRepository<CmmCodeS, CmmCodeSIds>, JpaSpecificationExecutor<CmmCodeDto> {
|
||||||
|
@Query(value = "select c.codeCd as code, c.codeNm as value from #{#entityName} c where c.codeGrpId = :codeGrpId and c.codeLcd = :codeLcd and c.codeMcd = :codeMcd and c.useYn = 'Y' order by c.codeOrdr asc")
|
||||||
|
List<ComboCodeDto> queryComboCode(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd, @Param("codeMcd")String codeMcd);
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmFileDtl;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmFileDtlIds;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ICmmFileDtlRepository extends CrudRepository<CmmFileDtl, CmmFileDtlIds> {
|
||||||
|
List<CmmFileDtl> findByFileMstId(String fileMstId);
|
||||||
|
CmmFileDtl findByFileMstIdAndOrgFileNmIgnoreCase(String fileMstId, String OrgFileNm);
|
||||||
|
//List<CmmFileDtl> findAllById(CmmFileDtlIds cmmFileDtlIds);
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmFileMst;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
public interface ICmmFileMstRepository extends CrudRepository<CmmFileMst, String> {
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRoleMenu;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
public interface ICmmRoleMenuRepository extends JpaRepository<CmmRoleMenu, Long> {
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRole;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
public interface ICmmRoleRepository extends CrudRepository<CmmRole, String> {
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRoleUer;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
public interface ICmmRoleUserRepository extends CrudRepository<CmmRoleUer, Long> {
|
||||||
|
// List<CmmRole> findByCmmUserId(Long cmmUserId);
|
||||||
|
//
|
||||||
|
// List<CmmUser> findByRoleId(Long roleId);
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package com.xit.biz.cmm.repository;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmUser;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface ICmmUserRepository extends JpaRepository<CmmUser, String> {
|
||||||
|
CmmUser findByCmmUserId(@NotNull final String cmmUserId);
|
||||||
|
Optional<CmmUser> findByUserId(@NotNull final String userId);
|
||||||
|
boolean existsByUserId(@NotNull final String userId);
|
||||||
|
|
||||||
|
//Optional<CmmUser> findOneWithAuthorities(String userId);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.xit.biz.cmm.service;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmAddress;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmAddressIds;
|
||||||
|
import com.xit.core.support.jpa.IJpaOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lim, Jong Uk (minuk926)
|
||||||
|
* @since 2021-07-16
|
||||||
|
*/
|
||||||
|
public interface ICmmAddressService extends IJpaOperation<CmmAddress, CmmAddressIds> {
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.xit.biz.cmm.service;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmBoard;
|
||||||
|
import com.xit.core.support.jpa.IJpaOperation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public interface ICmmBoardService extends IJpaOperation<CmmBoard, Long> {
|
||||||
|
/**
|
||||||
|
* use mybatis mapper
|
||||||
|
* @param map Map
|
||||||
|
* @return List
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> selectBoardList(Map<String, Object> map);
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.xit.biz.cmm.service;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeGrp;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeSIds;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.biz.cmm.dto.ComboCodeDto;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lim, Jong Uk (minuk926)
|
||||||
|
* @since 2021-08-02
|
||||||
|
*/
|
||||||
|
public interface ICmmCodeService {
|
||||||
|
List<ComboCodeDto> findComboCodes(CmmCodeSIds searchKeyDto);
|
||||||
|
|
||||||
|
CmmCodeGrp saveCmmCodeGrp(CmmCodeGrp cmmCodeGrp);
|
||||||
|
// CmmCodeL saveCmmCodeL(CmmCodeL cmmCodeL);
|
||||||
|
// CmmCodeM saveCmmCodeM(CmmCodeM cmmCodeM);
|
||||||
|
// CmmCodeS saveCmmCodeS(CmmCodeS cmmCodeS);
|
||||||
|
|
||||||
|
Page<CmmCodeGrp> findCmmCodeGrps(CmmCodeDto cmmCodeDto, Pageable pageable);
|
||||||
|
|
||||||
|
List<?> findCmmCodes(CmmCodeDto cmmCodeDto);
|
||||||
|
|
||||||
|
Object saveCmmCode(CmmCodeDto cmmCodeDto);
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.xit.biz.cmm.service;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmFileMst;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lim, Jong Uk (minuk926)
|
||||||
|
* @since 2021-07-16
|
||||||
|
*/
|
||||||
|
public interface ICmmFileService {
|
||||||
|
CmmFileMst findFiles(String fileMstId);
|
||||||
|
|
||||||
|
CmmFileMst saveFiles(CmmFileMst cmmFileMst, MultipartFile[] files);
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.xit.biz.cmm.service;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRoleMenu;
|
||||||
|
import com.xit.core.support.jpa.IJpaOperation;
|
||||||
|
|
||||||
|
public interface ICmmRoleMenuService extends IJpaOperation<CmmRoleMenu, Long> {
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.xit.biz.cmm.service;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRole;
|
||||||
|
import com.xit.core.support.jpa.IJpaOperation;
|
||||||
|
|
||||||
|
public interface ICmmRoleService extends IJpaOperation<CmmRole, String> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.xit.biz.cmm.service;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRoleUer;
|
||||||
|
import com.xit.core.support.jpa.IJpaOperation;
|
||||||
|
|
||||||
|
public interface ICmmRoleUserService extends IJpaOperation<CmmRoleUer, Long> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.xit.biz.cmm.service;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmUser;
|
||||||
|
import com.xit.biz.cmm.dto.CmmUserDto;
|
||||||
|
import com.xit.core.support.jpa.IJpaOperation;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
//public interface ICmmUserService {
|
||||||
|
public interface ICmmUserService extends IJpaOperation<CmmUser, String> {
|
||||||
|
Page<CmmUser> findCmmUsers(CmmUser cmmUser, Pageable pageable);
|
||||||
|
Iterable<CmmUser> findCmmUsers2(CmmUser cmmUser);
|
||||||
|
CmmUser findByCmmUserId(final String cmmUserId);
|
||||||
|
void deleteByCmmUserId(String cmmUserId);
|
||||||
|
|
||||||
|
Optional<CmmUser> findByUserId(String userId);
|
||||||
|
//
|
||||||
|
// CmmUserEntity save(CmmUserEntity cmmUserEntity);
|
||||||
|
//
|
||||||
|
// List<CmmUserEntity> findAll();
|
||||||
|
// Page<CmmUserEntity> findAll(Pageable pageable);
|
||||||
|
//
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.xit.biz.cmm.service.impl;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmAddress;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmAddressIds;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmAddressRepository;
|
||||||
|
import com.xit.biz.cmm.service.ICmmAddressService;
|
||||||
|
import com.xit.core.support.jpa.AbstractJpaCrudService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Lim, Jong Uk (minuk926)
|
||||||
|
* @since 2021-07-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class CmmAddressService extends AbstractJpaCrudService<CmmAddress, CmmAddressIds> implements ICmmAddressService {
|
||||||
|
|
||||||
|
private final ICmmAddressRepository cmmAddressRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CrudRepository<CmmAddress, CmmAddressIds> getRepository() {
|
||||||
|
return cmmAddressRepository;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.xit.biz.cmm.service.impl;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmBoard;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmBoardRepository;
|
||||||
|
import com.xit.biz.cmm.service.ICmmBoardService;
|
||||||
|
import com.xit.biz.cmm.mapper.ICmmBoardMapper;
|
||||||
|
import com.xit.core.support.jpa.AbstractJpaService;
|
||||||
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CmmBoardService extends AbstractJpaService<CmmBoard, Long> implements ICmmBoardService {
|
||||||
|
private final ICmmBoardRepository boardRepository;
|
||||||
|
private final ICmmBoardMapper cmmBoardMapper;
|
||||||
|
|
||||||
|
public CmmBoardService(ICmmBoardRepository boardRepository, ICmmBoardMapper cmmBoardMapper) {
|
||||||
|
this.boardRepository = boardRepository;
|
||||||
|
this.cmmBoardMapper = cmmBoardMapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PagingAndSortingRepository<CmmBoard, Long> getRepository() {
|
||||||
|
return boardRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public Optional<CmmBoard> findByBoardId(Long boardId) {
|
||||||
|
return boardRepository.findById(boardId); //.orElseThrow(() -> new NotFoundException("Board not found : " + boardId));
|
||||||
|
}
|
||||||
|
@Transactional
|
||||||
|
public void deleteByBoardId(Long boardId) {
|
||||||
|
boardRepository.deleteById(boardId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectBoardList(Map<String, Object> map) {
|
||||||
|
return cmmBoardMapper.selectBoardList(map);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,168 @@
|
|||||||
|
package com.xit.biz.cmm.service.impl;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.dto.struct.CmmCodeGrpMapstruct;
|
||||||
|
import com.xit.biz.cmm.dto.struct.CmmCodeLMapstruct;
|
||||||
|
import com.xit.biz.cmm.dto.struct.CmmCodeMMapstruct;
|
||||||
|
import com.xit.biz.cmm.dto.struct.CmmCodeSMapstruct;
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeGrp;
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeL;
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeM;
|
||||||
|
import com.xit.biz.cmm.entity.CmmCodeS;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmCodeSIds;
|
||||||
|
import com.xit.biz.cmm.dto.CmmCodeDto;
|
||||||
|
import com.xit.biz.cmm.dto.ComboCodeDto;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmCodeGrpRepository;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmCodeLRepostory;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmCodeMRepository;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmCodeSRepository;
|
||||||
|
import com.xit.biz.cmm.service.ICmmCodeService;
|
||||||
|
import com.xit.core.util.AssertUtils;
|
||||||
|
import com.xit.core.util.Checks;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
import org.springframework.data.domain.*;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CmmCodeService implements ICmmCodeService {
|
||||||
|
|
||||||
|
private final ICmmCodeGrpRepository cmmCodeGrpRepository;
|
||||||
|
private final ICmmCodeLRepostory cmmCodeLRepository;
|
||||||
|
private final ICmmCodeMRepository cmmCodeMRepository;
|
||||||
|
private final ICmmCodeSRepository cmmCodeSRepository;
|
||||||
|
|
||||||
|
private CmmCodeGrpMapstruct codeGrpstruct = Mappers.getMapper(CmmCodeGrpMapstruct.class);
|
||||||
|
private CmmCodeLMapstruct codeLstruct = Mappers.getMapper(CmmCodeLMapstruct.class);
|
||||||
|
private CmmCodeMMapstruct codeMstruct = Mappers.getMapper(CmmCodeMMapstruct.class);
|
||||||
|
private CmmCodeSMapstruct codeSstruct = Mappers.getMapper(CmmCodeSMapstruct.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ComboCodeDto> findComboCodes(CmmCodeSIds searchKeyDto) {
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(searchKeyDto.getCodeGrpId()), "조회할 코드그룹을 선택해 주세요.");
|
||||||
|
|
||||||
|
// 소분류 코드 조회
|
||||||
|
if(StringUtils.hasText(searchKeyDto.getCodeMcd())){
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(searchKeyDto.getCodeLcd()), "대분류 코드가 선택되지 않았습니다.");
|
||||||
|
return cmmCodeSRepository.queryComboCode(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd(), searchKeyDto.getCodeMcd());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 중분류 코드 조회
|
||||||
|
if(StringUtils.hasText(searchKeyDto.getCodeLcd())){
|
||||||
|
return cmmCodeMRepository.queryComboCode(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 대분류 코드 조회
|
||||||
|
return cmmCodeLRepository.queryComboCode(searchKeyDto.getCodeGrpId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<CmmCodeGrp> findCmmCodeGrps(CmmCodeDto cmmCodeDto, Pageable pageable) {
|
||||||
|
Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
|
||||||
|
pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), sort);
|
||||||
|
Example<CmmCodeGrp> example = Example.of(codeGrpstruct.toEntity(cmmCodeDto), ExampleMatcher.matchingAny());
|
||||||
|
return cmmCodeGrpRepository.findAll(example, pageable);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<?> findCmmCodes(CmmCodeDto cmmCodeDto) {
|
||||||
|
Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeGrpId()), "조회할 코드그룹을 선택해 주세요.");
|
||||||
|
|
||||||
|
// 소분류 코드 조회
|
||||||
|
if(StringUtils.hasText(cmmCodeDto.getCodeMcd())){
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeLcd()), "대분류 코드가 선택되지 않았습니다.");
|
||||||
|
Example<CmmCodeS> example = Example.of(codeSstruct.toEntity(cmmCodeDto), ExampleMatcher.matchingAny());
|
||||||
|
return cmmCodeSRepository.findAll(example, sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 중분류 코드 조회
|
||||||
|
if(StringUtils.hasText(cmmCodeDto.getCodeLcd())){
|
||||||
|
Example<CmmCodeM> example = Example.of(codeMstruct.toEntity(cmmCodeDto), ExampleMatcher.matchingAny());
|
||||||
|
return cmmCodeMRepository.findAll(example, sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 대분류 코드 조회
|
||||||
|
Example<CmmCodeL> example = Example.of(codeLstruct.toEntity(cmmCodeDto), ExampleMatcher.matchingAny());
|
||||||
|
return cmmCodeLRepository.findAll(example, sort);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public CmmCodeGrp saveCmmCodeGrp(CmmCodeGrp cmmCodeGrp) {
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeGrpId()), "코드 그룹을 입력해 주세요.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeNm()), "코드 그룹명 입력해 주세요.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeGrp.getCodeOrdr()), "정렬 순서를 입력해 주세요.");
|
||||||
|
return cmmCodeGrpRepository.save(cmmCodeGrp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public CmmCodeL saveCmmCodeL(CmmCodeL cmmCodeL) {
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeL.getCodeGrpId()), "코드 그룹을 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeL.getCodeCd()), "대분류 코드를 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeL.getCodeNm()), "대분류 코드명 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeL.getCodeOrdr()), "정렬 순서를 입력해 주세요.");
|
||||||
|
// return cmmCodeLRepository.save(cmmCodeL);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public CmmCodeM saveCmmCodeM(CmmCodeM cmmCodeM) {
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeGrpId()), "코드 그룹을 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeLcd()), "대분류 코드를 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeCd()), "중분류 코드를 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeNm()), "중분류 코드명 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeM.getCodeOrdr()), "정렬 순서를 입력해 주세요.");
|
||||||
|
// return cmmCodeMRepository.save(cmmCodeM);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// @Transactional
|
||||||
|
// public CmmCodeS saveCmmCodeS(CmmCodeS cmmCodeS) {
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeGrpId()), "코드그룹을 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeLcd()), "대분류 코드를 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeMcd()), "중분류 코드를 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeCd()), "소분류 코드를 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeNm()), "소분류 코드명 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeOrdr()), "정렬 순서를 입력해 주세요.");
|
||||||
|
// return cmmCodeSRepository.save(cmmCodeS);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private void validate(Class<?> clz){
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeGrpId()), "코드그룹을 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeCd()), "대분류코드를 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeNm()), "대분류코드명 입력해 주세요.");
|
||||||
|
// AssertUtils.state(!Checks.isEmpty(cmmCodeS.getCodeOrdr()), "정렬순서를 입력해 주세요.");
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public Object saveCmmCode(CmmCodeDto cmmCodeDto) {
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeGrpId()), "코드그룹을 입력해 주세요.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeCd()), "코드를 입력해 주세요.");
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeNm()), "코드명을 입력해 주세요.");
|
||||||
|
|
||||||
|
// 소분류 코드
|
||||||
|
if(StringUtils.hasText(cmmCodeDto.getCodeMcd())){
|
||||||
|
AssertUtils.isTrue(!Checks.isEmpty(cmmCodeDto.getCodeLcd()), "대분류 코드를 입력해 주세요.");
|
||||||
|
return cmmCodeSRepository.save(codeSstruct.toEntity(cmmCodeDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 중분류 코드
|
||||||
|
if(StringUtils.hasText(cmmCodeDto.getCodeLcd())){
|
||||||
|
return cmmCodeMRepository.save(codeMstruct.toEntity(cmmCodeDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 대분류 코드
|
||||||
|
return cmmCodeLRepository.save(codeLstruct.toEntity(cmmCodeDto));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,167 @@
|
|||||||
|
package com.xit.biz.cmm.service.impl;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmFileDtl;
|
||||||
|
import com.xit.biz.cmm.entity.CmmFileMst;
|
||||||
|
import com.xit.biz.cmm.entity.ids.CmmFileDtlIds;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmFileDtlRepository;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmFileMstRepository;
|
||||||
|
import com.xit.biz.cmm.service.ICmmFileService;
|
||||||
|
|
||||||
|
import com.xit.core.util.AssertUtils;
|
||||||
|
import com.xit.core.util.DateUtil;
|
||||||
|
import io.jsonwebtoken.lang.Assert;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CmmFileService implements ICmmFileService {
|
||||||
|
|
||||||
|
@Value("${file.cmm.upload.path:/data/file/upload}")
|
||||||
|
private String uploadPath;
|
||||||
|
|
||||||
|
@Value("${file.cmm.upload.allow.ext:}")
|
||||||
|
private String allowExt;
|
||||||
|
|
||||||
|
@Value("${file.cmm.upload.max.size:1024}")
|
||||||
|
private long maxSize;
|
||||||
|
|
||||||
|
private final ICmmFileMstRepository cmmFileMstRepository;
|
||||||
|
private final ICmmFileDtlRepository cmmFileDtlRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CmmFileMst findFiles(String fileMstId) {
|
||||||
|
Assert.notNull(fileMstId, "대상 파일[fileMstId]을 선택해 주세요.");
|
||||||
|
|
||||||
|
CmmFileMst cmmFileMst = cmmFileMstRepository.findById(fileMstId).orElse(null);
|
||||||
|
// CmmFileDtlIds cmmFileDtlIds = new CmmFileDtlIds();
|
||||||
|
// cmmFileDtlIds.setFileMstId(cmmFileMst.getFileMstId());
|
||||||
|
|
||||||
|
if(cmmFileMst != null) cmmFileMst.getCmmFileDtls().addAll(cmmFileDtlRepository.findByFileMstId(cmmFileMst.getFileMstId()));
|
||||||
|
return cmmFileMst;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 파일 등록
|
||||||
|
* 신규등록시는 CmmFileMst.fileMstId가 null, 변경시 not null
|
||||||
|
* 변경시 동일한 파일 이름이 존재하면 DB 및 해당 파일 삭제후 신규로 생성
|
||||||
|
*
|
||||||
|
* @param cmmFileMst CmmFileMst
|
||||||
|
* @param files MultipartFile[]
|
||||||
|
* @return CmmFileMst
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public CmmFileMst saveFiles(CmmFileMst cmmFileMst, MultipartFile[] files) {
|
||||||
|
Assert.notNull(cmmFileMst, "파일 정보가 존재하지 않습니다.");
|
||||||
|
Assert.notNull(cmmFileMst.getFileCtgCd(), "파일 구분 코드[fileCtgCd] 정보가 존재하지 않습니다.");
|
||||||
|
Assert.notNull(cmmFileMst.getFileBizId(), "파일 업무 ID[fileBizId] 정보가 존재하지 않습니다.");
|
||||||
|
Assert.notNull(files, "대상 파일이 존재하지 않습니다.");
|
||||||
|
|
||||||
|
String makePath = "";
|
||||||
|
boolean isCheckExists = StringUtils.hasText(cmmFileMst.getFileMstId());
|
||||||
|
String fileMstId = null;
|
||||||
|
|
||||||
|
// file Master key set
|
||||||
|
// file Master 생성
|
||||||
|
if(isCheckExists) fileMstId = cmmFileMst.getFileMstId();
|
||||||
|
else fileMstId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
|
cmmFileMst.setFileMstId(fileMstId);
|
||||||
|
CmmFileMst savedCmmFileMst = cmmFileMstRepository.save(cmmFileMst);
|
||||||
|
|
||||||
|
makePath = File.separator + DateUtil.getToday("");
|
||||||
|
String fileUploadPath = this.uploadPath + makePath;
|
||||||
|
File file = new File(fileUploadPath);
|
||||||
|
if(!file.exists()) file.mkdirs();
|
||||||
|
|
||||||
|
List<CmmFileDtl> cmmFileDtls = new ArrayList<>();
|
||||||
|
for(MultipartFile mf : files){
|
||||||
|
if(!mf.isEmpty()) {
|
||||||
|
String orgFileName = "";
|
||||||
|
try {
|
||||||
|
orgFileName = StringUtils.cleanPath(Objects.requireNonNull(mf.getOriginalFilename()));
|
||||||
|
CmmFileDtl cmmFileDtl = CmmFileDtl.builder()
|
||||||
|
.fileMstId(savedCmmFileMst.getFileMstId())
|
||||||
|
.fileId(UUID.randomUUID().toString().replaceAll("-", ""))
|
||||||
|
.fileUpldPath(makePath)
|
||||||
|
.contentType(mf.getContentType())
|
||||||
|
.orgFileNm(orgFileName)
|
||||||
|
.fileExt(orgFileName.substring(orgFileName.lastIndexOf(".") + 1).toLowerCase())
|
||||||
|
.fileSize(mf.getSize())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
if (StringUtils.hasText(allowExt) && !allowExt.contains(cmmFileDtl.getFileExt())) {
|
||||||
|
log.error("Not support extention :: {}", orgFileName);
|
||||||
|
//TODO : 에러처리
|
||||||
|
//return RestError.of(String.format("Not support extention :: %s", orgFileName));
|
||||||
|
AssertUtils.isTrue(false, String.format("Not support extention :: %s", orgFileName));
|
||||||
|
}
|
||||||
|
if (cmmFileDtl.getFileSize() > (maxSize * 1024)) {
|
||||||
|
log.error("Over size :: {}[{}]", orgFileName, cmmFileDtl.getFileSize());
|
||||||
|
//TODO : 에러처리
|
||||||
|
//return RestError.of(String.format("Over size :: %s[%l]", orgFileName, cmmFileDtl.getFileSize()));
|
||||||
|
AssertUtils.isTrue(false, String.format("Over size :: %s[%d]", orgFileName, cmmFileDtl.getFileSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//동일파일 삭제후 정보 저장
|
||||||
|
if(isCheckExists) removeExistsUploadFile(fileMstId, orgFileName);
|
||||||
|
CmmFileDtl savedCmmFileDtl = cmmFileDtlRepository.save(cmmFileDtl);
|
||||||
|
|
||||||
|
// 파일 전송
|
||||||
|
mf.transferTo(new File(fileUploadPath + File.separator + savedCmmFileDtl.getFileId()));
|
||||||
|
cmmFileDtls.add(savedCmmFileDtl);
|
||||||
|
|
||||||
|
// inputStream을 가져와서
|
||||||
|
// copyOfLocation (저장위치)로 파일을 쓴다.
|
||||||
|
// copy의 옵션은 기존에 존재하면 REPLACE(대체한다), 오버라이딩 한다
|
||||||
|
//Files.copy(multipartFile.getInputStream(), copyOfLocation, StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
|
||||||
|
}catch(IOException e){
|
||||||
|
String errMsg = String.format("File Upload Error :: %s", orgFileName);
|
||||||
|
//TODO : 에러처리
|
||||||
|
//return RestError.of(String.format("File Upload Error :: %s", orgFileName));
|
||||||
|
AssertUtils.isTrue(false, String.format("File Upload Error :: %s", orgFileName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
savedCmmFileMst.getCmmFileDtls().addAll(cmmFileDtls);
|
||||||
|
return savedCmmFileMst;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void removeExistsUploadFile(String fileMstId, String orgFileNm){
|
||||||
|
CmmFileDtl cmmFileDtl = cmmFileDtlRepository.findByFileMstIdAndOrgFileNmIgnoreCase(fileMstId, orgFileNm);
|
||||||
|
if(cmmFileDtl != null){
|
||||||
|
CmmFileDtlIds cmmFileDtlIds = new CmmFileDtlIds();
|
||||||
|
cmmFileDtlIds.setFileMstId(fileMstId);
|
||||||
|
cmmFileDtlIds.setFileId(cmmFileDtl.getFileId());
|
||||||
|
cmmFileDtlRepository.deleteById(cmmFileDtlIds);
|
||||||
|
new File(this.uploadPath + cmmFileDtl.getFileUpldPath() + File.separator + cmmFileDtl.getFileId()).delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// File.seperator 는 OS종속적이다.
|
||||||
|
// Spring에서 제공하는 cleanPath()를 통해서 ../ 내부 점들에 대해서 사용을 억제한다
|
||||||
|
Path copyOfLocation = Paths.get(uploadDir + File.separator + StringUtils.cleanPath(multipartFile.getOriginalFilename()));
|
||||||
|
try {
|
||||||
|
// inputStream을 가져와서
|
||||||
|
// copyOfLocation (저장위치)로 파일을 쓴다.
|
||||||
|
// copy의 옵션은 기존에 존재하면 REPLACE(대체한다), 오버라이딩 한다
|
||||||
|
Files.copy(multipartFile.getInputStream(), copyOfLocation, StandardCopyOption.REPLACE_EXISTING);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new FileStorageException("Could not store file : " + multipartFile.getOriginalFilename());
|
||||||
|
}
|
||||||
|
*/
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.xit.biz.cmm.service.impl;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRoleMenu;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmRoleMenuRepository;
|
||||||
|
import com.xit.biz.cmm.service.ICmmRoleMenuService;
|
||||||
|
import com.xit.core.support.jpa.AbstractJpaService;
|
||||||
|
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CmmRoleMenuService extends AbstractJpaService<CmmRoleMenu, Long> implements ICmmRoleMenuService {
|
||||||
|
|
||||||
|
private final ICmmRoleMenuRepository cmmRoleMenuRepository;
|
||||||
|
|
||||||
|
public CmmRoleMenuService(ICmmRoleMenuRepository cmmRoleMenuRepository) {
|
||||||
|
this.cmmRoleMenuRepository = cmmRoleMenuRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PagingAndSortingRepository<CmmRoleMenu, Long> getRepository() {
|
||||||
|
return cmmRoleMenuRepository;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.xit.biz.cmm.service.impl;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRole;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmRoleRepository;
|
||||||
|
import com.xit.biz.cmm.service.ICmmRoleService;
|
||||||
|
import com.xit.core.support.jpa.AbstractJpaCrudService;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CmmRoleService extends AbstractJpaCrudService<CmmRole, String> implements ICmmRoleService {
|
||||||
|
private final ICmmRoleRepository cmmRoleRepository;
|
||||||
|
|
||||||
|
public CmmRoleService(ICmmRoleRepository cmmRoleRepository) {
|
||||||
|
this.cmmRoleRepository = cmmRoleRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CrudRepository<CmmRole, String> getRepository() {
|
||||||
|
return cmmRoleRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.xit.biz.cmm.service.impl;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmRoleUer;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmRoleUserRepository;
|
||||||
|
import com.xit.biz.cmm.service.ICmmRoleUserService;
|
||||||
|
import com.xit.core.support.jpa.AbstractJpaCrudService;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CmmRoleUserService extends AbstractJpaCrudService<CmmRoleUer, Long> implements ICmmRoleUserService {
|
||||||
|
private final ICmmRoleUserRepository cmmRoleUserRepository;
|
||||||
|
|
||||||
|
public CmmRoleUserService(ICmmRoleUserRepository cmmRoleUserRepository) {
|
||||||
|
this.cmmRoleUserRepository = cmmRoleUserRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected CrudRepository<CmmRoleUer, Long> getRepository() {
|
||||||
|
return cmmRoleUserRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,121 @@
|
|||||||
|
package com.xit.biz.cmm.service.impl;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.entity.CmmUser;
|
||||||
|
import com.xit.biz.cmm.repository.ICmmUserRepository;
|
||||||
|
import com.xit.biz.cmm.service.ICmmUserService;
|
||||||
|
import com.xit.core.support.jpa.AbstractJpaService;
|
||||||
|
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.data.repository.PagingAndSortingRepository;
|
||||||
|
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 CmmUserService extends AbstractJpaService<CmmUser, String> implements ICmmUserService {
|
||||||
|
|
||||||
|
private final ICmmUserRepository cmmUserRepository;
|
||||||
|
//private CmmUserMapstruct cmmUserMapstruct = Mappers.getMapper(CmmUserMapstruct.class);
|
||||||
|
|
||||||
|
public CmmUserService(ICmmUserRepository cmmUserRepository) {
|
||||||
|
this.cmmUserRepository = cmmUserRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PagingAndSortingRepository<CmmUser, String> getRepository() {
|
||||||
|
return cmmUserRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public Page<CmmUser> findCmmUsers(CmmUser cmmUser, Pageable pageable) {
|
||||||
|
//Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
|
||||||
|
pageable = JpaUtil.getPagingInfo(pageable);
|
||||||
|
ExampleMatcher exampleMatcher = ExampleMatcher.matchingAll()
|
||||||
|
.withMatcher("userId", contains());
|
||||||
|
Example<CmmUser> example = Example.of(cmmUser, exampleMatcher);
|
||||||
|
Page<CmmUser> page = cmmUserRepository.findAll(example, pageable);
|
||||||
|
// List<CmmUser> userList = page.getContent();
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public Iterable<CmmUser> findCmmUsers2(CmmUser cmmUser) {
|
||||||
|
//Sort sort = Sort.by(Sort.Direction.ASC, "codeOrdr");
|
||||||
|
//pageable = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize());
|
||||||
|
Example<CmmUser> example = Example.of(cmmUser, ExampleMatcher.matchingAny());
|
||||||
|
return cmmUserRepository.findAll(example);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public CmmUser findByCmmUserId(final String cmmUserId){
|
||||||
|
return cmmUserRepository.findByCmmUserId(cmmUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public Optional<CmmUser> findById(final String cmmUserId){
|
||||||
|
return cmmUserRepository.findById(cmmUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(readOnly = true)
|
||||||
|
public Optional<CmmUser> findByUserId(final String userId){
|
||||||
|
return cmmUserRepository.findByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void deleteByCmmUserId(final String cmmUserId){
|
||||||
|
cmmUserRepository.deleteById(cmmUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// public CmmUserService(CmmUserRepository repository) {
|
||||||
|
// this.repository = repository;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public List<CmmUserEntity> findAll(){
|
||||||
|
// return repository.findAll();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public Page<CmmUserEntity> findAll(Pageable pageable) {
|
||||||
|
// return repository.findAll(pageable);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public CmmUserEntity findByCmmUserId(Long cmmUserId){
|
||||||
|
// return repository.findByCmmUserId(cmmUserId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public CmmUserEntity findByUserId(String userId){
|
||||||
|
// return repository.findByUserId(userId);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void saves(List<CmmUserEntity> cmmUsers){
|
||||||
|
// cmmUsers.forEach(this::save);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Transactional
|
||||||
|
// public CmmUserEntity save(CmmUserEntity cmmUserEntity){
|
||||||
|
// return repository.save(cmmUserEntity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Transactional
|
||||||
|
// public CmmUserEntity update(CmmUserEntity cmmUserEntity){
|
||||||
|
// return repository.save(cmmUserEntity);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Transactional
|
||||||
|
// public void deleteByCmmUserId(Long cmmUserId){
|
||||||
|
// repository.deleteById(cmmUserId);
|
||||||
|
// }
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.xit.biz.sample;
|
||||||
|
|
||||||
|
public class Greeting {
|
||||||
|
|
||||||
|
private final long id;
|
||||||
|
private final String content;
|
||||||
|
|
||||||
|
public Greeting(long id, String content) {
|
||||||
|
this.id = id;
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.xit.biz.sample.controller;
|
||||||
|
|
||||||
|
import com.xit.biz.cmm.service.ICmmBoardService;
|
||||||
|
import com.xit.biz.sample.Greeting;
|
||||||
|
import com.xit.core.api.IRestResponse;
|
||||||
|
import com.xit.core.api.RestResponse;
|
||||||
|
import com.xit.core.constant.ErrorCode;
|
||||||
|
import com.xit.core.exception.InvalidRequestException;
|
||||||
|
import com.xit.core.util.AssertUtils;
|
||||||
|
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.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
@Tag(name = "RestSampleController", description = "Rest API Sample")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/sample")
|
||||||
|
public class RestSampleController {
|
||||||
|
|
||||||
|
private static final String template = "Hello, %s!";
|
||||||
|
private final AtomicLong counter = new AtomicLong();
|
||||||
|
|
||||||
|
private final ICmmBoardService cmmBoardService;
|
||||||
|
|
||||||
|
@GetMapping("/greeting")
|
||||||
|
public Greeting greeting(@RequestParam(value = "name", required = false, defaultValue = "World") String name) {
|
||||||
|
return new Greeting(counter.incrementAndGet(), String.format(template, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "Mybatis 예제")
|
||||||
|
@Parameters({
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "boardId", description = "게시글Id", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "title", description = "제목", required = false, example = " "),
|
||||||
|
@Parameter(in = ParameterIn.QUERY, name = "content", description = "내용", required = false, example = " ")
|
||||||
|
//@Parameter(in = ParameterIn.QUERY, name = "sort", description = "정렬", required = true, example = "codeOrdr"),
|
||||||
|
})
|
||||||
|
@GetMapping("/mybatis")
|
||||||
|
public List<Map<String,Object>> mybatis(@RequestParam @Parameter(hidden = true) Map<String,Object> paramMap) {
|
||||||
|
return cmmBoardService.selectBoardList(paramMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "에러 예제 - rtnMsg")
|
||||||
|
@GetMapping("/error1")
|
||||||
|
public ResponseEntity<? extends IRestResponse> test1() {
|
||||||
|
AssertUtils.isTrue("조회할 콤보코드 대상이 없습니다.");
|
||||||
|
return RestResponse.of("test1");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
package com.xit.biz.sample.controller;
|
||||||
|
|
||||||
|
import com.xit.core.util.PoiExcelView;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.servlet.View;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/web/sample")
|
||||||
|
public class WebSampleController {
|
||||||
|
|
||||||
|
private static final String template = "Hello, %s!";
|
||||||
|
private final AtomicLong counter = new AtomicLong();
|
||||||
|
|
||||||
|
@GetMapping("/sample-dark")
|
||||||
|
public String sampleDarkMode() {
|
||||||
|
return "thymeleaf/sample/sample-dark";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/sample-admin")
|
||||||
|
public String sampleAdminMode() {
|
||||||
|
return "thymeleaf/sample/sample-admin";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/greeting")
|
||||||
|
public String greeting(@RequestParam(value = "name", required = false, defaultValue = "World") String name,
|
||||||
|
Model model) {
|
||||||
|
model.addAttribute("name", String.format(template, name));
|
||||||
|
return "thymeleaf/sample/greeting";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/jsp")
|
||||||
|
public String jspTest(@RequestParam(value = "name", required = false, defaultValue = "World") String name,
|
||||||
|
Model model) {
|
||||||
|
model.addAttribute("name", String.format(template, name));
|
||||||
|
return "Test";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/exceltest")
|
||||||
|
public String exceltest() {
|
||||||
|
return "thymeleaf/sample/exceldown";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/exceldown")//, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||||
|
public View excelDownTest(ModelMap modelMap) {
|
||||||
|
List<String> titleList = Arrays.asList( "아이디", "이름", "생년월일", "핸드폰번호", "전화", "이메일");
|
||||||
|
List<String> fieldList = Arrays.asList( "ID", "MBR_NM", "BRTHDY", "HP_NO", "TEL_NO", "EMAIL");
|
||||||
|
modelMap.addAttribute("titleList", titleList);
|
||||||
|
modelMap.addAttribute("fieldList", fieldList);
|
||||||
|
|
||||||
|
List<Map<String, Object>> listRes = new ArrayList<>();
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("MBR_NM", "fsafas");
|
||||||
|
map.put("BRTHDY", "12341212");
|
||||||
|
map.put("HP_NO", "01011112222");
|
||||||
|
map.put("TEL_NO", "0311231234");
|
||||||
|
map.put("EMAIL", "a@b.com");
|
||||||
|
for(int i=0; i<10; i++) {
|
||||||
|
map.put("ID", i);
|
||||||
|
listRes.add(map);
|
||||||
|
}
|
||||||
|
modelMap.addAttribute("contentList", listRes);
|
||||||
|
return new PoiExcelView("exceltest.xlsx");
|
||||||
|
|
||||||
|
//modelMap.addAttribute("titleList", paramMap.get("titleList"));
|
||||||
|
//modelMap.addAttribute("fieldList", paramMap.get("fieldList"));
|
||||||
|
//return new PoiExcelView(paramMap.get("fileName").toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @GetMapping("/greeting2")
|
||||||
|
// public Mono<Greeting> greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||||
|
// return new Greeting(counter.incrementAndGet(), String.format(template, name));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @GetMapping("/getGreetings")
|
||||||
|
// public Flux<Greeting> getAllMargins() {
|
||||||
|
// return null;//marginRepository.findAll();
|
||||||
|
// }
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.xit.biz.sample.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DefaultDto {
|
||||||
|
private String msg;
|
||||||
|
private boolean result;
|
||||||
|
private List<Integer> stringFlux;
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.xit.biz.sample.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PersonDto {
|
||||||
|
String name;
|
||||||
|
int age;
|
||||||
|
}
|
@ -0,0 +1,92 @@
|
|||||||
|
//package com.xit.biz.sample.ignore;
|
||||||
|
//
|
||||||
|
//import com.xit.biz.cmm.domain.CmmUser;
|
||||||
|
//import com.xit.biz.cmm.service.ICmmUserMgtService;
|
||||||
|
//import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
//import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
//import lombok.RequiredArgsConstructor;
|
||||||
|
//import lombok.extern.slf4j.Slf4j;
|
||||||
|
//import org.springframework.data.domain.PageRequest;
|
||||||
|
//import org.springframework.http.MediaType;
|
||||||
|
//import org.springframework.web.bind.annotation.*;
|
||||||
|
//import reactor.core.publisher.Flux;
|
||||||
|
//import reactor.core.publisher.Mono;
|
||||||
|
//
|
||||||
|
//@Tag(name = "FluxCmmUserController", description = "사용자 관리(Web-flux)")
|
||||||
|
//@Slf4j
|
||||||
|
//@RestController
|
||||||
|
//@RequiredArgsConstructor
|
||||||
|
//@RequestMapping("/api/biz/cmm/flux")
|
||||||
|
//public class FluxCmmUserController {
|
||||||
|
// private final ICmmUserMgtService cmmUserMgtService;
|
||||||
|
//
|
||||||
|
// @Operation(summary = "사용자 목록 조회" , description = "등록된 사용자 전체 목록 조회")
|
||||||
|
// @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||||
|
// public Flux<?> findAll() {
|
||||||
|
// return Flux.fromIterable(cmmUserMgtService.findAll());
|
||||||
|
// //return new ResponseEntity<Iterable<CmmUser>>(cmmUserRepository.findAll(), HttpStatus.OK);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(summary = "사용자 목록 조회" , description = "등록된 사용자 전체 목록 조회")
|
||||||
|
// @GetMapping(value="/page", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public Mono<?> findAllPage() {
|
||||||
|
//
|
||||||
|
// return Mono.just(cmmUserMgtService.findAll(PageRequest.of(0, 2)));
|
||||||
|
//
|
||||||
|
// //Page<CmmUser> page = cmmUserRepository.findAll(PageRequest.of(pageable.getPageNumber(), pageable.getPageSize()));
|
||||||
|
// //return xitApiResult.of(new ResponseEntity<Page<CmmUser>>(page, HttpStatus.OK));
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
|
||||||
|
// @GetMapping(value="/{cmmUserId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public Mono<?> findByCmmUserId(@PathVariable final Long cmmUserId) {
|
||||||
|
// return Mono.just(cmmUserMgtService.findById(cmmUserId));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// @Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회")
|
||||||
|
//// @GetMapping(value="/{userId}", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||||
|
//// public Flux<?> findByUserId(@PathVariable final String userId) {
|
||||||
|
//// return Flux.just(cmmUserRepository.findByUserId(userId));
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
// @Operation(summary = "사용자 추가" , description = "사용자 등록")
|
||||||
|
// @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public Mono<?> save(@RequestBody CmmUser cmmUserEntity) {
|
||||||
|
// return Mono.just(cmmUserMgtService.save(cmmUserEntity));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Operation(summary = "사용자 정보 변경" , description = "사용자 정보 변경")
|
||||||
|
// @PutMapping(value="/{cmmUserId}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
|
// public Mono<?> modify(@PathVariable final Long cmmUserId, @RequestBody CmmUser cmmUser) {
|
||||||
|
// return Mono.just(cmmUserMgtService.save(cmmUser));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//// @Operation(summary = "사용자 삭제" , description = "사용자 제거")
|
||||||
|
//// @DeleteMapping(value="/{cmmUserId}", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||||
|
//// public Mono<?> deleteById(@PathVariable final Long cmmUserId) {
|
||||||
|
//// cmmUserRepository.deleteById(cmmUserId);
|
||||||
|
//// return Mono.empty();
|
||||||
|
////
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
///*
|
||||||
|
// @Bean
|
||||||
|
// public RouterFunction<ServerResponse> monoRouterFunction(UserHandler userHandler) {
|
||||||
|
// return route(GET("/users/{userId}").and(accept(APPLICATION_JSON)), userHandler::getUser);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Mono<User> getUser(ServerRequest request) {
|
||||||
|
// // ...
|
||||||
|
// // request 로부터 userId를 뽑았다고 가정
|
||||||
|
//
|
||||||
|
// Mono<User> mono = Mono.just(userService.findById(userId));
|
||||||
|
// return ServerResponse
|
||||||
|
// .ok()
|
||||||
|
// .contentType(MediaType.APPLICATION_JSON)
|
||||||
|
// .body(mono, User.class);
|
||||||
|
// }
|
||||||
|
//*/
|
||||||
|
//
|
||||||
|
//}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.xit.biz.sample.ignore;
|
||||||
|
|
||||||
|
import com.xit.biz.sample.Greeting;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicLong;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/sample/flux")
|
||||||
|
@Tag(name = "FluxSampleController", description = "Flux Rest Api Sample")
|
||||||
|
public class FluxSampleController {
|
||||||
|
|
||||||
|
private static final String template = "Hello, %s!";
|
||||||
|
private final AtomicLong counter = new AtomicLong();
|
||||||
|
|
||||||
|
@GetMapping("/greeting")
|
||||||
|
public Greeting greeting(@RequestParam(value = "name", required = false, defaultValue = "World") String name) {
|
||||||
|
return new Greeting(counter.incrementAndGet(), String.format(template, name));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @GetMapping("/greeting2")
|
||||||
|
// public Mono<Greeting> greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||||
|
// return new Greeting(counter.incrementAndGet(), String.format(template, name));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @GetMapping("/getGreetings")
|
||||||
|
// public Flux<Greeting> getAllMargins() {
|
||||||
|
// return null;//marginRepository.findAll();
|
||||||
|
// }
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.xit.core._ignore.security.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Getter @Setter
|
||||||
|
//@MappedSuperclass
|
||||||
|
public abstract class BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1146360965411496820L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
|
@Column(updatable = false, nullable = false, columnDefinition = "INT(11)")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
@Column(updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
|
||||||
|
private Date createTimestamp;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
@Column(nullable = true, columnDefinition = "TIMESTAMP DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP")
|
||||||
|
private Date updateTimestamp;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Column(nullable = false, columnDefinition = "TINYINT(1) DEFAULT 0")
|
||||||
|
private boolean del;
|
||||||
|
|
||||||
|
@PrePersist
|
||||||
|
protected void onCreate() {
|
||||||
|
createTimestamp = Timestamp.valueOf(LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreUpdate
|
||||||
|
protected void onUpdate() {
|
||||||
|
updateTimestamp = Timestamp.valueOf(LocalDateTime.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,68 @@
|
|||||||
|
package com.xit.core._ignore.security.entity;
|
||||||
|
|
||||||
|
import com.xit.core.oauth2.oauth.entity.RoleType;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class SecurityUser extends User implements UserDetails {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 8666468119299100306L;
|
||||||
|
|
||||||
|
private final boolean accountNonExpired;
|
||||||
|
private final boolean accountNonLocked;
|
||||||
|
private final boolean credentialsNonExpired;
|
||||||
|
private final boolean enabled;
|
||||||
|
|
||||||
|
public SecurityUser(User user) {
|
||||||
|
super();
|
||||||
|
setId(user.getId());
|
||||||
|
setEmail(user.getEmail());
|
||||||
|
setName(user.getName());
|
||||||
|
setPassword(user.getPassword());
|
||||||
|
setDel(user.isDel());
|
||||||
|
setUserRoles(user.getUserRoles());
|
||||||
|
this.accountNonExpired = true;
|
||||||
|
this.accountNonLocked = true;
|
||||||
|
this.credentialsNonExpired = true;
|
||||||
|
this.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<RoleType> getRoleTypes() {
|
||||||
|
return getUserRoles().stream().map(f -> f.getRoleName()).collect(Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||||
|
return getUserRoles();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUsername() {
|
||||||
|
return super.getEmail();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAccountNonExpired() {
|
||||||
|
return this.accountNonExpired;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAccountNonLocked() {
|
||||||
|
return this.accountNonLocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCredentialsNonExpired() {
|
||||||
|
return this.credentialsNonExpired;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return this.enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.xit.core._ignore.security.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||||
|
import lombok.*;
|
||||||
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
import org.hibernate.annotations.Where;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
//@Entity
|
||||||
|
//@Table(name = "user")
|
||||||
|
//@DynamicUpdate @DynamicInsert
|
||||||
|
public class User extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -563329217866858622L;
|
||||||
|
|
||||||
|
@ColumnDefault(value = "0")
|
||||||
|
@Column(nullable = false, length = 1, columnDefinition = "CHAR(1)")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Column(nullable = false, unique = true, length = 100)
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
@Column(nullable = false, length = 50)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ColumnDefault(value = "1")
|
||||||
|
@Column(nullable = false, length = 1, columnDefinition = "CHAR(1)")
|
||||||
|
private String sex;
|
||||||
|
|
||||||
|
@Column(nullable = false, length = 6)
|
||||||
|
private String birthDate;
|
||||||
|
|
||||||
|
@Column(nullable = false, length = 20)
|
||||||
|
private String phoneNumber;
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Column(nullable = false, length = 150)
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Column(length = 50)
|
||||||
|
private String picture;
|
||||||
|
|
||||||
|
@Singular("userRoles")
|
||||||
|
@JsonManagedReference
|
||||||
|
@OneToMany(mappedBy="user")
|
||||||
|
@Where(clause = "del = false")
|
||||||
|
private Set<UserRole> userRoles;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
public User(String type, String name, String email, String sex, String birthDate, String phoneNumber, String password, String picture) {
|
||||||
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
|
this.email = email;
|
||||||
|
this.sex = sex;
|
||||||
|
this.birthDate = birthDate;
|
||||||
|
this.phoneNumber = phoneNumber;
|
||||||
|
this.password = password;
|
||||||
|
this.picture = picture;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,43 @@
|
|||||||
|
package com.xit.core._ignore.security.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.xit.core.oauth2.oauth.entity.RoleType;
|
||||||
|
import lombok.*;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
//@Entity
|
||||||
|
//@Table(name = "user_role", uniqueConstraints = {@UniqueConstraint(columnNames = {"user_id", "role_name"})})
|
||||||
|
//@DynamicUpdate
|
||||||
|
public class UserRole extends BaseEntity implements Serializable, GrantedAuthority {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 7943607393308984161L;
|
||||||
|
|
||||||
|
@JsonBackReference
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "user_id", nullable = false, foreignKey = @ForeignKey(name = "FK_USER_ROLE_USER"))
|
||||||
|
private User user;
|
||||||
|
|
||||||
|
@Column(name="role_name", nullable=false, length = 20)
|
||||||
|
@Enumerated(EnumType.STRING)
|
||||||
|
private RoleType roleName;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
public UserRole(User user, RoleType roleName) {
|
||||||
|
this.user = user;
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
@Override
|
||||||
|
public String getAuthority() {
|
||||||
|
return this.roleName.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
package com.xit.core._ignore.security.handler;
|
||||||
|
|
||||||
|
import com.xit.core._ignore.security.entity.SecurityUser;
|
||||||
|
import com.xit.core._ignore.security.entity.UserRole;
|
||||||
|
import com.xit.core.oauth2.oauth.entity.RoleType;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
//@Component
|
||||||
|
public class WebAccessDeniedHandler implements AccessDeniedHandler {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(WebAccessDeniedHandler.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(HttpServletRequest req, HttpServletResponse res, AccessDeniedException ade)
|
||||||
|
throws IOException, ServletException {
|
||||||
|
res.setStatus(HttpStatus.FORBIDDEN.value());
|
||||||
|
|
||||||
|
if(ade instanceof AccessDeniedException) {
|
||||||
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
|
if (authentication != null) {
|
||||||
|
SecurityUser securityUser = (SecurityUser) authentication.getPrincipal();
|
||||||
|
Set<RoleType> roleTypes = securityUser.getRoleTypes();
|
||||||
|
if(!roleTypes.isEmpty()) {
|
||||||
|
req.setAttribute("msg", "접근권한 없는 사용자입니다.");
|
||||||
|
//if (roleTypes.contains(RoleType..ROLE_VIEW)) {
|
||||||
|
req.setAttribute("nextPage", "/v");
|
||||||
|
//}
|
||||||
|
} else {
|
||||||
|
req.setAttribute("msg", "로그인 권한이 없는 아이디입니다.");
|
||||||
|
req.setAttribute("nextPage", "/login");
|
||||||
|
res.setStatus(HttpStatus.UNAUTHORIZED.value());
|
||||||
|
SecurityContextHolder.clearContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.info(ade.getClass().getCanonicalName());
|
||||||
|
}
|
||||||
|
req.getRequestDispatcher("/err/denied-page").forward(req, res);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package com.xit.core._ignore.security.session;
|
||||||
|
|
||||||
|
import org.springframework.security.access.AccessDeniedException;
|
||||||
|
import org.springframework.security.web.access.AccessDeniedHandler;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//@Component
|
||||||
|
public class CustomAccessDeniedHandler implements AccessDeniedHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(final HttpServletRequest request, final HttpServletResponse response, final AccessDeniedException ex) throws IOException, ServletException {
|
||||||
|
response.getOutputStream().print("Error Message Goes Here");
|
||||||
|
response.setStatus(403);
|
||||||
|
// response.sendRedirect("/my-error-page");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
package com.xit.core._ignore.security.session;
|
||||||
|
|
||||||
|
import org.springframework.security.core.AuthenticationException;
|
||||||
|
import org.springframework.security.web.AuthenticationEntryPoint;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Entry Point will not redirect to any sort of Login - it will return the 401
|
||||||
|
*/
|
||||||
|
//@Component
|
||||||
|
public final class RestAuthenticationEntryPoint implements AuthenticationEntryPoint {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void commence(
|
||||||
|
final HttpServletRequest request,
|
||||||
|
final HttpServletResponse response,
|
||||||
|
final AuthenticationException authException) throws IOException {
|
||||||
|
|
||||||
|
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.xit.core._ignore.security.session;
|
||||||
|
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
|
||||||
|
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
|
||||||
|
import org.springframework.security.web.savedrequest.RequestCache;
|
||||||
|
import org.springframework.security.web.savedrequest.SavedRequest;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
//@Component
|
||||||
|
public class SavedRequestAwareAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
||||||
|
|
||||||
|
private RequestCache requestCache = new HttpSessionRequestCache();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAuthenticationSuccess(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) throws ServletException, IOException {
|
||||||
|
final SavedRequest savedRequest = requestCache.getRequest(request, response);
|
||||||
|
|
||||||
|
if (savedRequest == null) {
|
||||||
|
clearAuthenticationAttributes(request);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final String targetUrlParameter = getTargetUrlParameter();
|
||||||
|
if (isAlwaysUseDefaultTargetUrl() || (targetUrlParameter != null && StringUtils.hasText(request.getParameter(targetUrlParameter)))) {
|
||||||
|
requestCache.removeRequest(request, response);
|
||||||
|
clearAuthenticationAttributes(request);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clearAuthenticationAttributes(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequestCache(final RequestCache requestCache) {
|
||||||
|
this.requestCache = requestCache;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,150 @@
|
|||||||
|
package com.xit.core._ignore.security.session;
|
||||||
|
|
||||||
|
import com.xit.core.exception.filter.ExceptionHandlerFilter;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
import org.springframework.security.authentication.AuthenticationManager;
|
||||||
|
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||||
|
import org.springframework.security.config.http.SessionCreationPolicy;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.security.task.DelegatingSecurityContextAsyncTaskExecutor;
|
||||||
|
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
|
||||||
|
|
||||||
|
//@Configuration
|
||||||
|
//@EnableWebSecurity
|
||||||
|
//@EnableGlobalMethodSecurity(prePostEnabled = true)
|
||||||
|
//@ComponentScan("com.xit.core.security")
|
||||||
|
public class SecuritySessionJavaConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
private static final String[] AUTH_WHITELIST = {
|
||||||
|
"/h2-console/**",
|
||||||
|
"/v2/api-docs/**",
|
||||||
|
"/swagger-ui/**",
|
||||||
|
"/swagger-resources/**",
|
||||||
|
"/webjars/**",
|
||||||
|
"favicon.ico",
|
||||||
|
"/configuration/ui",
|
||||||
|
"/configuration/security",
|
||||||
|
"/resources/**"
|
||||||
|
};
|
||||||
|
|
||||||
|
// @Value("${jwt.secret}")
|
||||||
|
// private String secret;
|
||||||
|
|
||||||
|
private final CustomAccessDeniedHandler accessDeniedHandler;
|
||||||
|
private final RestAuthenticationEntryPoint restAuthenticationEntryPoint;
|
||||||
|
private final SavedRequestAwareAuthenticationSuccessHandler mySuccessHandler;
|
||||||
|
private final ExceptionHandlerFilter exceptionHandlerFilter;
|
||||||
|
private SimpleUrlAuthenticationFailureHandler myFailureHandler = new SimpleUrlAuthenticationFailureHandler();
|
||||||
|
|
||||||
|
public SecuritySessionJavaConfig(CustomAccessDeniedHandler accessDeniedHandler, RestAuthenticationEntryPoint restAuthenticationEntryPoint, SavedRequestAwareAuthenticationSuccessHandler mySuccessHandler, ExceptionHandlerFilter exceptionHandlerFilter) {
|
||||||
|
this.accessDeniedHandler = accessDeniedHandler;
|
||||||
|
this.restAuthenticationEntryPoint = restAuthenticationEntryPoint;
|
||||||
|
this.mySuccessHandler = mySuccessHandler;
|
||||||
|
this.exceptionHandlerFilter = exceptionHandlerFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@Override
|
||||||
|
public AuthenticationManager authenticationManagerBean() throws Exception{
|
||||||
|
return super.authenticationManagerBean();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(final AuthenticationManagerBuilder auth) throws Exception {
|
||||||
|
auth.inMemoryAuthentication()
|
||||||
|
.withUser("admin").password(encoder().encode("adminPass")).roles("ADMIN")
|
||||||
|
.and()
|
||||||
|
.withUser("user").password(encoder().encode("userPass")).roles("USER");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(final HttpSecurity http) throws Exception {
|
||||||
|
|
||||||
|
http
|
||||||
|
.cors().disable()
|
||||||
|
.csrf()
|
||||||
|
.ignoringAntMatchers("/h2-console/**")
|
||||||
|
.disable()
|
||||||
|
.authorizeRequests()
|
||||||
|
|
||||||
|
//OPTIONS 메소드 허락 - jwt 사용시 Authorization 요청 처리를 위해 ////////////////////////////////
|
||||||
|
.antMatchers(HttpMethod.OPTIONS, "/api/**").permitAll()
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
.and()
|
||||||
|
.exceptionHandling()
|
||||||
|
.accessDeniedHandler(accessDeniedHandler)
|
||||||
|
.authenticationEntryPoint(restAuthenticationEntryPoint)
|
||||||
|
|
||||||
|
// 인증 사용 및 미사용
|
||||||
|
.and()
|
||||||
|
.authorizeRequests()
|
||||||
|
.antMatchers("/api/**").permitAll()
|
||||||
|
.antMatchers("/h2-console/**").permitAll()
|
||||||
|
.antMatchers("/api/admin/**").hasRole("ADMIN")
|
||||||
|
//.anyRequest().authenticated() // 인증사용
|
||||||
|
|
||||||
|
.and()
|
||||||
|
.exceptionHandling().authenticationEntryPoint(restAuthenticationEntryPoint)
|
||||||
|
.and()
|
||||||
|
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
.and()
|
||||||
|
.formLogin().loginPage("/login").loginProcessingUrl("/login.do")
|
||||||
|
.usernameParameter("_username").passwordParameter("_password")
|
||||||
|
.successHandler(mySuccessHandler)
|
||||||
|
.failureHandler(myFailureHandler)
|
||||||
|
.and()
|
||||||
|
.httpBasic()
|
||||||
|
.and()
|
||||||
|
.logout()
|
||||||
|
//TODO : swagger 인증시
|
||||||
|
// .and()
|
||||||
|
// .authorizeRequests().antMatchers(AUTH_WHITELIST).authenticated()
|
||||||
|
// .and()
|
||||||
|
// .httpBasic().authenticationEntryPoint(swaggerAuthenticationEntryPoint())
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure(WebSecurity web) throws Exception {
|
||||||
|
web.ignoring().antMatchers(AUTH_WHITELIST);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO : swagger 인증시
|
||||||
|
// @Bean
|
||||||
|
// public BasicAuthenticationEntryPoint swaggerAuthenticationEntryPoint() {
|
||||||
|
// BasicAuthenticationEntryPoint entryPoint = new BasicAuthenticationEntryPoint();
|
||||||
|
// entryPoint.setRealmName("Swagger Realm");
|
||||||
|
// return entryPoint;
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public PasswordEncoder encoder() {
|
||||||
|
return new BCryptPasswordEncoder();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ThreadPoolTaskExecutor threadPoolTaskExecutor() {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
executor.setCorePoolSize(10);
|
||||||
|
executor.setMaxPoolSize(100);
|
||||||
|
executor.setQueueCapacity(50);
|
||||||
|
executor.setThreadNamePrefix("async-");
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public DelegatingSecurityContextAsyncTaskExecutor taskExecutor(ThreadPoolTaskExecutor threadPoolTaskExecutor) {
|
||||||
|
return new DelegatingSecurityContextAsyncTaskExecutor(threadPoolTaskExecutor);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.xit.core.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||||
|
public @interface Permission {
|
||||||
|
String[] types() default {};
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.xit.core.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(value = RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||||
|
public @interface Secured {
|
||||||
|
SecurityPolicy policy() default SecurityPolicy.DEFAULT;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.xit.core.annotation;
|
||||||
|
|
||||||
|
public enum SecurityPolicy {
|
||||||
|
/**
|
||||||
|
* 리소스의 아이피, 권한 등 기본 검증 처리
|
||||||
|
*/
|
||||||
|
DEFAULT,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 접근한 리소스의 토큰 기반 사용자가 접근할 수 있는 정책 적용
|
||||||
|
*/
|
||||||
|
TOKEN,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 접근한 리소스에 세션 기반 인증 사용자가 접근할 수 있는 정책 적용
|
||||||
|
*/
|
||||||
|
SESSION,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 접근한 리소스에 쿠키 기반 인증 사용자가 접근할 수 있는 정책 적용
|
||||||
|
*/
|
||||||
|
COOKIE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 보안 검사를 수행하지 않도록 정책 적용
|
||||||
|
*/
|
||||||
|
NONE
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
package com.xit.core.api;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.config.BeanDefinition;
|
||||||
|
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||||
|
import org.springframework.beans.factory.support.BeanNameGenerator;
|
||||||
|
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bean 이름 식별시 패키지를 포함하도록 지정
|
||||||
|
* /v1/api, /v2/api 형태로 생성 가능하도록
|
||||||
|
*/
|
||||||
|
public class CustomBeanNameGenerator implements BeanNameGenerator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* basePackages 외에 scaning된 beanGenerator
|
||||||
|
*/
|
||||||
|
private static final BeanNameGenerator DELEGATE = new AnnotationBeanNameGenerator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VersioningBeanNameGenerator 대상 package 경로
|
||||||
|
*/
|
||||||
|
private final List<String> basePackages = new ArrayList<>(
|
||||||
|
Arrays.asList("com.xit.biz", "com.xit.core")
|
||||||
|
);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NonNull String generateBeanName(@NonNull BeanDefinition definition, @NonNull BeanDefinitionRegistry registry) {
|
||||||
|
if(isTargetPackageBean(definition)) {
|
||||||
|
return getBeanName(definition);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DELEGATE.generateBeanName(definition, registry);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isTargetPackageBean(BeanDefinition definition) {
|
||||||
|
String beanClassName = getBeanName(definition);
|
||||||
|
return basePackages.stream().anyMatch(beanClassName::startsWith);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBeanName(BeanDefinition definition) {
|
||||||
|
return definition.getBeanClassName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBasePackages(String path) {
|
||||||
|
this.basePackages.add(path);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.xit.core.api;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
|
||||||
|
@Schema(required = true, name = "RestResponse", description = "Rest Api Response interface class")
|
||||||
|
public interface IRestResponse {
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue