diff --git a/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteController.java b/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteController.java new file mode 100644 index 00000000..982106b8 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteController.java @@ -0,0 +1,41 @@ +package com.interplug.qcast.biz.specialNote; + +import org.springframework.http.HttpStatus; +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.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; +import com.interplug.qcast.biz.specialNote.dto.SpecialNoteItemRequest; +import com.interplug.qcast.biz.specialNote.dto.SpecialNoteRequest; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@RestController +@RequestMapping("/api/special-note") +@RequiredArgsConstructor +@Tag(name = "SpecialNoteController", description = "견적 특이사항 관련 API") +public class SpecialNoteController { + + private final SpecialNoteService specialNoteService; + + @Operation(description = "견적 특이사항 정보를 등록/수정한다. (동기화)") + @PostMapping("/special-note-save") + @ResponseStatus(HttpStatus.OK) + public void setSpecialNoteSave(@RequestBody SpecialNoteRequest specialNoteRequest) + throws Exception { + specialNoteService.setSpecialNoteSave(specialNoteRequest); + } + + @Operation(description = "견적 특이사항 ITEM 정보를 등록/수정한다. (동기화)") + @PostMapping("/special-note-item-save") + @ResponseStatus(HttpStatus.OK) + public void setSpecialNoteItemSave(@RequestBody SpecialNoteItemRequest specialNoteItemRequest) + throws Exception { + specialNoteService.setStoreDisplayItemSave(specialNoteItemRequest); + } + +} diff --git a/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteMapper.java b/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteMapper.java new file mode 100644 index 00000000..d923086e --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteMapper.java @@ -0,0 +1,14 @@ +package com.interplug.qcast.biz.specialNote; + +import org.apache.ibatis.annotations.Mapper; +import com.interplug.qcast.biz.specialNote.dto.SpecialNoteItemRequest; +import com.interplug.qcast.biz.specialNote.dto.SpecialNoteRequest; + +@Mapper +public interface SpecialNoteMapper { + + void setSpecialNoteSave(SpecialNoteRequest specialNoteRequest) throws Exception; + + void setStoreDisplayItemSave(SpecialNoteItemRequest specialNoteItemRequest) throws Exception; + +} diff --git a/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteService.java b/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteService.java new file mode 100644 index 00000000..25a7454e --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/specialNote/SpecialNoteService.java @@ -0,0 +1,25 @@ +package com.interplug.qcast.biz.specialNote; + +import org.springframework.stereotype.Service; +import com.interplug.qcast.biz.specialNote.dto.SpecialNoteItemRequest; +import com.interplug.qcast.biz.specialNote.dto.SpecialNoteRequest; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +@Service +@RequiredArgsConstructor +public class SpecialNoteService { + + private final SpecialNoteMapper specialNoteMapper; + + public void setSpecialNoteSave(SpecialNoteRequest specialNoteRequest) throws Exception { + specialNoteMapper.setSpecialNoteSave(specialNoteRequest); + } + + public void setStoreDisplayItemSave(SpecialNoteItemRequest specialNoteItemRequest) + throws Exception { + specialNoteMapper.setStoreDisplayItemSave(specialNoteItemRequest); + } + +} diff --git a/src/main/java/com/interplug/qcast/biz/specialNote/dto/SpecialNoteItemRequest.java b/src/main/java/com/interplug/qcast/biz/specialNote/dto/SpecialNoteItemRequest.java new file mode 100644 index 00000000..2250615d --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/specialNote/dto/SpecialNoteItemRequest.java @@ -0,0 +1,28 @@ +package com.interplug.qcast.biz.specialNote.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class SpecialNoteItemRequest { + + /** Special Note Type Code */ + private String spnTypeCd; + + /** Special Note Attribute */ + private String spnAttrCd; + + /** Item Id */ + private String itemId; + + /** Del Flag */ + private String delFlg; + + /** Inputted Date */ + private String registDatetime; + + /** Updated Date */ + private String lastEditDatetime; + +} diff --git a/src/main/java/com/interplug/qcast/biz/specialNote/dto/SpecialNoteRequest.java b/src/main/java/com/interplug/qcast/biz/specialNote/dto/SpecialNoteRequest.java new file mode 100644 index 00000000..06bac782 --- /dev/null +++ b/src/main/java/com/interplug/qcast/biz/specialNote/dto/SpecialNoteRequest.java @@ -0,0 +1,31 @@ +package com.interplug.qcast.biz.specialNote.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class SpecialNoteRequest { + + /** Special Note Type Code */ + private String spnTypeCd; + + /** Special Note Attribute */ + private String spnAttrCd; + + /** Used Flg */ + private String useFlg; + + /** Remarks */ + private String remarks; + + /** Del Flag */ + private String delFlg; + + /** Inputted Date */ + private String registDatetime; + + /** Updated Date */ + private String lastEditDatetime; + +} diff --git a/src/main/resources/mappers/specialNote/specialNoteMapper.xml b/src/main/resources/mappers/specialNote/specialNoteMapper.xml new file mode 100644 index 00000000..ba84749b --- /dev/null +++ b/src/main/resources/mappers/specialNote/specialNoteMapper.xml @@ -0,0 +1,82 @@ + + + + + + + /* sqlid : com.interplug.qcast.specialNote.setSpecialNoteSave (견적 특이사항 정보 등록/수정 - 동기화) */ + MERGE T_OBJECT_SPECIAL_NOTE AS A + USING + ( + SELECT #{spnAttrCd} AS SPN_ATTR_CD + , #{spnTypeCd} AS SPN_TYPE_CD + ) AS T + ON ( + A.SPN_ATTR_CD = T.SPN_ATTR_CD + AND A.SPN_TYPE_CD = T.SPN_TYPE_CD + ) + WHEN MATCHED THEN + UPDATE SET + USE_FLG = #{useFlg} + , REMARKS = #{remarks} + , DEL_FLG = #{delFlg} + , REGIST_DATETIME = #{registDatetime} + , LAST_EDIT_DATETIME = #{lastEditDatetime} + WHEN NOT MATCHED THEN + INSERT ( + SPN_ATTR_CD + , SPN_TYPE_CD + , USE_FLG + , REMARKS + , DEL_FLG + , REGIST_DATETIME + , LAST_EDIT_DATETIME + ) VALUES ( + #{spnAttrCd} + , #{SpnTypeCd} + , #{useFlg} + , #{remarks} + , #{delFlg} + , #{registDatetime} + , #{lastEditDatetime} + ); + + + + /* sqlid : com.interplug.qcast.specialNote.setStoreDisplayItemSave (견적 특이사항 ITEM 정보 등록/수정 - 동기화) */ + MERGE T_OBJECT_SPECIAL_NOTE_ITEM AS A + USING + ( + SELECT #{spnAttrCd} AS SPN_ATTR_CD + , #{spnTypeCd} AS SPN_TYPE_CD + , #{itemId} AS ITEM_ID + ) AS T + ON ( + A.SPN_ATTR_CD = T.SPN_ATTR_CD + AND A.SPN_TYPE_CD = T.SPN_TYPE_CD + AND A.ITEM_ID = T.ITEM_ID + ) + WHEN MATCHED THEN + UPDATE SET + DEL_FLG = #{delFlg} + , REGIST_DATETIME = #{registDatetime} + , LAST_EDIT_DATETIME = #{lastEditDatetime} + WHEN NOT MATCHED THEN + INSERT ( + SPN_ATTR_CD + , SPN_TYPE_CD + , ITEM_ID + , DEL_FLG + , REGIST_DATETIME + , LAST_EDIT_DATETIME + ) VALUES ( + #{spnAttrCd} + , #{spnTypeCd} + , #{itemId} + , #{delFlg} + , #{registDatetime} + , #{lastEditDatetime} + ); + + +