From a4e78c55049e80fac62d2e1cdd08c05af7fc3e5f Mon Sep 17 00:00:00 2001 From: Lim Jonguk Date: Fri, 4 Mar 2022 18:37:47 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=96=91=EB=B0=A9=ED=96=A5=20entity=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 26 +- .../cmm/controller/CmmCodeMgtController.java | 9 +- .../com/xit/biz/cmm/dto/ComboCodeDto.java | 13 +- .../com/xit/biz/cmm/dto/IComboCodeDto.java | 10 + .../cmm/repository/ICmmCodeLRepostory.java | 5 +- .../cmm/repository/ICmmCodeMRepository.java | 4 +- .../cmm/repository/ICmmCodeSRepository.java | 8 +- .../repository/ICmmComboCodeRepository.java | 16 + .../xit/biz/cmm/service/ICmmCodeService.java | 1 + .../biz/cmm/service/impl/CmmCodeService.java | 14 +- .../auth/service/impl/AuthMinService.java | 2 + .../controller/MinCivBoard680Controller.java | 2 +- .../controller/MinUserinfoController.java | 16 +- .../ctgy/controller/OAuth2MinController.java | 4 +- .../com/xit/biz/ctgy/entity/MinUserinfo.java | 2 +- .../repository/IMinUserinfoRepository.java | 7 +- .../biz/ctgy/service/IMinUserinfoService.java | 5 + .../ctgy/service/impl/MinUserinfoService.java | 13 + .../java/com/xit/core/api/RestResponse.java | 2 +- .../config/database/DataSourceConfig.java | 16 + .../config/support/SpringDocApiConfig.java | 3 +- .../com/xit/core/oauth2/api/dto/TokenDto.java | 4 + src/main/resources/config/application-dev.yml | 2 +- .../resources/config/application-local.yml | 15 +- .../resources/data/h2/mm_maincode_mig.sql | 23 + src/main/resources/data/h2/schema.sql | 1351 ++++++++++++++++- src/main/resources/data/h2/schema_oracle.sql | 72 + .../repository/ICmmCodeRepositoryTest.java | 5 +- 28 files changed, 1545 insertions(+), 105 deletions(-) create mode 100644 src/main/java/com/xit/biz/cmm/dto/IComboCodeDto.java create mode 100644 src/main/java/com/xit/biz/cmm/repository/ICmmComboCodeRepository.java create mode 100644 src/main/resources/data/h2/mm_maincode_mig.sql create mode 100644 src/main/resources/data/h2/schema_oracle.sql diff --git a/build.gradle b/build.gradle index b7b1ea1..190bcae 100644 --- a/build.gradle +++ b/build.gradle @@ -129,23 +129,23 @@ dependencies { //compileOnly 'com.querydsl:querydsl-apt' // JPA mapstruct : lombok 과 함께 사용시 반드시 순서 지겨야 함다 - lombok이 먼저 선언된 경우 -// implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0' -// implementation 'org.projectlombok:lombok' -// implementation 'org.mapstruct:mapstruct:1.4.2.Final' -// annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0" -// annotationProcessor 'org.projectlombok:lombok' -// annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final' + implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0' + implementation 'org.projectlombok:lombok' + implementation 'org.mapstruct:mapstruct:1.4.2.Final' + annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0" + annotationProcessor 'org.projectlombok:lombok' + annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final' // JPA mapstruct : lombok 과 함께 사용시 반드시 순서 지겨야 함다 - ㅡmapstruct이 먼저 선언된 경우 // target class 에 @Builder 가 있어도 무시하고 생성자 + setter 를 사용하므로 정상적으로 Mapper 클래스를 Generation 하기 위해서 // @NoArgsConstructor, @Setter 가 필요 // but, 최근 Setter 사용을 지양하는 추세라 mapstruct를 먼저 오도록 해서 @Builder 방식으로 Generation - implementation 'org.mapstruct:mapstruct:1.4.2.Final' - implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0' - implementation 'org.projectlombok:lombok' - annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final' - annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0" - annotationProcessor 'org.projectlombok:lombok' +// implementation 'org.mapstruct:mapstruct:1.4.2.Final' +// implementation 'org.projectlombok:lombok-mapstruct-binding:0.2.0' +// implementation 'org.projectlombok:lombok' +// annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.2.Final' +// annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0" +// annotationProcessor 'org.projectlombok:lombok' //-----------------------------------------------------------------------------------// //-----------------------------------------------------------------------------------// @@ -224,6 +224,8 @@ dependencies { implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.1' implementation 'com.fasterxml.jackson.module:jackson-module-afterburner:2.13.1' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.13.1' + // JAP LAZY loading시 객체생성 (OneToMay <--> ManyToOne) + implementation 'com.fasterxml.jackson.datatype:jackson-datatype-hibernate5' //implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.5' // response xml diff --git a/src/main/java/com/xit/biz/cmm/controller/CmmCodeMgtController.java b/src/main/java/com/xit/biz/cmm/controller/CmmCodeMgtController.java index 7c7055d..6ba1bf2 100644 --- a/src/main/java/com/xit/biz/cmm/controller/CmmCodeMgtController.java +++ b/src/main/java/com/xit/biz/cmm/controller/CmmCodeMgtController.java @@ -1,5 +1,7 @@ package com.xit.biz.cmm.controller; +import com.xit.biz.cmm.dto.ComboCodeDto; +import com.xit.biz.cmm.dto.IComboCodeDto; import com.xit.biz.cmm.entity.*; import com.xit.biz.cmm.entity.ids.CmmCodeSIds; import com.xit.biz.cmm.dto.CmmCodeDto; @@ -18,11 +20,12 @@ import org.springframework.util.Assert; import org.springframework.web.bind.annotation.*; import javax.annotation.Nonnull; +import java.util.List; @Tag(name = "CmmCodeMgtController", description = "코드 관리") @RestController @RequiredArgsConstructor -@RequestMapping("/api/biz/cmm/callback") +@RequestMapping("/api/v1/biz/cmm") public class CmmCodeMgtController { private final ICmmCodeService cmmCodeService; @@ -31,7 +34,9 @@ public class CmmCodeMgtController { public ResponseEntity findComboCodes(@Nonnull final CmmCodeSIds searchKeyDto) { Assert.notNull(searchKeyDto, "조회할 콤보코드 대상이 없습니다."); Assert.notNull(searchKeyDto.getCodeGrpId(), "조회할 대분류 코드를 선택해 주세요."); - return RestResponse.of(cmmCodeService.findComboCodes(searchKeyDto)); + List list = cmmCodeService.findComboCodes(searchKeyDto); + return RestResponse.of(list); + //return RestResponse.of(cmmCodeService.findComboCodes(searchKeyDto)); } @Operation(summary = "코드그룹 목록 조회") diff --git a/src/main/java/com/xit/biz/cmm/dto/ComboCodeDto.java b/src/main/java/com/xit/biz/cmm/dto/ComboCodeDto.java index 7654fab..9b466a2 100644 --- a/src/main/java/com/xit/biz/cmm/dto/ComboCodeDto.java +++ b/src/main/java/com/xit/biz/cmm/dto/ComboCodeDto.java @@ -1,9 +1,16 @@ package com.xit.biz.cmm.dto; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; @Schema(name = "CmmCodeDto", description = "콤보공통코드 DTO") -public interface ComboCodeDto { - public String getCode(); - public String getValue(); + +@Getter +@Setter +@AllArgsConstructor +public class ComboCodeDto { + private String code; + private String value; } diff --git a/src/main/java/com/xit/biz/cmm/dto/IComboCodeDto.java b/src/main/java/com/xit/biz/cmm/dto/IComboCodeDto.java new file mode 100644 index 0000000..5e94eee --- /dev/null +++ b/src/main/java/com/xit/biz/cmm/dto/IComboCodeDto.java @@ -0,0 +1,10 @@ +package com.xit.biz.cmm.dto; + +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "CmmCodeDto", description = "콤보공통코드 DTO") + +public interface IComboCodeDto { + public String getCode(); + public String getValue(); +} diff --git a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeLRepostory.java b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeLRepostory.java index 62356ea..5cde4eb 100644 --- a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeLRepostory.java +++ b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeLRepostory.java @@ -1,9 +1,10 @@ package com.xit.biz.cmm.repository; +import com.xit.biz.cmm.dto.ComboCodeDto; 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 com.xit.biz.cmm.dto.IComboCodeDto; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; @@ -12,6 +13,6 @@ import org.springframework.data.repository.query.Param; import java.util.List; public interface ICmmCodeLRepostory extends JpaRepository, JpaSpecificationExecutor { - @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") + @Query(value = "select new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) from #{#entityName} c where c.codeGrpId = :codeGrpId and c.useYn = 'Y' order by c.codeOrdr asc") List queryComboCode(@Param("codeGrpId") String codeGrpId); } diff --git a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeMRepository.java b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeMRepository.java index 47ced9c..456d959 100644 --- a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeMRepository.java +++ b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeMRepository.java @@ -1,9 +1,9 @@ package com.xit.biz.cmm.repository; +import com.xit.biz.cmm.dto.ComboCodeDto; 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; @@ -12,6 +12,6 @@ import org.springframework.data.repository.query.Param; import java.util.List; public interface ICmmCodeMRepository extends JpaRepository, JpaSpecificationExecutor { - @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") + @Query(value = "select new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) from #{#entityName} c where c.codeGrpId = :codeGrpId and c.codeLcd = :codeLcd and c.useYn = 'Y' order by c.codeOrdr asc") List queryComboCode(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd); } diff --git a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeSRepository.java b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeSRepository.java index 174379f..f3291ed 100644 --- a/src/main/java/com/xit/biz/cmm/repository/ICmmCodeSRepository.java +++ b/src/main/java/com/xit/biz/cmm/repository/ICmmCodeSRepository.java @@ -1,9 +1,10 @@ package com.xit.biz.cmm.repository; +import com.xit.biz.cmm.dto.ComboCodeDto; 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.dto.IComboCodeDto; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; @@ -13,5 +14,8 @@ import java.util.List; public interface ICmmCodeSRepository extends JpaRepository, JpaSpecificationExecutor { @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 queryComboCode(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd, @Param("codeMcd")String codeMcd); + List queryComboCodeInterface(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd, @Param("codeMcd")String codeMcd); + + @Query(value = "select new com.xit.biz.cmm.dto.ComboCodeDto(c.codeCd, c.codeNm) 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 queryComboCodeClass(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd, @Param("codeMcd")String codeMcd); } diff --git a/src/main/java/com/xit/biz/cmm/repository/ICmmComboCodeRepository.java b/src/main/java/com/xit/biz/cmm/repository/ICmmComboCodeRepository.java new file mode 100644 index 0000000..59872d2 --- /dev/null +++ b/src/main/java/com/xit/biz/cmm/repository/ICmmComboCodeRepository.java @@ -0,0 +1,16 @@ +package com.xit.biz.cmm.repository; + +import com.xit.biz.cmm.dto.IComboCodeDto; +import com.xit.biz.cmm.entity.CmmCodeS; +import com.xit.biz.cmm.entity.ids.CmmCodeSIds; +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 ICmmComboCodeRepository extends JpaRepository, JpaSpecificationExecutor { + @Query(value = "SELECT C.code_cd AS code, C.code_nm AS value FROM tb_cmm_code_s C WHERE C.code_grp_id = :codeGrpId AND C.code_lcd = :codeLcd AND C.code_mcd = :codeMcd AND C.use_yn = 'Y' ORDER BY C.code_ordr ASC", nativeQuery = true) + List queryComboCode(@Param("codeGrpId")String codeGrpId, @Param("codeLcd")String codeLcd, @Param("codeMcd")String codeMcd); +} diff --git a/src/main/java/com/xit/biz/cmm/service/ICmmCodeService.java b/src/main/java/com/xit/biz/cmm/service/ICmmCodeService.java index dbc7475..19d4022 100644 --- a/src/main/java/com/xit/biz/cmm/service/ICmmCodeService.java +++ b/src/main/java/com/xit/biz/cmm/service/ICmmCodeService.java @@ -3,6 +3,7 @@ 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.IComboCodeDto; import com.xit.biz.cmm.dto.ComboCodeDto; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; diff --git a/src/main/java/com/xit/biz/cmm/service/impl/CmmCodeService.java b/src/main/java/com/xit/biz/cmm/service/impl/CmmCodeService.java index 883712f..fa4632d 100644 --- a/src/main/java/com/xit/biz/cmm/service/impl/CmmCodeService.java +++ b/src/main/java/com/xit/biz/cmm/service/impl/CmmCodeService.java @@ -1,5 +1,6 @@ package com.xit.biz.cmm.service.impl; +import com.xit.biz.cmm.dto.ComboCodeDto; import com.xit.biz.cmm.dto.struct.CmmCodeGrpMapstruct; import com.xit.biz.cmm.dto.struct.CmmCodeLMapstruct; import com.xit.biz.cmm.dto.struct.CmmCodeMMapstruct; @@ -10,11 +11,8 @@ 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.dto.IComboCodeDto; +import com.xit.biz.cmm.repository.*; import com.xit.biz.cmm.service.ICmmCodeService; import com.xit.core.util.AssertUtils; import com.xit.core.util.Checks; @@ -38,6 +36,7 @@ public class CmmCodeService implements ICmmCodeService { private final ICmmCodeLRepostory cmmCodeLRepository; private final ICmmCodeMRepository cmmCodeMRepository; private final ICmmCodeSRepository cmmCodeSRepository; + private final ICmmComboCodeRepository cmmComboCodeRepository; private CmmCodeGrpMapstruct codeGrpstruct = Mappers.getMapper(CmmCodeGrpMapstruct.class); private CmmCodeLMapstruct codeLstruct = Mappers.getMapper(CmmCodeLMapstruct.class); @@ -51,7 +50,10 @@ public class CmmCodeService implements ICmmCodeService { // 소분류 코드 조회 if(StringUtils.hasText(searchKeyDto.getCodeMcd())){ AssertUtils.isTrue(!Checks.isEmpty(searchKeyDto.getCodeLcd()), "대분류 코드가 선택되지 않았습니다."); - return cmmCodeSRepository.queryComboCode(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd(), searchKeyDto.getCodeMcd()); + List list = cmmCodeSRepository.queryComboCodeClass(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd(), searchKeyDto.getCodeMcd()); + //List list = cmmComboCodeRepository.queryComboCode(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd(), searchKeyDto.getCodeMcd()); + return list; + //return cmmCodeSRepository.queryComboCode(searchKeyDto.getCodeGrpId(), searchKeyDto.getCodeLcd(), searchKeyDto.getCodeMcd()); } // 중분류 코드 조회 diff --git a/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java b/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java index d07b74c..5849e6a 100644 --- a/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java +++ b/src/main/java/com/xit/biz/ctgy/auth/service/impl/AuthMinService.java @@ -18,6 +18,7 @@ import com.xit.core.oauth2.utils.CookieUtil; import com.xit.core.oauth2.utils.HeaderUtil; import com.xit.core.util.Checks; import lombok.RequiredArgsConstructor; +import org.hibernate.Hibernate; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -168,6 +169,7 @@ public class AuthMinService implements IAuthMinService { } // 5. 토큰 발급 + tokenDto.setUser(user); return tokenDto; } diff --git a/src/main/java/com/xit/biz/ctgy/controller/MinCivBoard680Controller.java b/src/main/java/com/xit/biz/ctgy/controller/MinCivBoard680Controller.java index 94b40c6..29ec1fb 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/MinCivBoard680Controller.java +++ b/src/main/java/com/xit/biz/ctgy/controller/MinCivBoard680Controller.java @@ -43,7 +43,7 @@ public class MinCivBoard680Controller { @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity findMinCivBoard680s( @Parameter(hidden = true) - @ModelAttribute("minCivBoard680Dto") + //@ModelAttribute("minCivBoard680Dto") final MinCivBoard680Dto minCivBoard680Dto, @Parameter(hidden = true) final Pageable pageable) { diff --git a/src/main/java/com/xit/biz/ctgy/controller/MinUserinfoController.java b/src/main/java/com/xit/biz/ctgy/controller/MinUserinfoController.java index f8e68b7..06cec4f 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/MinUserinfoController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/MinUserinfoController.java @@ -6,6 +6,8 @@ import com.xit.biz.ctgy.dto.struct.MinCivBoard680Mapstruct; import com.xit.biz.ctgy.dto.struct.MinUserinfoMapstruct; import com.xit.biz.ctgy.service.IMinCivBoard680Service; import com.xit.biz.ctgy.service.IMinUserinfoService; +import com.xit.core.annotation.Secured; +import com.xit.core.annotation.SecurityPolicy; import com.xit.core.api.IRestResponse; import com.xit.core.api.RestResponse; import io.swagger.v3.oas.annotations.Operation; @@ -18,6 +20,8 @@ import org.mapstruct.factory.Mappers; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.ModelAttribute; @@ -26,7 +30,7 @@ import org.springframework.web.bind.annotation.RestController; @Tag(name = "MinUserinfoController", description = "사용자 관리") @RestController -@RequestMapping("/api/v1/ctgy/user") +@RequestMapping("/api/v1/ctgy") @Validated @RequiredArgsConstructor public class MinUserinfoController { @@ -43,7 +47,7 @@ public class MinUserinfoController { @Parameter(in = ParameterIn.QUERY, name = "page", description = "페이지", required = true, example = "1"), @Parameter(in = ParameterIn.QUERY, name = "size", description = "페이지당갯수", required = true, example = "10") }) - @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE) + @GetMapping(value="users", produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity findMinUserinfos( @Parameter(hidden = true) @ModelAttribute("minUserinfoDto") @@ -53,4 +57,12 @@ public class MinUserinfoController { return RestResponse.of(service.findMinUserinfos(mapstruct.toEntity(minUserinfoDto), pageable)); } + @Operation(summary = "사용자 정보 조회" , description = "사용자 정보 조회") + @GetMapping("/user") + @Secured(policy = SecurityPolicy.TOKEN) + @Transactional(readOnly = true) + public ResponseEntity getUserInfo() { + return RestResponse.of(service.findMyUserWithoutAuthorities()); + } + } diff --git a/src/main/java/com/xit/biz/ctgy/controller/OAuth2MinController.java b/src/main/java/com/xit/biz/ctgy/controller/OAuth2MinController.java index 0933238..00e4ee7 100644 --- a/src/main/java/com/xit/biz/ctgy/controller/OAuth2MinController.java +++ b/src/main/java/com/xit/biz/ctgy/controller/OAuth2MinController.java @@ -13,6 +13,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -24,7 +25,7 @@ import javax.validation.constraints.NotNull; @Tag(name = "OAuth2MinController", description = "인증 관리") @RestController -@RequestMapping("/api/v1/ctgy/auth") +@RequestMapping("/api/v1/ctgy/account") @Validated @RequiredArgsConstructor public class OAuth2MinController { @@ -62,6 +63,7 @@ public class OAuth2MinController { // @Parameter(in = ParameterIn.QUERY, name = "password", description = "비밀번호", required = true, example = "minuk926926") // }) @PostMapping("/login") + @Transactional public ResponseEntity login( //@Validated @Valid diff --git a/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java b/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java index c0750a2..4f99056 100644 --- a/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java +++ b/src/main/java/com/xit/biz/ctgy/entity/MinUserinfo.java @@ -71,7 +71,7 @@ public class MinUserinfo implements Serializable { //@Transient //@JsonIgnore - @OneToMany(targetEntity = MinSimsaUser680.class, mappedBy = "minUserinfo")//, cascade = CascadeType.ALL, orphanRemoval = true) + @OneToMany(targetEntity = MinSimsaUser680.class, mappedBy = "minUserinfo") //, fetch = FetchType.EAGER)//, cascade = CascadeType.ALL, orphanRemoval = true) private final Set minSimsaUser680s = new HashSet<>(); public void addMinSimsaUser680(final MinSimsaUser680 minSimsaUser680){ diff --git a/src/main/java/com/xit/biz/ctgy/repository/IMinUserinfoRepository.java b/src/main/java/com/xit/biz/ctgy/repository/IMinUserinfoRepository.java index ce1798b..923ba00 100644 --- a/src/main/java/com/xit/biz/ctgy/repository/IMinUserinfoRepository.java +++ b/src/main/java/com/xit/biz/ctgy/repository/IMinUserinfoRepository.java @@ -1,9 +1,11 @@ package com.xit.biz.ctgy.repository; import com.xit.biz.ctgy.entity.MinUserinfo; +import com.xit.core.oauth2.utils.SecurityUtil; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import org.springframework.transaction.annotation.Transactional; import java.util.Optional; @@ -11,8 +13,11 @@ public interface IMinUserinfoRepository extends JpaRepository findByUserid(String userid); @Query(value = "SELECT TRAFFIC.ECL_ENCRYPT(?1) AS passwd FROM DUAL C", nativeQuery = true) + //@Query(value = "SELECT ECL_ENCRYPT(?1) AS passwd", nativeQuery = true) String queryGetPasswdEncode(@Param("passwd") String passwd); - @Query(value = "SELECT TRAFFIC.ECL_DECRYPT(MU.passwd) AS passwd FROM min_userinfo MU WHERE MU.userid = ?1", nativeQuery = true) + @Query(value = "SELECT ECL_DECRYPT(MU.passwd) AS passwd FROM min_userinfo MU WHERE MU.userid = ?1", nativeQuery = true) String queryGetPasswd(@Param("userid") String userid); + + MinUserinfo findMinUserinfoByUserid(String userid); } \ No newline at end of file diff --git a/src/main/java/com/xit/biz/ctgy/service/IMinUserinfoService.java b/src/main/java/com/xit/biz/ctgy/service/IMinUserinfoService.java index c376891..6c85f53 100644 --- a/src/main/java/com/xit/biz/ctgy/service/IMinUserinfoService.java +++ b/src/main/java/com/xit/biz/ctgy/service/IMinUserinfoService.java @@ -1,10 +1,15 @@ package com.xit.biz.ctgy.service; +import com.xit.biz.cmm.entity.CmmUser; import com.xit.biz.ctgy.entity.MinUserinfo; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import java.util.Optional; + public interface IMinUserinfoService { Page findMinUserinfos(MinUserinfo minUserinfo, Pageable pageable); + + MinUserinfo findMyUserWithoutAuthorities(); } diff --git a/src/main/java/com/xit/biz/ctgy/service/impl/MinUserinfoService.java b/src/main/java/com/xit/biz/ctgy/service/impl/MinUserinfoService.java index d3352ec..7936a80 100644 --- a/src/main/java/com/xit/biz/ctgy/service/impl/MinUserinfoService.java +++ b/src/main/java/com/xit/biz/ctgy/service/impl/MinUserinfoService.java @@ -1,8 +1,11 @@ package com.xit.biz.ctgy.service.impl; +import com.xit.biz.cmm.entity.CmmUser; import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.biz.ctgy.repository.IMinUserinfoRepository; import com.xit.biz.ctgy.service.IMinUserinfoService; +import com.xit.core.oauth2.utils.HeaderUtil; +import com.xit.core.oauth2.utils.SecurityUtil; import com.xit.core.support.jpa.JpaUtil; import org.springframework.data.domain.Example; import org.springframework.data.domain.ExampleMatcher; @@ -11,6 +14,8 @@ import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; + import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains; @Service @@ -34,4 +39,12 @@ public class MinUserinfoService implements IMinUserinfoService { // List userList = page.getContent(); return page; } + + @Override + @Transactional(readOnly = true) + public MinUserinfo findMyUserWithoutAuthorities() { + //cmmUserRepos + //return Optional.empty(); //cmmUserRepository.findOneWithAuthorities(SecurityUtil.getCurrentMemberId()); + return repository.findMinUserinfoByUserid(HeaderUtil.getUserId()); + } } diff --git a/src/main/java/com/xit/core/api/RestResponse.java b/src/main/java/com/xit/core/api/RestResponse.java index 124f226..cbe2047 100644 --- a/src/main/java/com/xit/core/api/RestResponse.java +++ b/src/main/java/com/xit/core/api/RestResponse.java @@ -63,7 +63,7 @@ public class RestResponse implements IRestResponse, Serializable { //noinspection unchecked this.data = (T) page.getContent(); - this.paginator = new Paginator(page.getNumber(), page.getSize(), Integer.parseInt(String.valueOf(page.getTotalElements())));// paginator.getTotalPages + this.paginator = new Paginator(page.getPageable().getPageNumber(), page.getSize(), Integer.parseInt(String.valueOf(page.getTotalElements())));// paginator.getTotalPages this.count = paginator.getTotalCount(); diff --git a/src/main/java/com/xit/core/config/database/DataSourceConfig.java b/src/main/java/com/xit/core/config/database/DataSourceConfig.java index 0de0069..9e439fc 100644 --- a/src/main/java/com/xit/core/config/database/DataSourceConfig.java +++ b/src/main/java/com/xit/core/config/database/DataSourceConfig.java @@ -1,5 +1,6 @@ package com.xit.core.config.database; +import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module; import com.xit.core.support.CamelCaseLinkedMap; import com.xit.core.support.CamelCaseMap; import com.xit.core.support.ObjectTypeHandler; @@ -128,6 +129,21 @@ public class DataSourceConfig { public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { return new PersistenceExceptionTranslationPostProcessor(); } + + /** + * 양방향 연관 관계에서 발생하는 영속성 문제 - failed to lazily initialize a collection of role could not initialize proxy 에러 + * 1) @OneToMay에 fetch = FetchType.EAGER : 성능 저하 + * 2) 호출하는 메소드에 @Transactinal 추가 + * 3) Hibernate5Module Bean 등록 + * @return + */ +// @Bean +// public Hibernate5Module hibernate5Module(){ +// Hibernate5Module hibernate5Module = new Hibernate5Module(); +// // 강제로 지연 로딩 사용 : 양방향 무한 로딩 발생 --> @JsonIgnore 추가로 처리 +// //hibernate5Module.configure(Hibernate5Module.Feature.FORCE_LAZY_LOADING, true); +// return hibernate5Module(); +// } ///////////////////////////////////////////////////////////////////////////////////// diff --git a/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java b/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java index 0f6bba0..10e26c3 100644 --- a/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java +++ b/src/main/java/com/xit/core/config/support/SpringDocApiConfig.java @@ -89,7 +89,8 @@ public class SpringDocApiConfig { return GroupedOpenApi.builder() .group("common-API") .pathsToMatch( - "/api/biz/cmm/**" + "/api/biz/cmm/**", + "/api/v1/biz/cmm/**" ) .pathsToExclude( "/api/biz/cmm/flux/**" diff --git a/src/main/java/com/xit/core/oauth2/api/dto/TokenDto.java b/src/main/java/com/xit/core/oauth2/api/dto/TokenDto.java index 2fd2be2..a1b7c6b 100644 --- a/src/main/java/com/xit/core/oauth2/api/dto/TokenDto.java +++ b/src/main/java/com/xit/core/oauth2/api/dto/TokenDto.java @@ -1,5 +1,6 @@ package com.xit.core.oauth2.api.dto; +import com.xit.biz.ctgy.entity.MinUserinfo; import com.xit.core.constant.XitConstants; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -23,4 +24,7 @@ public class TokenDto { @Schema(required = true, title = "Refresh token", example = " ", description = "Refresh token") private String refreshToken; + + @Schema(required = true, title = "User info", example = " ", description = "User info") + private MinUserinfo user; } diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index fe75f92..2ee9cbc 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -33,7 +33,7 @@ spring: # ================================================================================================================== jpa: database-platform: org.hibernate.dialect.Oracle10gDialect - #show-sql: false + show-sql: false properties: hibernate: hbm2ddl: diff --git a/src/main/resources/config/application-local.yml b/src/main/resources/config/application-local.yml index c60107d..67ed68f 100644 --- a/src/main/resources/config/application-local.yml +++ b/src/main/resources/config/application-local.yml @@ -8,18 +8,26 @@ spring: sql: init: mode: always - platform: h2 + platform: h2 #postgres #schema-locations: classpath:/data/h2/schema.sql - #data-locations: classpath:/data/h2/data.sql + #data-locations: + # - classpath:/data/h2/TRAFFIC_MIN_USERINFO.sql + # - classpath:/data/h2/TRAFFIC_MIN_SIMSA_USER680.sql # ================================================================================================================== # database setting # ================================================================================================================== datasource: +# driver-class-name: org.postgresql.Driver #org.h2.Driver +# url: jdbc:postgresql://localhost:5432/bustms +# username: traffic +# password: xhdgkq0 + driver-class-name: org.h2.Driver url: jdbc:h2:mem:xitdb;MODE=Oracle;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE username: sa password: '' + hikari: driver-class-name: ${spring.datasource.driver-class-name} jdbc-url: ${spring.datasource.url} @@ -31,13 +39,12 @@ spring: # JPA setting # ================================================================================================================== jpa: - database-platform: org.hibernate.dialect.H2Dialect + database-platform: org.hibernate.dialect.PostgreSQLDialect #show-sql: false properties: hibernate: hbm2ddl: # create / create-drop / update / validate / none -# auto: create-drop auto: create-drop h2: diff --git a/src/main/resources/data/h2/mm_maincode_mig.sql b/src/main/resources/data/h2/mm_maincode_mig.sql new file mode 100644 index 0000000..6214028 --- /dev/null +++ b/src/main/resources/data/h2/mm_maincode_mig.sql @@ -0,0 +1,23 @@ +select * from MIN_MAINCODE order by c1, c2, c3; + +insert into TB_CMM_CODE_S( + code_grp_id, + CODE_LCD, + CODE_MCD, + CODE_CD, + CODE_NM, + CODE_META_1, + CODE_META_2, + CODE_META_3 +) +select 'traffic', + c1, + c2, + c3, + cdname, + etc1, + etc2, + ETC3 +from MIN_MAINCODE +order by c1, c2, c3; +commit; \ No newline at end of file diff --git a/src/main/resources/data/h2/schema.sql b/src/main/resources/data/h2/schema.sql index 6f34d69..e7026eb 100644 --- a/src/main/resources/data/h2/schema.sql +++ b/src/main/resources/data/h2/schema.sql @@ -1,69 +1,1298 @@ --- DROP TABLE IF EXISTS user; --- CREATE TABLE user( --- id INT PRIMARY KEY, --- email VARCHAR(30), --- name VARCHAR(30), --- tel VARCHAR(30) --- ); --- DROP TABLE IF EXISTS product; --- CREATE TABLE product ( --- no VARCHAR(5), --- name VARCHAR(50) --- ); - -drop table if exists tb_cmm_board CASCADE; -drop table if exists tb_cmm_role CASCADE; -drop table if exists tb_cmm_user CASCADE; -drop table if exists tb_cmm_user_role CASCADE; - -create table tb_cmm_board +create table MIN_CIV_BOARD680 ( - board_id bigint generated by default as identity, - content TEXT not null, - ins_dt_tm timestamp, - ins_user_id varchar(255), - title varchar(500) not null, - upd_dt_tm timestamp, - upd_user_id varchar(255), - primary key (board_id) + CI_CODE int8 not null, + CI_CONTENTNO int8, + CI_TITLE varchar(40), + CI_ID varchar(10), + CI_PWD varchar(10), + CI_NAME varchar(20), + CI_NALJA varchar(10), + CI_TIME varchar(8), + CI_HIT int8, + CI_REF int8, + CI_STEP int8, + CI_REVEL int8, + CI_PASS varchar(24), + CI_EMAIL varchar(40), + CI_CONTENTS varchar(4000), + CI_IP varchar(15) ); +comment on table MIN_CIV_BOARD680 is '게시판'; -create table tb_cmm_role +comment on column MIN_CIV_BOARD680.CI_CODE is '게시판코드'; + + +comment on column MIN_CIV_BOARD680.CI_CONTENTNO is '글번호'; + + +comment on column MIN_CIV_BOARD680.CI_TITLE is '제목'; + + +comment on column MIN_CIV_BOARD680.CI_ID is '사용자아이디'; + + +comment on column MIN_CIV_BOARD680.CI_PWD is '사용자패스워드'; + + +comment on column MIN_CIV_BOARD680.CI_NAME is '사용자성명'; + + +comment on column MIN_CIV_BOARD680.CI_NALJA is '등록일자'; + + +comment on column MIN_CIV_BOARD680.CI_TIME is '등록시간'; + + +comment on column MIN_CIV_BOARD680.CI_HIT is '조회수'; + + +comment on column MIN_CIV_BOARD680.CI_REF is 'REF'; + + +comment on column MIN_CIV_BOARD680.CI_STEP is 'STEP'; + + +comment on column MIN_CIV_BOARD680.CI_REVEL is 'LEVEL'; + + +comment on column MIN_CIV_BOARD680.CI_PASS is '패스워드'; + + +comment on column MIN_CIV_BOARD680.CI_EMAIL is '이메일'; + + +comment on column MIN_CIV_BOARD680.CI_CONTENTS is '내용'; + + +comment on column MIN_CIV_BOARD680.CI_IP is 'IP'; + + +create table MIN_INFO_BOARD680 +( + IN_CODE int8 not null, + IN_BGUBUN varchar(1), + IN_NALJA varchar(10), + IN_TIME varchar(8), + IN_NAME varchar(30), + IN_DEPT varchar(40), + IN_CONTENTNO int8, + IN_TITLE varchar(60), + IN_CONTENTS varchar(4000), + IN_HIT int8 default 0, + IN_FILENAME varchar(40), + IN_FILESIZE int8, + IN_FILEURL varchar(60), + IN_ETC varchar(50) +); + + +comment on table MIN_INFO_BOARD680 is '공지사항'; + + +comment on column MIN_INFO_BOARD680.IN_CODE is '공지사항코드'; + + +comment on column MIN_INFO_BOARD680.IN_BGUBUN is '공지사항구분'; + + +comment on column MIN_INFO_BOARD680.IN_NALJA is '날짜'; + + +comment on column MIN_INFO_BOARD680.IN_TIME is '시간'; + + +comment on column MIN_INFO_BOARD680.IN_NAME is '성명'; + + +comment on column MIN_INFO_BOARD680.IN_DEPT is '부서'; + + +comment on column MIN_INFO_BOARD680.IN_CONTENTNO is '글번호'; + + +comment on column MIN_INFO_BOARD680.IN_TITLE is '제목'; + + +comment on column MIN_INFO_BOARD680.IN_CONTENTS is '내용'; + + +comment on column MIN_INFO_BOARD680.IN_HIT is '조회수'; + + +comment on column MIN_INFO_BOARD680.IN_FILENAME is '파일명'; + + +comment on column MIN_INFO_BOARD680.IN_FILESIZE is '파일사이즈'; + + +comment on column MIN_INFO_BOARD680.IN_FILEURL is '파일URL'; + + +comment on column MIN_INFO_BOARD680.IN_ETC is '기타'; + + +create table MIN_MAINCODE +( + C1 varchar(3) not null, + C2 varchar(3) not null, + C3 varchar(3) default NULL, + CDNAME varchar(50), + ETC1 varchar(20), + ETC2 varchar(20), + ETC3 varchar(20) +); + + +comment on table MIN_MAINCODE is '코드'; + + +comment on column MIN_MAINCODE.C1 is '코드1'; + + +comment on column MIN_MAINCODE.C2 is '코드2'; + + +comment on column MIN_MAINCODE.C3 is '코드3'; + + +comment on column MIN_MAINCODE.CDNAME is '코드명'; + + +comment on column MIN_MAINCODE.ETC1 is '기타1'; + + +comment on column MIN_MAINCODE.ETC2 is '기타2'; + + +comment on column MIN_MAINCODE.ETC3 is '기타3'; + + +create table MIN_SIMSA_USER680 +( + MSU_CODE int8 not null, + MSU_MAINCODE int8 not null, + MSU_USERID varchar(20) not null, + MSU_RESULT varchar(1) default 0, + MSU_REASON varchar(4000), + MSU_TEAM varchar(3) not null, + MSU_INDATE DATE default null +); + + +comment on table MIN_SIMSA_USER680 is '민원심사사용자매핑'; + + +comment on column MIN_SIMSA_USER680.MSU_CODE is '민원심사사용자매핑코드'; + + +comment on column MIN_SIMSA_USER680.MSU_MAINCODE is '민원코드'; + + +comment on column MIN_SIMSA_USER680.MSU_USERID is '민원심사사용자코드'; + + +comment on column MIN_SIMSA_USER680.MSU_RESULT is '결과코드'; + + +comment on column MIN_SIMSA_USER680.MSU_REASON is '사유'; + + +comment on column MIN_SIMSA_USER680.MSU_TEAM is '팀코드'; + + +comment on column MIN_SIMSA_USER680.MSU_INDATE is '입력일시'; + + +create table MIN_SIMSA680 +( + MS_MAINCODE int8 not null, + MS_SEQ varchar(10) not null, + MS_CARNUM varchar(20) not null, + MS_YEAR varchar(4) not null, + MS_CHASU int8 not null, + MS_SDATE DATE not null, + MS_STARTSI varchar(2) not null, + MS_EDATE DATE not null, + MS_CDATE DATE not null, + MS_CLOSESI varchar(2) not null, + MS_WDATE DATE, + MS_POS varchar(100), + MS_RESULT varchar(1) default 0, + MS_JBTIME varchar(4) default 0000 +); + + +comment on table MIN_SIMSA680 is '민원심사'; + + +comment on column MIN_SIMSA680.MS_MAINCODE is '민원코드'; + + +comment on column MIN_SIMSA680.MS_SEQ is '접수번호'; + + +comment on column MIN_SIMSA680.MS_CARNUM is '차량번호'; + + +comment on column MIN_SIMSA680.MS_YEAR is '년도'; + + +comment on column MIN_SIMSA680.MS_CHASU is '차수'; + + +comment on column MIN_SIMSA680.MS_SDATE is '심사시작일시'; + + +comment on column MIN_SIMSA680.MS_STARTSI is '심사시작시간'; + + +comment on column MIN_SIMSA680.MS_EDATE is '심사종료일시'; + + +comment on column MIN_SIMSA680.MS_CDATE is '심사마감일시'; + + +comment on column MIN_SIMSA680.MS_CLOSESI is '심사마감시간'; + + +comment on column MIN_SIMSA680.MS_WDATE is '단속일자'; + + +comment on column MIN_SIMSA680.MS_POS is '단속장소'; + + +comment on column MIN_SIMSA680.MS_RESULT is '결과코드'; + + +comment on column MIN_SIMSA680.MS_JBTIME is '단속시간'; + + +create table MIN_USERINFO +( + USERID varchar(20) not null, + PASSWD varchar(48) not null, + NAME varchar(100) not null, + REGNUM varchar(20), + MPHONE varchar(20), + EMAIL varchar(50), + ACCESSTYPE varchar(3) default 002 not null, + TEAM varchar(3) default 000 not null, + REGDATE DATE, + ISENABLE varchar(3) default 1, + GU varchar(3) +); + + +comment on column MIN_USERINFO.USERID is '민원심사사용자코드'; + + +comment on column MIN_USERINFO.PASSWD is '사용자암호'; + + +comment on column MIN_USERINFO.NAME is '사용자성명'; + + +comment on column MIN_USERINFO.REGNUM is '사용자주민번호'; + + +comment on column MIN_USERINFO.MPHONE is '전화번호'; + + +comment on column MIN_USERINFO.EMAIL is '이메일'; + + +comment on column MIN_USERINFO.ACCESSTYPE is '사용구분'; + + +comment on column MIN_USERINFO.TEAM is '단속조'; + + +comment on column MIN_USERINFO.REGDATE is '등록일시'; + + +comment on column MIN_USERINFO.ISENABLE is '사용여부'; + + +comment on column MIN_USERINFO.GU is '구청코드'; + + +create table TF680_JUCHA +( + MJ_CODE int8 not null + constraint TF680_JUCHA_PK + primary key, + MJ_CARGUBUN varchar(1), + MJ_CARK varchar(1), + MJ_JBTIME varchar(4), + MJ_TIMEOVER varchar(1) + constraint TF680_JUCHA_MJ_TIMEOVER + check (MJ_TIMEOVER >= '0' AND MJ_TIMEOVER <= '9'), + MJ_VIOR varchar(3) not null, + MJ_LAW varchar(1), + MJ_POS varchar(60), + MJ_TRAC varchar(1) + constraint TF680_JUCHA_MJ_TRAC + check (MJ_TRAC IS NOT NULL AND MJ_TRAC <> '' AND + (MJ_TRAC = '0' OR MJ_TRAC = '1' OR MJ_TRAC = '2' OR MJ_TRAC = '3')), + MJ_GPS_X varchar(10), + MJ_GPS_Y varchar(10), + MJ_IMGCNT int, + MJ_CARID varchar(100), + MJ_FRMNO varchar(19), + MJ_SNO varchar(20), + MJ_TEAM int, + MJ_DONG int, + MJ_TEAMID varchar(20), + MJ_TEAMER1 varchar(8), + MJ_TEAMER2 varchar(8), + MJ_TEAMER3 varchar(8), + MJ_TEAMER4 varchar(8), + MJ_SCHOOLZONE_YN varchar(1), + MJ_SPECIALAREA varchar(2), + MJ_JBSTIME varchar(6) default 0, + MJ_JBETIME varchar(6) default 0 +); + + +comment on table TF680_JUCHA is '주정차위반이력'; + + +comment on column TF680_JUCHA.MJ_CODE is '메인코드'; + + +comment on column TF680_JUCHA.MJ_CARGUBUN is '차량구분(0:기타,1:일반,2:중기,3:임시,4:외교,5:영사,6:준영,7:미군,8:국제,9:준외)'; + + +comment on column TF680_JUCHA.MJ_CARK is '차종 1=승용 2=승합 3=화물4톤이하 4=화물4톤초과 5=특수 6=이륜 7=기타'; + + +comment on column TF680_JUCHA.MJ_JBTIME is '위반시각'; + + +comment on column TF680_JUCHA.MJ_TIMEOVER is '초과시간'; + + +comment on column TF680_JUCHA.MJ_VIOR is '위반내용'; + + +comment on column TF680_JUCHA.MJ_LAW is '위반법규'; + + +comment on column TF680_JUCHA.MJ_POS is '위반장소'; + + +comment on column TF680_JUCHA.MJ_TRAC is '견인여부 0=미견인 1=견인'; + + +comment on column TF680_JUCHA.MJ_GPS_X is 'GPS X좌표'; + + +comment on column TF680_JUCHA.MJ_GPS_Y is 'GPS Y좌표'; + + +comment on column TF680_JUCHA.MJ_IMGCNT is '사진매수'; + + +comment on column TF680_JUCHA.MJ_CARID is '차명'; + + +comment on column TF680_JUCHA.MJ_FRMNO is '차대번호'; + + +comment on column TF680_JUCHA.MJ_SNO is '스티커번호'; + + +comment on column TF680_JUCHA.MJ_TEAM is '적발조코드'; + + +comment on column TF680_JUCHA.MJ_DONG is '관할동'; + + +comment on column TF680_JUCHA.MJ_TEAMID is '적발조명'; + + +comment on column TF680_JUCHA.MJ_TEAMER1 is '적발조원1'; + + +comment on column TF680_JUCHA.MJ_TEAMER2 is '적발조원2'; + + +comment on column TF680_JUCHA.MJ_TEAMER3 is '적발조원3'; + + +comment on column TF680_JUCHA.MJ_TEAMER4 is '적발조원4'; + + +comment on column TF680_JUCHA.MJ_SCHOOLZONE_YN is '어린이보호구역'; + + +comment on column TF680_JUCHA.MJ_SPECIALAREA is '특별구역 1=어린이보호구역 2=자전거전용도로 3=노인보호구역 4=장애인보호구역'; + + +comment on column TF680_JUCHA.MJ_JBSTIME is '단속시작시간 고정형CCTV의 경우 촬영시작시간'; + + +comment on column TF680_JUCHA.MJ_JBETIME is '단속종료시간 고정형CCTV의 경우 촬용종료시간'; + + +create index TF680_JUCHA_SNO + on TF680_JUCHA (MJ_SNO); + + +create index TF680_JUCHA_TEAM + on TF680_JUCHA (MJ_TEAM, MJ_JBTIME); + + +create table TF680_MAIN +( + MM_CODE int8 not null + constraint TF680_MAIN_PK + primary key, + MM_DBGB varchar(3), + MM_INGB1 varchar(2), + MM_INGB2 varchar(2), + MM_SGGCODE varchar(5), + MM_WDATE varchar(8), + MM_OCARNO varchar(20) + constraint TF680_MAIN_OCARNO + check (POSITION(' ' in MM_OCARNO) = 0), + MM_NCARNO varchar(20) + constraint TF680_MAIN_NCARNO + check (POSITION(' ' in MM_NCARNO) = 0), + MM_KEUM int8 + constraint TF680_MAIN_KEUM + check (MM_KEUM IS NOT NULL AND MM_KEUM <> 0 AND CAST(MM_KEUM as int8) >= 10 AND + CAST(MM_KEUM as int8) <= 9999999999), + MM_AKEUM int8 + constraint TF680_MAIN_AKEUM + check (MM_AKEUM IS NOT NULL AND MM_AKEUM <> 0 AND MM_AKEUM = '0'), + MM_MKEUM int8 + constraint TF680_MAIN_MKEUM + check (MM_MKEUM IS NOT NULL AND MM_MKEUM <> 0 AND MM_MKEUM = '0'), + MM_SKEUM int8 + constraint TF680_MAIN_SKEUM + check (MM_SKEUM IS NOT NULL AND MM_SKEUM <> 0 AND cast(MM_SKEUM as int8) >= 0 AND + cast(MM_SKEUM as int8) <= 9999999999), + MM_GODATE varchar(8) + constraint TF680_MAIN_GODATE + check (MM_GODATE IS NOT NULL AND MM_GODATE <> '' AND cast(MM_GODATE as int8) >= 0 AND + cast(MM_GODATE as int) <= 99999999), + MM_GOLDATE varchar(8) + constraint TF680_MAIN_GOLDATE + check (MM_GOLDATE IS NOT NULL AND MM_GOLDATE <> '' AND cast(MM_GOLDATE as int) >= 0 AND + cast(MM_GOLDATE as int) <= 99999999), + MM_GOJIYM varchar(6) default '0' + constraint TF680_MAIN_GOJIYM + check (MM_GOJIYM IS NOT NULL AND MM_GOJIYM <> '' AND cast(MM_GOJIYM as int) >= 0 AND + cast(MM_GOJIYM as int) <= 999999), + MM_GOJINO varchar(6) default '0', + MM_HGCODE varchar(8), + MM_HDCODE varchar(3), + MM_SPGUBUN varchar(1), + MM_DCDATE varchar(8) + constraint TF680_MAIN_DCDATE + check (MM_DCDATE IS NOT NULL AND MM_DCDATE <> '' AND CAST(MM_DCDATE as int) >= 0 AND + CAST(MM_DCDATE as int) <= 99999999), + MM_DCLDATE varchar(8), + MM_PSDATE varchar(8) + constraint TF680_MAIN_PSDATE + check (MM_PSDATE IS NOT NULL AND MM_PSDATE <> '' AND CAST(MM_PSDATE as int) >= 0 AND + CAST(MM_PSDATE as int) <= 99999999), + MM_PSLDATE varchar(8), + MM_SDATE varchar(8) + constraint TF680_MAIN_SDATE + check (MM_SDATE IS NOT NULL AND MM_SDATE <> '' AND CAST(MM_SDATE as int) >= 0 AND + CAST(MM_SDATE as int) <= 99999999), + MM_SUGUBUN varchar(1) + constraint TF680_MAIN_SUGUBUN + check (MM_SUGUBUN IS NOT NULL AND MM_SUGUBUN <> '' AND MM_SUGUBUN BETWEEN '0' AND '2'), + MM_SUDATE varchar(8), + MM_SODATE varchar(8), + MM_HJDATE varchar(8), + MM_DNDATE varchar(8), + MM_LDATE varchar(8), + MM_LSTATE int + constraint TF680_MAIN_LSTATE + check (MM_LSTATE IS NOT NULL AND MM_LSTATE <> 0 AND MM_LSTATE BETWEEN '10' AND '99'), + MM_ADDATE varchar(8), + MM_ADUSER varchar(5), + MM_EDDATE varchar(8), + MM_EDUSER varchar(5), + MM_BUNNAP varchar(1) default 0 + constraint TF680_MAIN_BUNNAP + check (MM_BUNNAP IS NOT NULL AND MM_BUNNAP <> '' AND MM_BUNNAP = '0'), + MM_MODCODE varchar(3), + MM_CMCODE_OLD int8, + MM_DNWORKDATE DATE, + MM_SLF_MMCODE int8, + MM_SLF_GUBUN varchar(1), + MM_GOJIGUBUN CHAR default '3' not null + constraint TF680_MAIN_GOJIGUBUN + check (MM_GOJIGUBUN IS NOT NULL AND MM_GOJIGUBUN <> '' AND MM_GOJIGUBUN BETWEEN '0' AND '3'), + MM_ORG_AMT int8 + constraint TF680_MAIN_ORG_AMT + check (MM_ORG_AMT IS NOT NULL AND MM_ORG_AMT <> 0 AND CAST(MM_ORG_AMT as int8) >= 10 AND + CAST(MM_ORG_AMT as int8) <= 9999999999), + MM_BLC_AMT int8 + constraint TF680_MAIN_BLC_AMT + check (MM_BLC_AMT IS NOT NULL AND MM_BLC_AMT <> 0 AND CAST(MM_BLC_AMT as int8) >= 0 AND + CAST(MM_BLC_AMT as int8) <= 9999999999), + MM_FFD_AMT int8 + constraint TF680_MAIN_FFD_AMT + check (MM_FFD_AMT IS NOT NULL AND MM_FFD_AMT <> 0 AND CAST(MM_FFD_AMT as int8) >= 0 AND + CAST(MM_FFD_AMT as int8) <= 9999999999), + MM_TWO_FFD_AMT int8 + constraint TF680_MAIN_TWO_FFD_AMT + check (MM_TWO_FFD_AMT IS NOT NULL AND MM_TWO_FFD_AMT <> 0 AND CAST(MM_TWO_FFD_AMT as int8) >= 0 AND + CAST(MM_TWO_FFD_AMT as int8) <= 9999999999), + MM_RP_CTX_AMT int8 + constraint TF680_MAIN_RP_CTX_AMT + check (MM_RP_CTX_AMT IS NOT NULL AND MM_RP_CTX_AMT <> 0 AND CAST(MM_RP_CTX_AMT as int8) >= 0 AND + CAST(MM_RP_CTX_AMT as int8) <= 9999999999), + MM_RP_FFD_AMT int8 + constraint TF680_MAIN_RP_FFD_AMT + check (MM_RP_FFD_AMT IS NOT NULL AND MM_RP_FFD_AMT <> 0 AND CAST(MM_RP_FFD_AMT as int8) >= 0 AND + CAST(MM_RP_FFD_AMT as int8) <= 9999999999), + MM_RP_TWO_FFD_AMT int8 + constraint TF680_MAIN_RP_TWO_FFD_AMT + check (MM_RP_TWO_FFD_AMT IS NOT NULL AND MM_RP_TWO_FFD_AMT <> 0 AND CAST(MM_RP_TWO_FFD_AMT as int8) >= 0 AND + CAST(MM_RP_TWO_FFD_AMT as int8) <= 9999999999), + MM_RD_CTX_AMT int8 + constraint TF680_MAIN_RD_CTX_AMT + check (MM_RD_CTX_AMT IS NOT NULL AND MM_RD_CTX_AMT <> 0 AND CAST(MM_RD_CTX_AMT as int8) >= 0 AND + CAST(MM_RD_CTX_AMT as int8) <= 9999999999), + MM_RD_FFD_AMT int8 + constraint TF680_MAIN_RD_FFD_AMT + check (MM_RD_FFD_AMT IS NOT NULL AND MM_RD_FFD_AMT <> 0 AND CAST(MM_RD_FFD_AMT as int8) >= 0 AND + CAST(MM_RD_FFD_AMT as int8) <= 9999999999), + MM_RD_TWO_FFD_AMT int8 + constraint TF680_MAIN_RD_TWO_FFD_AMT + check (MM_RD_TWO_FFD_AMT IS NOT NULL AND MM_RD_TWO_FFD_AMT <> 0 AND CAST(MM_RD_TWO_FFD_AMT as int8) >= 0 AND + CAST(MM_RD_TWO_FFD_AMT as int8) <= 9999999999), + MM_GOLDATE_MAIN varchar(8) + constraint TF680_MAIN_GOLDATE_MAIN + check (MM_GOLDATE_MAIN IS NOT NULL AND MM_GOLDATE_MAIN <> '' AND CAST(MM_GOLDATE_MAIN as int) >= 0 AND + CAST(MM_GOLDATE_MAIN as int) <= 99999999), + MM_PHOTOCODE int8, + MM_REBUGWAGB varchar(1) default NULL, + MM_JUMINDATE varchar(8), + MM_BS_GSGIHANDATE_MAX varchar(8), + MM_BS_NOTHANDLING_Y varchar(1), + MM_GO_NOTHANDLING_Y varchar(1), + MM_ODCO_CODE varchar(10), + MM_CMCODE int8, + LEVDECSN_DE varchar(8), + RCIV_DE_EO_A varchar(8), + RCIV_DE_SB_A varchar(8), + RCIV_DE_PO_A varchar(8), + RCIV_DE_SB_C varchar(8), + RCIV_DE_PO_C varchar(8), + VIRTLACNUTNO_W varchar(14), + VIRTLACNUTNO_S varchar(14), + VIRTLACNUTNO_H varchar(14), + VIRTLACNUTNO_K varchar(14), + VIRTLACNUTNO_I varchar(14), + VIRTLACNUTNO_P varchar(14), + VIRTLACNUTNO_E varchar(14), + VIRTLACNUTNO_C varchar(14), + VIRTLACNUTNO_N varchar(14), + VIRTLACNUTNO_F varchar(14), + constraint TF680_MAIN_GOJINO + check (MM_GOJINO IS NOT NULL AND MM_GOJIYM <> '' AND CAST(MM_GOJINO as int) >= 0 AND + CAST(MM_GOJINO as int) <= 999999) +); + + +comment on table TF680_MAIN is '메인'; + + +comment on column TF680_MAIN.MM_CODE is '메인코드'; + + +comment on column TF680_MAIN.MM_DBGB is '과태료코드'; + + +comment on column TF680_MAIN.MM_INGB1 is '입력구분 1=구청 6=시청 11=시민'; + + +comment on column TF680_MAIN.MM_INGB2 is '단속구분 1=일반 3=기동 4=디카 5=CCTV 6=무인 7=PDA 8=고정형CCTV 9=주행형CCTV 10=버스장착형CCTV 11=시민신고웹'; + + +comment on column TF680_MAIN.MM_SGGCODE is '시군구코드'; + + +comment on column TF680_MAIN.MM_WDATE is '단속일자'; + + +comment on column TF680_MAIN.MM_OCARNO is '최초차량번호'; + + +comment on column TF680_MAIN.MM_NCARNO is '최종차량번호'; + + +comment on column TF680_MAIN.MM_KEUM is '본세'; + + +comment on column TF680_MAIN.MM_AKEUM is '사용안함'; + + +comment on column TF680_MAIN.MM_MKEUM is '사용안함'; + + +comment on column TF680_MAIN.MM_SKEUM is '사용안함'; + + +comment on column TF680_MAIN.MM_GODATE is '부과일자'; + + +comment on column TF680_MAIN.MM_GOLDATE is '부과납기'; + + +comment on column TF680_MAIN.MM_GOJIYM is '고지년월'; + + +comment on column TF680_MAIN.MM_GOJINO is '고지일련번호'; + + +comment on column TF680_MAIN.MM_HGCODE is '회계코드'; + + +comment on column TF680_MAIN.MM_HDCODE is '부서코드'; + + +comment on column TF680_MAIN.MM_SPGUBUN is '사용안함'; + + +comment on column TF680_MAIN.MM_DCDATE is '독촉일자'; + + +comment on column TF680_MAIN.MM_DCLDATE is '독촉납기'; + + +comment on column TF680_MAIN.MM_PSDATE is '압류예정일자'; + + +comment on column TF680_MAIN.MM_PSLDATE is '압류예정납기'; + + +comment on column TF680_MAIN.MM_SDATE is '압류일자'; + + +comment on column TF680_MAIN.MM_SUGUBUN is '사용안함'; + + +comment on column TF680_MAIN.MM_SUDATE is '수납일자'; + + +comment on column TF680_MAIN.MM_SODATE is '소인처리일자'; + + +comment on column TF680_MAIN.MM_HJDATE is '압류해제일자'; + + +comment on column TF680_MAIN.MM_DNDATE is '대납일자'; + + +comment on column TF680_MAIN.MM_LDATE is '처리일자'; + + +comment on column TF680_MAIN.MM_LSTATE is '10:단속,11:부과,12:독촉,13:압류예정,21:압류,49:대납,51:자납,52:수시분수납,53:독촉분수납,54:압류예정분수납,55:압류해제수납,61:시효결손취소수납,62:불납결손취소수납,65:충당수납,71:서손,72:의견진술수용,73:이의신청수용,74:부과취소,75:자납고지부과등록,81:시효결손,82:불납결손,91:법원이송,92:경찰서이첩,98:면제차량,99:삭제자료)'; + + +comment on column TF680_MAIN.MM_ADDATE is '입력일자'; + + +comment on column TF680_MAIN.MM_ADUSER is '입력자코드'; + + +comment on column TF680_MAIN.MM_EDDATE is '수정일자'; + + +comment on column TF680_MAIN.MM_EDUSER is '수정자코드'; + + +comment on column TF680_MAIN.MM_BUNNAP is '분납상태코드 0=분납미등록 1=분납등록 2=분납완료'; + + +comment on column TF680_MAIN.MM_MODCODE is '감액코드'; + + +comment on column TF680_MAIN.MM_CMCODE_OLD is '차적코드'; + + +comment on column TF680_MAIN.MM_DNWORKDATE is '대납작업일자'; + + +comment on column TF680_MAIN.MM_SLF_MMCODE is '자납고지부과등록메인코드'; + + +comment on column TF680_MAIN.MM_SLF_GUBUN is '자납고지부과등록여부'; + + +comment on column TF680_MAIN.MM_GOJIGUBUN is '고지구분 1=정기분 2=수시분 3=자납분'; + + +comment on column TF680_MAIN.MM_ORG_AMT is '단속원금'; + + +comment on column TF680_MAIN.MM_BLC_AMT is '잔액'; + + +comment on column TF680_MAIN.MM_FFD_AMT is '즉일가산금'; + + +comment on column TF680_MAIN.MM_TWO_FFD_AMT is '중가산금'; + + +comment on column TF680_MAIN.MM_RP_CTX_AMT is '수납본세'; + + +comment on column TF680_MAIN.MM_RP_FFD_AMT is '수납즉일가산금'; + + +comment on column TF680_MAIN.MM_RP_TWO_FFD_AMT is '수납중가산금'; + + +comment on column TF680_MAIN.MM_RD_CTX_AMT is '감액본세'; + + +comment on column TF680_MAIN.MM_RD_FFD_AMT is '감액즉일가산금'; + + +comment on column TF680_MAIN.MM_RD_TWO_FFD_AMT is '감액중가산금'; + + +comment on column TF680_MAIN.MM_GOLDATE_MAIN is '부과납기_원납기'; + + +comment on column TF680_MAIN.MM_PHOTOCODE is '사진코드 재판독처리자료의 경우 원본의 사진을 찾는 메인코드'; + + +comment on column TF680_MAIN.MM_REBUGWAGB is '재부과여부 1=서손재부과 2=부과취소재부과 3=법원이송재부과'; + + +comment on column TF680_MAIN.MM_JUMINDATE is '주민망갱신일자'; + + +comment on column TF680_MAIN.MM_BS_GSGIHANDATE_MAX is '공시송달공고기한_최대값'; + + +comment on column TF680_MAIN.MM_BS_NOTHANDLING_Y is '반송미처리여부 Y=예 NULL=아니오'; + + +comment on column TF680_MAIN.MM_GO_NOTHANDLING_Y is '과오납미처리여부 Y=예 NULL=아니오'; + + +create index TF680_MAIN_CMCODE_OLD + on TF680_MAIN (MM_CMCODE_OLD); + + +create index TF680_MAIN_INX01 + on TF680_MAIN (MM_CODE, MM_CMCODE_OLD, MM_DBGB, MM_LSTATE, MM_BLC_AMT, MM_ORG_AMT, MM_WDATE, MM_NCARNO); + + +create index TF680_MAIN_IE02 + on TF680_MAIN (MM_WDATE, MM_LSTATE, MM_REBUGWAGB, MM_CODE, MM_SGGCODE, MM_DBGB, MM_INGB1, MM_INGB2, MM_KEUM, + MM_FFD_AMT, MM_TWO_FFD_AMT, MM_RP_CTX_AMT, MM_RP_FFD_AMT, MM_RP_TWO_FFD_AMT, MM_RD_CTX_AMT, + MM_RD_FFD_AMT, MM_RD_TWO_FFD_AMT, MM_BLC_AMT); + + +create index TF680_MAIN_GASANKEUM + on TF680_MAIN (MM_WDATE, MM_GOJIYM, MM_GOLDATE, MM_LSTATE, MM_BLC_AMT, MM_SGGCODE, MM_DBGB, MM_CODE); + + +create index TF680_MAIN_CMCODE_LSTATE + on TF680_MAIN (MM_CMCODE, MM_LSTATE, MM_DBGB, MM_SGGCODE); + + +create index TF680_MAIN_OCARNO + on TF680_MAIN (MM_OCARNO); + + +create index TF680_MAIN_NCARNO + on TF680_MAIN (MM_NCARNO); + + +create index TF680_MAIN_WDATE + on TF680_MAIN (MM_WDATE); + + +create index TF680_MAIN_GOJIYM + on TF680_MAIN (MM_GOJIYM, MM_GOJINO); + + +create index TF680_MAIN_SODATE + on TF680_MAIN (MM_SODATE); + + +create index TF680_MAIN_IDX10 + on TF680_MAIN (MM_SUDATE); + + +create index TF680_MAIN_ADDATE + on TF680_MAIN (MM_ADDATE); + + +create index TF680_MAIN_GOLDATE + on TF680_MAIN (MM_GOLDATE); + + +create index TF680_MAIN_IE01 + on TF680_MAIN (MM_CMCODE, MM_DBGB, MM_SGGCODE, MM_LSTATE, MM_BLC_AMT); + + +create index TF680_MAIN_GODATE + on TF680_MAIN (MM_GODATE); + + +create index TF680_MAIN_EDDATE + on TF680_MAIN (MM_EDDATE, MM_LSTATE, MM_DBGB); + + +create index TF680_MAIN_LDATE + on TF680_MAIN (MM_LDATE); + + +create index TF680_MAIN_SUDATE + on TF680_MAIN (MM_SUDATE, MM_LSTATE); + + +create index TF680_MAIN_GOJINO + on TF680_MAIN (MM_GOJINO, MM_GOJIYM); + + +create index TF680_MAIN_BUGWAJINGSUCHENAP + on TF680_MAIN (MM_GOJIYM, MM_LSTATE, MM_SGGCODE, MM_DBGB, MM_CODE, MM_KEUM, MM_FFD_AMT, MM_TWO_FFD_AMT, + MM_RP_CTX_AMT, MM_RP_FFD_AMT, MM_RP_TWO_FFD_AMT, MM_RD_CTX_AMT, MM_RD_FFD_AMT, MM_RD_TWO_FFD_AMT, + MM_BLC_AMT); + + +create index TF680_MAIN_SDATE + on TF680_MAIN (MM_SDATE); + + +create index TF680_MAIN_SLF_MMCODE + on TF680_MAIN (MM_SLF_MMCODE); + + +create index TF680_MAIN_DNDATE + on TF680_MAIN (MM_DNDATE, MM_LSTATE, MM_DBGB); + + +create table TF680_RECALL +( + RC_CODE int8 not null + constraint TF680_RECALL_PK + primary key, + RC_MAINCODE int8, + RC_GB varchar(1), + RC_INGB varchar(1), + RC_USER varchar(5), + RC_DATE varchar(8), + RC_SEQ varchar(10), + RC_NAME varchar(50) + constraint TF680_RECALL_NAME + check (POSITION(' ' in RC_NAME) = 0), + RC_JNO varchar(24), + RC_JUSO varchar(99), + RC_BUNJI varchar(99), + RC_ZIP varchar(6), + RC_TEL varchar(15), + RC_PHONE varchar(15), + RC_FAX varchar(15), + RC_EMAIL varchar(40), + RC_REL varchar(20), + RC_CONT_DOC varchar(2) + constraint TF680_RECALL_CONT_DOC + check (RC_CONT_DOC IS NOT NULL AND RC_CONT_DOC <> '' AND RC_CONT_DOC BETWEEN '1' AND '22'), + RC_CONT int8, + RC_CONT_ADD1 varchar(100), + RC_CONT_ADD2 varchar(100), + RC_ANSWER_CAUSE varchar(4000), + RC_ANSWER varchar(4000), + RC_URL varchar(50), + RC_FILENM varchar(40), + RC_FILESIZE int, + RC_PWD varchar(50), + RC_CHECK varchar(1), + RC_DISPGB varchar(1) + constraint TF680_RECALL_DISPGB + check (RC_DISPGB IS NOT NULL AND RC_DISPGB <> '' AND RC_DISPGB BETWEEN '1' AND '5'), + RC_STATE varchar(1), + RC_ENDDATE varchar(8), + RC_BIGO1 varchar(50), + RC_BIGO2 varchar(50), + RC_STATE_USERNAME varchar(50), + RC_SC_CODE int8 default 0, + RC_DBGB varchar(3), + RC_INVESTIGATION varchar(4000), + RC_CONT_CS varchar(4000), + RC_ADDATE DATE default now(), + RC_IR_TRANSFER varchar(1) default '1', + RC_CANCLE_DOC varchar(50), + RC_CANCLEDATE varchar(8), + RC_CASENO varchar(50), + RC_SMS_SEND varchar(1) +); + + +comment on table TF680_RECALL is '민원'; + + +comment on column TF680_RECALL.RC_CODE is '민원코드'; + + +comment on column TF680_RECALL.RC_MAINCODE is '메인코드'; + + +comment on column TF680_RECALL.RC_GB is '민원구분(1:의견진술, 2:이의신청)'; + + +comment on column TF680_RECALL.RC_INGB is '접수방법(1:방문, 2:인터넷, 3:상급기관인터넷, 4:팩스, 5:우편, 6:전화, 7:ARS, 8:터치스크린, 9:공문)'; + + +comment on column TF680_RECALL.RC_USER is '민원 처리자'; + + +comment on column TF680_RECALL.RC_DATE is '접수일자'; + + +comment on column TF680_RECALL.RC_SEQ is '접수번호'; + + +comment on column TF680_RECALL.RC_NAME is '성명'; + + +comment on column TF680_RECALL.RC_JNO is '주민번호'; + + +comment on column TF680_RECALL.RC_JUSO is '주소'; + + +comment on column TF680_RECALL.RC_BUNJI is '번지'; + + +comment on column TF680_RECALL.RC_ZIP is '우편번호'; + + +comment on column TF680_RECALL.RC_TEL is '전화번호'; + + +comment on column TF680_RECALL.RC_PHONE is '전화번호'; + + +comment on column TF680_RECALL.RC_FAX is '팩스'; + + +comment on column TF680_RECALL.RC_EMAIL is '이메일'; + + +comment on column TF680_RECALL.RC_REL is '차주와의 관계'; + + +comment on column TF680_RECALL.RC_CONT_DOC is '진술유형(1:재판독, 2:기타, 3:공무수행, 4:응급환자수송및치료, 5:장애인관련, 6:고장, 7:수사차량, 8:이의인정, 9:취재차량, 10:착오단속, 11:거주자우선, 12:물건상하차, 13:공공업무수행, 14:공사차량)'; + + +comment on column TF680_RECALL.RC_CONT is '진술요지_인터넷'; + + +comment on column TF680_RECALL.RC_CONT_ADD1 is '진술첨부1'; + + +comment on column TF680_RECALL.RC_CONT_ADD2 is '진술첨부2'; + + +comment on column TF680_RECALL.RC_ANSWER_CAUSE is '답변근거'; + + +comment on column TF680_RECALL.RC_ANSWER is '답변'; + + +comment on column TF680_RECALL.RC_URL is 'URL'; + + +comment on column TF680_RECALL.RC_FILENM is '파일명'; + + +comment on column TF680_RECALL.RC_FILESIZE is '파일크기'; + + +comment on column TF680_RECALL.RC_PWD is '민원인 등록한 비밀번호'; + + +comment on column TF680_RECALL.RC_CHECK is '관리자확인여부(0:미확인, 1:확인)'; + + +comment on column TF680_RECALL.RC_DISPGB is '통보방법(1:서면, 2:EMAIL, 3:팩스, 4:인터넷, 5:전화)'; + + +comment on column TF680_RECALL.RC_STATE is '심의결과(0:심의전, 1:미부과, 2:재판독, 3:심의제외-OCR수납등록에서 생성, 5:부과, 7:자진취하, 8:법원이송, 9:경찰이첩)'; + + +comment on column TF680_RECALL.RC_ENDDATE is '심사일자'; + + +comment on column TF680_RECALL.RC_BIGO1 is '비고1'; + + +comment on column TF680_RECALL.RC_BIGO2 is '비고2'; + + +comment on column TF680_RECALL.RC_STATE_USERNAME is '심의자'; + + +comment on column TF680_RECALL.RC_SC_CODE is '법원코드'; + + +comment on column TF680_RECALL.RC_DBGB is '과태료코드'; + + +comment on column TF680_RECALL.RC_INVESTIGATION is '조사내용'; + + +comment on column TF680_RECALL.RC_CONT_CS is '진술요지_CS'; + + +comment on column TF680_RECALL.RC_ADDATE is '입력일시'; + + +comment on column TF680_RECALL.RC_IR_TRANSFER is '인터넷심사전송상태(1:미전송, 2:전송)'; + + +comment on column TF680_RECALL.RC_CANCLE_DOC is '삭제사유'; + + +comment on column TF680_RECALL.RC_CANCLEDATE is '삭제일시'; + + +create unique index TF680_RECALL_MAINCODE + on TF680_RECALL (RC_MAINCODE, RC_GB); + + +create index TF680_RECALL_IDX2 + on TF680_RECALL (RC_SEQ); + + +create index TF680_RECALL_IDX3 + on TF680_RECALL (RC_ENDDATE); + + +create index TF680_RECALL_IDX4 + on TF680_RECALL (RC_DATE); + + +create table TF_SGGCODE +( + SG_SGGCODE varchar(5) not null, + SG_SIDONAME varchar(4) not null, + SG_GUNAME varchar(20) not null +); + + +comment on column TF_SGGCODE.SG_SGGCODE is '시군구코드'; + + +comment on column TF_SGGCODE.SG_SIDONAME is '시도명'; + + +comment on column TF_SGGCODE.SG_GUNAME is '시군구명'; + + +create table TF680_DONG +( + DO_GUCODE varchar(3), + DO_BCODE varchar(10), + DO_HCODE varchar(10), + DO_BNAME varchar(30), + DO_HNAME varchar(30), + DO_CODE int not null + constraint TF680_DONG_PK + primary key, + DO_LIVE varchar(1) default 'Y' +); + + +comment on table TF680_DONG is '관할동'; + + +comment on column TF680_DONG.DO_GUCODE is '관할구코드'; + + +comment on column TF680_DONG.DO_BCODE is '법정동코드'; + + +comment on column TF680_DONG.DO_HCODE is '행정동코드'; + + +comment on column TF680_DONG.DO_BNAME is '법정동명'; + + +comment on column TF680_DONG.DO_HNAME is '행정동명'; + + +comment on column TF680_DONG.DO_CODE is '관할동코드'; + + +comment on column TF680_DONG.DO_LIVE is '사용여부'; + + +create index TF680_DONG_GUCODE + on TF680_DONG (DO_GUCODE, DO_BCODE, DO_HCODE); + + +create index TF680_DONG_BNAMEGUCODE + on TF680_DONG (DO_BNAME, DO_GUCODE); + + +create table GN_RECALL_SC +( + SC_CODE int8 not null, + SC_SEQ int8 not null, + SC_CARNUM varchar(20) not null, + SC_NAME varchar(50), + SC_DONG varchar(30), + SC_CONT_DOC varchar(3), + SC_CDATE varchar(8), + SC_INGB varchar(1), + SC_WDATE varchar(8), + SC_JBTIME varchar(4), + SC_POS varchar(100), + SC_FRECAD1 varchar(100), + SC_FRECAD2 varchar(100), + SC_FRECAD3 varchar(100), + SC_FRECAD4 varchar(100), + SC_CONTAD1 varchar(100), + SC_CONTAD2 varchar(100), + SC_CONTAD3 varchar(100), + SC_CONTAD4 varchar(100), + SC_CONTAD5 varchar(100), + SC_CONTAD6 varchar(100), + SC_CONTAD7 varchar(100), + SC_CONTAD8 varchar(100), + SC_PICAD1 varchar(100), + SC_PICAD2 varchar(100), + SC_PICAD3 varchar(100), + SC_PICAD4 varchar(100), + SC_TRANSFER varchar(1), + SC_DATAGB varchar(1), + SC_ANSWER varchar(1000), + SC_STATE varchar(1), + ZIPCODE1 varchar(3), + ZIPCODE2 varchar(3), + SC_JUSO varchar(99), + SC_BUNJI varchar(99) +); + + +create table MIN_SIMSA680_SC ( - role_id bigint generated by default as identity, - role_name varchar(20) not null, - role_remark varchar(100), - primary key (role_id) + MS_MAINCODE int8 not null, + MS_SEQ varchar(10) not null, + MS_CARNUM varchar(20) not null, + MS_YEAR varchar(4) not null, + MS_CHASU int8 not null, + MS_SDATE DATE not null, + MS_STARTSI varchar(2) not null, + MS_EDATE DATE not null, + MS_CDATE DATE not null, + MS_CLOSESI varchar(2) not null, + MS_WDATE DATE, + MS_POS varchar(100), + MS_RESULT varchar(1) default 0, + MS_JBTIME varchar(4), + MS_DATAGB varchar(1) not null ); -create table tb_cmm_user + +create table MIN_SIMSA_USER680_SC ( - cmm_user_id bigint generated by default as identity, - ins_dt_tm timestamp, - ins_user_id varchar(255), - password varchar(256) not null, - upd_dt_tm timestamp, - upd_user_id varchar(255), - user_id varchar(20) not null, - user_name varchar(100) not null, - primary key (cmm_user_id) -); - -create table tb_cmm_user_role + MSU_CODE int8 not null, + MSU_MAINCODE int8 not null, + MSU_USERID varchar(20) not null, + MSU_RESULT varchar(1) default 0, + MSU_REASON varchar(4000), + MSU_TEAM varchar(3) not null, + MSU_INDATE DATE +); + + +create table REFRESH_TOKEN ( - role_id bigint not null, - cmm_user_id bigint not null, - primary key (role_id, cmm_user_id) -); -create index idx_tb_cmm_board_01 on tb_cmm_board (title); -create index idx_tb_cmm_user_01 on tb_cmm_user (user_id, user_name); - -alter table tb_cmm_user_role - add constraint FK_role_id - foreign key (role_id) - references tb_cmm_role; - -alter table tb_cmm_user_role - add constraint FK_cmm_user_id - foreign key (cmm_user_id) - references tb_cmm_user; + KEY varchar(255) not null + primary key, + VALUE varchar(255) +); + + +create table tb_cmm_code_grp ( + code_grp_id varchar(20) not null, + created_by varchar(64), + created_dtm timestamp, + modified_by varchar(64), + modified_dtm timestamp, + use_yn varchar(1) default 'Y' not null, + code_nm varchar(20) not null, + code_ordr int4 default 99 not null, + code_remark varchar(50), + primary key (code_grp_id) +); + +create table tb_cmm_code_l ( + code_cd varchar(10) not null, + code_grp_id varchar(20) not null, + created_by varchar(64), + created_dtm timestamp, + modified_by varchar(64), + modified_dtm timestamp, + use_yn varchar(1) default 'Y' not null, + code_meta_1 varchar(10), + code_meta_2 varchar(10), + code_meta_3 varchar(10), + code_meta_4 varchar(10), + code_meta_5 varchar(10), + code_nm varchar(20) not null, + code_ordr int4 default 99 not null, + code_remark varchar(50), + primary key (code_cd, code_grp_id) +); + +create table tb_cmm_code_m ( + code_cd varchar(10) not null, + code_grp_id varchar(20) not null, + code_lcd varchar(10) not null, + created_by varchar(64), + created_dtm timestamp, + modified_by varchar(64), + modified_dtm timestamp, + use_yn varchar(1) default 'Y' not null, + code_meta_1 varchar(10), + code_meta_2 varchar(10), + code_meta_3 varchar(10), + code_meta_4 varchar(10), + code_meta_5 varchar(10), + code_nm varchar(20) not null, + code_ordr int4 not null, + code_remark varchar(50), + primary key (code_cd, code_grp_id, code_lcd) +); + +create table tb_cmm_code_s ( + code_cd varchar(10) not null, + code_grp_id varchar(20) not null, + code_lcd varchar(10) not null, + code_mcd varchar(10) not null, + created_by varchar(64), + created_dtm timestamp, + modified_by varchar(64), + modified_dtm timestamp, + use_yn varchar(1) default 'Y' not null, + code_meta_1 varchar(10), + code_meta_2 varchar(10), + code_meta_3 varchar(10), + code_meta_4 varchar(10), + code_meta_5 varchar(10), + code_nm varchar(20) not null, + code_ordr int4 default 99 not null, + code_remark varchar(50), + primary key (code_cd, code_grp_id, code_lcd, code_mcd) +); \ No newline at end of file diff --git a/src/main/resources/data/h2/schema_oracle.sql b/src/main/resources/data/h2/schema_oracle.sql new file mode 100644 index 0000000..43dd824 --- /dev/null +++ b/src/main/resources/data/h2/schema_oracle.sql @@ -0,0 +1,72 @@ +create table tb_cmm_code_grp ( + code_grp_id varchar2(20) not null, + created_by varchar2(64), + created_dtm timestamp, + modified_by varchar2(64), + modified_dtm timestamp, + use_yn varchar2(1) default 'Y' not null, + code_nm varchar2(20) not null, + code_ordr number(3) default 99 not null, + code_remark varchar2(50), + primary key (code_grp_id) +); + +create table tb_cmm_code_l ( + code_cd varchar2(10) not null, + code_grp_id varchar2(20) not null, + created_by varchar2(64), + created_dtm timestamp, + modified_by varchar2(64), + modified_dtm timestamp, + use_yn varchar2(1) default 'Y' not null, + code_meta_1 varchar2(10), + code_meta_2 varchar2(10), + code_meta_3 varchar2(10), + code_meta_4 varchar2(10), + code_meta_5 varchar2(10), + code_nm varchar2(20) not null, + code_ordr number(3) default 99 not null, + code_remark varchar2(50), + primary key (code_cd, code_grp_id) +); + +create table tb_cmm_code_m ( + code_cd varchar2(10) not null, + code_grp_id varchar2(20) not null, + code_lcd varchar2(10) not null, + created_by varchar2(64), + created_dtm timestamp, + modified_by varchar2(64), + modified_dtm timestamp, + use_yn varchar2(1) default 'Y' not null, + code_meta_1 varchar2(10), + code_meta_2 varchar2(10), + code_meta_3 varchar2(10), + code_meta_4 varchar2(10), + code_meta_5 varchar2(10), + code_nm varchar2(20) not null, + code_ordr number(3) not null, + code_remark varchar2(50), + primary key (code_cd, code_grp_id, code_lcd) +); + +create table tb_cmm_code_s ( + code_cd varchar2(10) not null, + code_grp_id varchar2(20) not null, + code_lcd varchar2(10) not null, + code_mcd varchar2(10) not null, + created_by varchar2(64), + created_dtm timestamp, + modified_by varchar2(64), + modified_dtm timestamp, + use_yn varchar2(1) default 'Y' not null, + code_meta_1 varchar2(10), + code_meta_2 varchar2(10), + code_meta_3 varchar2(10), + code_meta_4 varchar2(10), + code_meta_5 varchar2(10), + code_nm varchar2(20) not null, + code_ordr number(3) default 99 not null, + code_remark varchar2(50), + primary key (code_cd, code_grp_id, code_lcd, code_mcd) +); \ No newline at end of file diff --git a/src/test/java/com/xit/biz/cmm/repository/ICmmCodeRepositoryTest.java b/src/test/java/com/xit/biz/cmm/repository/ICmmCodeRepositoryTest.java index 0df44fb..d03ccf6 100644 --- a/src/test/java/com/xit/biz/cmm/repository/ICmmCodeRepositoryTest.java +++ b/src/test/java/com/xit/biz/cmm/repository/ICmmCodeRepositoryTest.java @@ -1,9 +1,10 @@ package com.xit.biz.cmm.repository; +import com.xit.biz.cmm.dto.ComboCodeDto; import com.xit.biz.cmm.entity.*; import com.xit.biz.cmm.entity.spec.CmmCodeSpecification; import com.xit.biz.cmm.dto.CmmCodeDto; -import com.xit.biz.cmm.dto.ComboCodeDto; +import com.xit.biz.cmm.dto.IComboCodeDto; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -96,7 +97,7 @@ class ICmmCodeRepositoryTest { //List list = cmmCodeSRepository.findByCodeGrpIdAndCodeLcdAndCodeMcdAndUseYnOrderByCodeOrdr(savedCmmCodeS.getCodeGrpId(), savedCmmCodeS.getCodeLcd(), savedCmmCodeS.getCodeMcd(), savedCmmCodeS.getUseYn()); //System.out.println(list); - List comboCodeDtos = cmmCodeSRepository.queryComboCode(savedCmmCodeS.getCodeGrpId(), savedCmmCodeS.getCodeLcd(), savedCmmCodeS.getCodeMcd()); + List comboCodeDtos = cmmCodeSRepository.queryComboCodeClass(savedCmmCodeS.getCodeGrpId(), savedCmmCodeS.getCodeLcd(), savedCmmCodeS.getCodeMcd()); System.out.println(comboCodeDtos); // cmmFileDtlIds.setFileMstId(savedCmmFileMst.getFileMstId());