견적특이사항 / 아이템 표시, 미표시 동기화 api 추가

This commit is contained in:
LEEYONGJAE 2024-09-27 15:15:54 +09:00
parent 6efd3d5426
commit 570b942882
6 changed files with 221 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.interplug.qcast.biz.specialNote.SpecialNoteMapper">
<insert id="setSpecialNoteSave" parameterType="com.interplug.qcast.biz.specialNote.dto.SpecialNoteRequest" >
/* 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}
);
</insert>
<insert id="setStoreDisplayItemSave" parameterType="com.interplug.qcast.biz.specialNote.dto.SpecialNoteItemRequest" >
/* 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}
);
</insert>
</mapper>