diff --git a/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java b/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java index da7b0ba..f460612 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java +++ b/src/main/java/cokr/xit/adds/biz/nims/dao/BizNimsMapper.java @@ -1,21 +1,16 @@ package cokr.xit.adds.biz.nims.dao; -import java.util.List; -import java.util.Map; -import java.util.Optional; +import java.util.*; -import org.egovframe.rte.psl.dataaccess.mapper.Mapper; +import org.egovframe.rte.psl.dataaccess.mapper.*; -import cokr.xit.adds.biz.nims.model.BizNimsDto; -import cokr.xit.adds.biz.nims.model.BizNimsRequest; -import cokr.xit.adds.biz.nims.model.BizNimsResponse; -import cokr.xit.adds.inf.nims.model.NimsApiDto; -import cokr.xit.adds.inf.nims.model.NimsApiRequest; -import cokr.xit.foundation.component.AbstractMapper; +import cokr.xit.adds.biz.nims.model.*; +import cokr.xit.adds.inf.nims.model.*; +import cokr.xit.foundation.component.*; /** *
- * description : + * description : * * packageName : cokr.xit.adds.inf.nims.dao * fileName : InfNimsMapper @@ -36,7 +31,7 @@ public interface BizNimsMapper extends AbstractMapper { void mergeBsshInfoSt(final NimsApiDto.BsshInfoSt dto); ListselectBsshInfos(final NimsApiRequest.BsshInfoReq dto); - void mergeProductInfoKd(final NimsApiDto.ProductInfoKd dto); + void mergeProductInfoKd(final NimsApiDto.ProductInfoKdSaveDTO dto); List selectProductInfos(final NimsApiRequest.ProductInfoReq dto); void mergeJurisdictionGovInfo(NimsApiDto.JurisdictionGovInfo dto); diff --git a/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java b/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java index f7860ab..54c8101 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java +++ b/src/main/java/cokr/xit/adds/biz/nims/service/BizNimsService.java @@ -1,19 +1,16 @@ package cokr.xit.adds.biz.nims.service; -import java.util.List; +import java.util.*; -import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.*; -import cokr.xit.adds.biz.nims.model.BizNimsDto; -import cokr.xit.adds.biz.nims.model.BizNimsRequest; -import cokr.xit.adds.biz.nims.model.BizNimsResponse; -import cokr.xit.adds.core.model.ApiBaseResponse; -import cokr.xit.adds.inf.nims.model.NimsApiDto; -import cokr.xit.adds.inf.nims.model.NimsApiRequest; +import cokr.xit.adds.biz.nims.model.*; +import cokr.xit.adds.core.model.*; +import cokr.xit.adds.inf.nims.model.*; /** * - * description : + * description : * * packageName : cokr.xit.adds.inf.nims.service * fileName : InfNimsService @@ -41,7 +38,7 @@ public interface BizNimsService { //------------------------------------------------------------------------------------------------------ // NIMS BIZ //------------------------------------------------------------------------------------------------------ - BizNimsRequest.DsuseMgtReceiptReq saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq dto, final Listdtls, List files); + BizNimsRequest.DsuseMgtReceiptReq saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq reqDto, final List dtls, final List files, final NimsApiDto.BsshInfoSt bsshInfoSt, final List prdList); BizNimsRequest.DsuseMgtReceiptReq modifyDsuseMgtReceiptMstInfo(final BizNimsRequest.DsuseMgtReceiptReq reqDto); diff --git a/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java b/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java index 6ef6d6b..9600cae 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java +++ b/src/main/java/cokr/xit/adds/biz/nims/service/bean/BizNimsServiceBean.java @@ -1,45 +1,36 @@ package cokr.xit.adds.biz.nims.service.bean; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CopyOnWriteArrayList; - -import javax.validation.Validation; -import javax.validation.Validator; - -import org.apache.commons.lang3.StringUtils; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import cokr.xit.adds.biz.nims.dao.BizNimsMapper; -import cokr.xit.adds.biz.nims.model.BizNimsDto; -import cokr.xit.adds.biz.nims.model.BizNimsRequest; -import cokr.xit.adds.biz.nims.model.BizNimsResponse; -import cokr.xit.adds.biz.nims.service.BizNimsService; -import cokr.xit.adds.core.Constants; -import cokr.xit.adds.core.Constants.RPT_TY_CD; -import cokr.xit.adds.core.model.ApiBaseResponse; -import cokr.xit.adds.core.spring.exception.ApiCustomException; -import cokr.xit.adds.core.util.ApiUtil; -import cokr.xit.adds.inf.nims.model.NimsApiDto; -import cokr.xit.adds.inf.nims.model.NimsApiDto.BsshInfoSt; -import cokr.xit.adds.inf.nims.model.NimsApiRequest; -import cokr.xit.adds.inf.nims.model.NimsApiRequest.BsshInfoReq; -import cokr.xit.adds.inf.nims.model.NimsApiResult; -import cokr.xit.adds.inf.nims.service.InfNimsService; -import cokr.xit.base.file.FileInfo; -import cokr.xit.base.file.service.FileService; -import cokr.xit.base.file.web.FileInfoFactory; -import cokr.xit.foundation.component.AbstractServiceBean; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; +import java.util.*; +import java.util.concurrent.*; + +import javax.validation.*; + +import org.apache.commons.lang3.*; +import org.springframework.stereotype.*; +import org.springframework.web.multipart.*; + +import cokr.xit.adds.biz.nims.dao.*; +import cokr.xit.adds.biz.nims.model.*; +import cokr.xit.adds.biz.nims.service.*; +import cokr.xit.adds.core.*; +import cokr.xit.adds.core.Constants.*; +import cokr.xit.adds.core.model.*; +import cokr.xit.adds.core.spring.exception.*; +import cokr.xit.adds.core.util.*; +import cokr.xit.adds.inf.nims.model.*; +import cokr.xit.adds.inf.nims.model.NimsApiDto.*; +import cokr.xit.adds.inf.nims.model.NimsApiRequest.*; +import cokr.xit.adds.inf.nims.service.*; +import cokr.xit.base.file.*; +import cokr.xit.base.file.service.*; +import cokr.xit.base.file.web.*; +import cokr.xit.foundation.component.*; +import lombok.*; +import lombok.extern.slf4j.*; /** * - * description : + * description : * * packageName : cokr.xit.adds.inf.nims.service.bean * fileName : InfNimsServiceBean @@ -86,10 +77,12 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe // DB 조회 List*/ @Override - public BizNimsRequest.DsuseMgtReceiptReq saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq reqDto, final Listlist = new ArrayList<>(); - if("N".equals(reqDto.getDbSkipYn())) { - list = bizNimsMapper.selectBsshInfos(reqDto); - if (!isEmpty(list)) return list; - } + + // FIXME: API 적용 - db 조회 skip + // if("N".equals(reqDto.getDbSkipYn())) { + // list = bizNimsMapper.selectBsshInfos(reqDto); + // if (!isEmpty(list)) return list; + // } if(isEmpty(reqDto.getK())){ reqDto.setK(getApiInfInfo(reqDto.getUserId()).get("apiKey")); @@ -107,16 +100,23 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe if (isEmpty(curList)) break; - for (BsshInfoSt d : curList) { - d.setRgtr(reqDto.getUserId()); - bizNimsMapper.mergeBsshInfoSt(d); - // 대표자 검색조건이 있는 경우 - if (isRprsntvNm && !isEmpty(d.getRprsntvNm()) && d.getRprsntvNm().contains(reqDto.getRprsntvNm())) { - list.add(d); - } - } + // FIXME: API 적용 - db 저장 skip + // for (BsshInfoSt d : curList) { + // d.setRgtr(reqDto.getUserId()); + // bizNimsMapper.mergeBsshInfoSt(d); + // // 대표자 검색조건이 있는 경우 + // if (isRprsntvNm && !isEmpty(d.getRprsntvNm()) && d.getRprsntvNm().contains(reqDto.getRprsntvNm())) { + // list.add(d); + // } + // } + if (!isRprsntvNm){ list.addAll(curList); + }else{ + list.addAll( + curList.stream() + .filter(d -> !isEmpty(d.getRprsntvNm()) && d.getRprsntvNm().contains(reqDto.getRprsntvNm())) + .toList()); } if(rslt.isEndYn()) break; @@ -150,7 +150,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe List list = new ArrayList<>(); //////////////////////////////////////////////////////////////////////////////////////// - // TODO: API 적용후 DB 조회 skip 처리 + // FIXME: 신규 API 적용 - DB 조회 skip 처리 // if("N".equals(reqDto.getDbSkipYn())) { // list = bizNimsMapper.selectProductInfos(reqDto); // if (!isEmpty(list)){ @@ -180,10 +180,11 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe if(isEmpty(curList)) break; - for (NimsApiDto.ProductInfoKd d : curList) { - d.setRgtr(reqDto.getUserId()); - bizNimsMapper.mergeProductInfoKd(d); - } + // FIXME: 신규 API 적용 - 조회 결과 저장 skip + // for (NimsApiDto.ProductInfoKd d : curList) { + // d.setRgtr(reqDto.getUserId()); + // bizNimsMapper.mergeProductInfoKd(d); + // } // 제조 번호, 일련번호, 유효기간 정보 목록 추가 if(isMnfSeqInfo) productInfoaddMnfSeqs(curList, reqDto.getBc(), reqDto.getK()); @@ -283,7 +284,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe * dtls, final List files) { + public BizNimsRequest.DsuseMgtReceiptReq saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq reqDto, final List dtls, final List files, final NimsApiDto.BsshInfoSt bsshInfoSt, final List prdList) { ApiUtil.validate(reqDto, null, validator); if(reqDto.getRndDtlRptCnt() != dtls.size()) throw ApiCustomException.create("폐기물 보고수 오류[폐기물 갯수 확인]"); ApiUtil.validate(dtls, null, validator); @@ -291,6 +292,16 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe if(files.size() != dtls.size()) throw ApiCustomException.create("폐기물 파일 갯수 오류[파일 갯수 확인]"); + // FIXME: 신규 API 적용 - 취급자 및 제품 정보 저장 + bsshInfoSt.setRgtr(reqDto.getUserId()); + bizNimsMapper.mergeBsshInfoSt(bsshInfoSt); + prdList.forEach( + d -> { + d.setRgtr(reqDto.getUserId()); + bizNimsMapper.mergeProductInfoKd(d); + } + ); + if(isEmpty(reqDto.getDscdmngId())) { if (bizNimsMapper.insertDsuseMgtReceipt(reqDto) == 1) { diff --git a/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java b/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java index ce29cad..a429476 100644 --- a/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java +++ b/src/main/java/cokr/xit/adds/biz/nims/web/BizNimsController.java @@ -1,36 +1,26 @@ package cokr.xit.adds.biz.nims.web; -import java.util.List; +import java.util.*; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.ModelAttribute; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; +import org.springframework.http.*; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.*; -import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.core.type.*; -import cokr.xit.adds.biz.nims.model.BizNimsDto; -import cokr.xit.adds.biz.nims.model.BizNimsRequest; -import cokr.xit.adds.biz.nims.model.BizNimsResponse; -import cokr.xit.adds.biz.nims.service.BizNimsService; -import cokr.xit.adds.core.model.ApiBaseResponse; -import cokr.xit.adds.core.util.XingUtils; -import cokr.xit.adds.inf.nims.model.NimsApiDto; -import cokr.xit.adds.inf.nims.model.NimsApiRequest; -import cokr.xit.foundation.data.JSON; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.media.Content; -import io.swagger.v3.oas.annotations.media.ExampleObject; -import lombok.RequiredArgsConstructor; +import cokr.xit.adds.biz.nims.model.*; +import cokr.xit.adds.biz.nims.service.*; +import cokr.xit.adds.core.model.*; +import cokr.xit.adds.core.util.*; +import cokr.xit.adds.inf.nims.model.*; +import cokr.xit.foundation.data.*; +import io.swagger.v3.oas.annotations.*; +import io.swagger.v3.oas.annotations.media.*; +import lombok.*; /** * - * description : + * description : * * packageName : cokr.xit.adds.inf.nims.web * fileName : InfNimsController @@ -128,9 +118,11 @@ public class BizNimsController { @RequestParam(value = "dsusePrdImgFiles", required = false) ListdsusePrdImgFiles ) { JSON json = new JSON(); + NimsApiDto.BsshInfoSt bsshInfoSt = json.parse(dsuseMgtJsonStr, new TypeReference<>() {}); BizNimsRequest.DsuseMgtReceiptReq receiptDto = json.parse(dsuseMgtJsonStr, new TypeReference<>() {}); + List productInfoKds = json.parse(dsuseMgtDtlsJsonStr, new TypeReference<>() {}); List dsuseMgtDtls = json.parse(dsuseMgtDtlsJsonStr, new TypeReference<>() {}); - return ApiBaseResponse.of(bizNimsService.saveDsuseMgtReceipt(receiptDto, dsuseMgtDtls, dsusePrdImgFiles)); + return ApiBaseResponse.of(bizNimsService.saveDsuseMgtReceipt(receiptDto, dsuseMgtDtls, dsusePrdImgFiles, bsshInfoSt, productInfoKds)); } @Operation(summary = "사고 마약류 폐기 관리 폐기 신청서 마스터 정보 변경", description = "사고 마약류 폐기 관리 폐기 신청서 접수 마스터 정보 변경", tags = { "BIZ API" }) diff --git a/src/main/java/cokr/xit/adds/inf/nims/model/NimsApiDto.java b/src/main/java/cokr/xit/adds/inf/nims/model/NimsApiDto.java index 4c3274d..37eb842 100644 --- a/src/main/java/cokr/xit/adds/inf/nims/model/NimsApiDto.java +++ b/src/main/java/cokr/xit/adds/inf/nims/model/NimsApiDto.java @@ -1,30 +1,21 @@ package cokr.xit.adds.inf.nims.model; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import javax.validation.Valid; - -import com.fasterxml.jackson.annotation.JsonAlias; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -import cokr.xit.adds.biz.nims.model.BizNimsDto; -import cokr.xit.adds.biz.nims.model.BizNimsResponse; -import cokr.xit.adds.core.Constants; -import cokr.xit.adds.core.model.AuditDto; -import cokr.xit.adds.core.spring.exception.ApiCustomException; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.SuperBuilder; +import java.io.*; +import java.util.*; + +import javax.validation.*; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; + +import cokr.xit.adds.biz.nims.model.*; +import cokr.xit.adds.core.*; +import cokr.xit.adds.core.model.*; +import cokr.xit.adds.core.spring.exception.*; +import lombok.*; +import lombok.experimental.*; /** * @@ -210,6 +201,88 @@ public class NimsApiDto { private ListmnfSeqInfos = new ArrayList<>(); } + /** + * 상품 정보 저장을 위한 DTO + */ + @Getter + @NoArgsConstructor + @AllArgsConstructor + @SuperBuilder + public static class ProductInfoKdSaveDTO extends AuditDto { + /** + * 품목코드 + */ + @JsonAlias("PRDUCT_CD") + private String prductCd; + + /** + * 제품대표코드 + */ + @JsonAlias("PRDLST_MST_CD") + private String prdlstMstCd; + + /** + * 제품명 + */ + @JsonAlias("PRDUCT_NM") + private String prductNm; + + /** + * 마약/항정 구분명 + */ + @JsonAlias("NRCD_SE_NM") + private String nrcdSeNm; + + /** + * 중점/일반 구분 + */ + @JsonAlias("PRTM_SE_NM") + private String prtmSeNm; + + /** + * 제품최소유통단위수량 + * 제품규격정보(고정값 = 1) + */ + @JsonAlias("minDistbQy") + private Integer prdMinDistbQy; + + /** + * 제품최소유통단위 + */ + @JsonAlias("minDistbUnit") + private String stdPackngStleNm; + + /** + * 제품총낱개단위수량 + */ + @JsonAlias("pceQy") + private Integer prdTotPceQy; + + /** + * 제품낱개단위 + */ + @JsonAlias("pceUnit") + private String pceCoUnitNm; + + /** + * 마약류취급자식별번호 + */ + @JsonAlias("BSSH_CD") + private String bsshCd; + + /** + * 등록일 + */ + @JsonAlias("RGS_DT") + private String rgsDt; + + /** + * 변경일 + */ + @JsonAlias("UPD_DT") + private String updDt;; + } + /** * 제품 제조 일련 번호 정보 조회 response */ @@ -678,4 +751,3 @@ public class NimsApiDto { private String bassDtlAdres; } } - diff --git a/src/main/java/cokr/xit/adds/inf/nims/model/NimsApiRequest.java b/src/main/java/cokr/xit/adds/inf/nims/model/NimsApiRequest.java index a00effc..c52c558 100644 --- a/src/main/java/cokr/xit/adds/inf/nims/model/NimsApiRequest.java +++ b/src/main/java/cokr/xit/adds/inf/nims/model/NimsApiRequest.java @@ -2,17 +2,13 @@ package cokr.xit.adds.inf.nims.model; import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*; -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Pattern; +import javax.validation.constraints.*; -import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.*; -import cokr.xit.adds.core.Constants; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; +import cokr.xit.adds.core.*; +import io.swagger.v3.oas.annotations.media.*; +import lombok.*; /** * @@ -114,9 +110,9 @@ public class NimsApiRequest { * true 인 경우 DB 조회 skip **/ - @Schema(title = "DB 조회 skip 여부", description = "DB 조회 skip 여부(DB 조회 없이 NIMS API호출 하려면 Y)", example = "N") - @Builder.Default - private String dbSkipYn = "N"; + // @Schema(title = "DB 조회 skip 여부", description = "DB 조회 skip 여부(DB 조회 없이 NIMS API호출 하려면 Y)", example = "N") + // @Builder.Default + // private String dbSkipYn = "N"; /** *diff --git a/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml b/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml index bc95265..c8866e4 100644 --- a/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml +++ b/src/main/resources/sql/mapper/biz/nims-mysql-mapper.xml @@ -44,21 +44,21 @@ ) ON DUPLICATE KEY UPDATE bssh_nm = #{bsshNm}, /* 마약류취급자명 */ - induty_nm = #{indutyNm}, /* 업종명 */ - hdnt_cd = #{hdntCd}, /* 의료업자구분 */ - hdnt_nm = #{hdntNm}, /* 의료업자구분명 */ - bizrno = #{bizrno}, /* 사업자등록번호 */ - rprsntv_nm = #{rprsntvNm}, /* 대표자명 */ - chrg_nm = #{chrgNm}, /* 담당자명 */ - hptl_no = #{hptlNo}, /* 요약기관번호 */ - join_yn = #{joinYn}, /* 가입여부 */ - bssh_stts_nm = #{bsshSttusNm}, /* 마약류취급자상태명 */ - prmisn_no = #{prmisnNo}, /* 허가번호 */ + bizrno = #{bizrno}, /* 사업자등록번호 */ + rprsntv_nm = #{rprsntvNm}, /* 대표자명 */ + prmisn_no = #{prmisnNo}, /* 허가번호 */ + induty_nm = CASE WHEN induty_nm != IFNULL(#{indutyNm}, '') AND IFNULL(#{indutyNm}, '') != '' THEN #{indutyNm} ELSE induty_nm END, /* 업종명 */ + hdnt_cd = CASE WHEN hdnt_cd != IFNULL(#{hdntCd}, '') AND IFNULL(#{hdntCd}, '') != '' THEN #{hdntCd} ELSE hdnt_cd END, /* 의료업자구분 */ + hdnt_nm = CASE WHEN hdnt_nm != IFNULL(#{hdntNm}, '') AND IFNULL(#{hdntNm}, '') != '' THEN #{hdntNm} ELSE hdnt_nm END, /* 의료업자구분명 */ + chrg_nm = CASE WHEN chrg_nm != IFNULL(#{chrgNm}, '') AND IFNULL(#{chrgNm}, '') != '' THEN #{chrgNm} ELSE chrg_nm END, /* 담당자명 */ + hptl_no = CASE WHEN hptl_no != IFNULL(#{hptlNo}, '') AND IFNULL(#{hptlNo}, '') != '' THEN #{hptlNo} ELSE hptl_no END, /* 요약기관번호 */ + join_yn = CASE WHEN join_yn != IFNULL(#{joinYn}, '') AND IFNULL(#{joinYn}, '') != '' THEN #{joinYn} ELSE join_yn END, /* 가입여부 */ + bssh_stts_nm = CASE WHEN bssh_stts_nm != IFNULL(#{bsshSttusNm}, '') AND IFNULL(#{bsshSttusNm}, '') != '' THEN #{bsshSttusNm} ELSE bssh_stts_nm END, /* 마약류취급자상태명 */ mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s'), mdfr = #{rgtr} -+ /** nims-mysql-mapper|mergeProductInfoKd-상품정보 생성|julim */ INSERT INTO tb_prduct_info( prduct_cd, /* 제품코드 */ @@ -87,24 +87,24 @@ #{prdTotPceQy}, #{pceCoUnitNm}, #{bsshCd}, - #{rgsDt}, - #{updDt}, + NULLIF(#{rgsDt}, ''), + NULLIF(#{updDt}, ''), 'Y', DATE_FORMAT(now(), '%Y%m%d%H%i%s'), #{rgtr} ) ON DUPLICATE KEY UPDATE - prdlst_mst_cd = #{prdlstMstCd}, /* 제품대표코드 */ prduct_nm = #{prductNm}, /* 제품명 */ - nrcd_se_nm = #{nrcdSeNm}, /* 마약항정구분 */ - prtm_se_nm = #{prtmSeNm}, /* 중점일반구분 */ prd_min_distb_qy = #{prdMinDistbQy}, /* 최소유통단위수량 - 제품규격정보(고정값=1) */ std_packng_stle_nm = #{stdPackngStleNm}, /* 제품최소유통단위 */ prd_tot_pce_qy = #{prdTotPceQy}, /* 제품총낱개단위수량 */ pce_co_unit_nm = #{pceCoUnitNm}, /* 제품낱개단위 */ - bssh_cd = #{bsshCd}, /* 마약류취급자식별번호 */ - rgs_dt = #{rgsDt}, /* 등록일 */ - upd_dt = #{updDt}, /* 변경일 */ + prdlst_mst_cd = CASE WHEN prdlst_mst_cd != IFNULL(#{prdlstMstCd}, '') AND IFNULL(#{prdlstMstCd}, '') != '' THEN #{prdlstMstCd} ELSE prdlst_mst_cd END, /* 제품대표코드 */ + nrcd_se_nm = CASE WHEN nrcd_se_nm != IFNULL(#{nrcdSeNm}, '') AND IFNULL(#{nrcdSeNm}, '') != '' THEN #{nrcdSeNm} ELSE nrcd_se_nm END, /* 마약항정구분 */ + prtm_se_nm = CASE WHEN prtm_se_nm != IFNULL(#{prtmSeNm}, '') AND IFNULL(#{prtmSeNm}, '') != '' THEN #{prtmSeNm} ELSE prtm_se_nm END, /* 중점일반구분 */ + bssh_cd = CASE WHEN bssh_cd != IFNULL(#{bsshCd}, '') AND IFNULL(#{bsshCd}, '') != '' THEN #{bsshCd} ELSE bssh_cd END, /* 마약류취급자식별번호 */ + rgs_dt = CASE WHEN rgs_dt != NULLIF(#{rgsDt}, '') AND IFNULL(#{rgsDt}, '') != '' THEN NULLIF(#{rgsDt}, '') ELSE rgs_dt END, /* 등록일 */ + upd_dt = CASE WHEN upd_dt != NULLIF(#{updDt}, '') AND IFNULL(#{updDt}, '') != '' THEN NULLIF(#{updDt}, '') ELSE upd_dt END, /* 변경일 */ mdfcn_dt = DATE_FORMAT(now(), '%Y%m%d%H%i%s'), mdfr = #{rgtr}