#170 (QSP -> QCAST) 공통코드 동기화
This commit is contained in:
parent
16128cec25
commit
e572faaf4b
@ -0,0 +1,44 @@
|
||||
package com.interplug.qcast.biz.commCode;
|
||||
|
||||
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.commCode.dto.CommCodeRequest;
|
||||
import com.interplug.qcast.biz.commCode.dto.CommCodeResponse;
|
||||
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/commcode")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "CommCodeController", description = "공통코드 관련 API")
|
||||
public class CommCodeController {
|
||||
private final CommCodeService commCodeService;
|
||||
|
||||
@Operation(description = "공통코드 COMM_H, COMM_L 정보를 등록/수정 한다.(동기화)")
|
||||
@PostMapping("/qc-comm-yn-update")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public CommCodeResponse setQcCommCdYn(@RequestBody CommCodeRequest codeReq) {
|
||||
CommCodeResponse codeResponse = new CommCodeResponse();
|
||||
|
||||
int resultCnt = 0;
|
||||
if ("H".equals(codeReq.getQcGubun())) {
|
||||
resultCnt = commCodeService.setCommHUpdate(codeReq);
|
||||
} else {
|
||||
resultCnt = commCodeService.setCommLUpdate(codeReq);
|
||||
}
|
||||
if (resultCnt > 0)
|
||||
codeResponse.setCode("200");
|
||||
else
|
||||
codeResponse.setCode("500");
|
||||
|
||||
return codeResponse;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.interplug.qcast.biz.commCode;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.interplug.qcast.biz.commCode.dto.CommCodeRequest;
|
||||
|
||||
@Mapper
|
||||
public interface CommCodeMapper {
|
||||
|
||||
int setCommHUpdate(CommCodeRequest codeReq);
|
||||
|
||||
int setCommLUpdate(CommCodeRequest codeReq);
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.interplug.qcast.biz.commCode;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.interplug.qcast.biz.commCode.dto.CommCodeRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CommCodeService {
|
||||
|
||||
private final CommCodeMapper commCodeMapper;
|
||||
|
||||
public int setCommHUpdate(CommCodeRequest codeSaveReq) {
|
||||
return commCodeMapper.setCommHUpdate(codeSaveReq);
|
||||
}
|
||||
|
||||
public int setCommLUpdate(CommCodeRequest codeSaveReq) {
|
||||
return commCodeMapper.setCommLUpdate(codeSaveReq);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.interplug.qcast.biz.commCode.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CommCodeRequest {
|
||||
private String headCd;
|
||||
private String headId;
|
||||
private String headNm;
|
||||
private String headJp;
|
||||
private String head4Th;
|
||||
private String refChr1;
|
||||
private String refChr2;
|
||||
private String refChr3;
|
||||
private String refChr4;
|
||||
private String refChr5;
|
||||
private String refNum1;
|
||||
private String refNum2;
|
||||
private String refNum3;
|
||||
private String refNum4;
|
||||
private String refNum5;
|
||||
private String remarks;
|
||||
private String delFlg;
|
||||
// private String regDt;
|
||||
// private String uptDt;
|
||||
|
||||
private String clHeadCd;
|
||||
private String clCode;
|
||||
private String clReadCd;
|
||||
private String clCodeNm;
|
||||
private String clCodeJp;
|
||||
private String clCode4Th;
|
||||
private String clRefChr1;
|
||||
private String clRefChr2;
|
||||
private String clRefChr3;
|
||||
private String clRefChr4;
|
||||
private String clRefChr5;
|
||||
private Integer clRefNum1;
|
||||
private Integer clRefNum2;
|
||||
private Integer clRefNum3;
|
||||
private Integer clRefNum4;
|
||||
private Integer clRefNum5;
|
||||
private Integer clPriority;
|
||||
private String clRefCnt;
|
||||
private String clDelFlg;
|
||||
// private String clRegDt;
|
||||
// private String clUptDt;
|
||||
|
||||
private String qcGubun;
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.interplug.qcast.biz.commCode.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CommCodeResponse {
|
||||
|
||||
private String code;
|
||||
private String message;
|
||||
|
||||
|
||||
}
|
||||
151
src/main/resources/mappers/commCode/commCodeMapper.xml
Normal file
151
src/main/resources/mappers/commCode/commCodeMapper.xml
Normal file
@ -0,0 +1,151 @@
|
||||
<?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.commCode.CommCodeMapper">
|
||||
<insert id="setCommHUpdate" parameterType="com.interplug.qcast.biz.commCode.dto.CommCodeRequest">
|
||||
/* sqlid : com.interplug.qcast.commCode.setCommHUpdate */
|
||||
MERGE M_COMM_H AS A
|
||||
USING
|
||||
( SELECT #{headCd} AS HEAD_CD ) AS D
|
||||
ON (A.HEAD_CD = D.HEAD_CD
|
||||
)
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
HEAD_ID = #{headId}
|
||||
, HEAD_NM = #{headNm}
|
||||
, HEAD_JP = #{headJp}
|
||||
, HEAD_4TH = #{head4Th}
|
||||
, REF_CHR1 = #{refChr1}
|
||||
, REF_CHR2 = #{refChr2}
|
||||
, REF_CHR3 = #{refChr3}
|
||||
, REF_CHR4 = #{refChr4}
|
||||
, REF_CHR5 = #{refChr5}
|
||||
, REF_NUM1 = #{refNum1}
|
||||
, REF_NUM2 = #{refNum2}
|
||||
, REF_NUM3 = #{refNum3}
|
||||
, REF_NUM4 = #{refNum4}
|
||||
, REF_NUM5 = #{refNum5}
|
||||
, REMARKS = #{remarks}
|
||||
, DEL_FLG = #{delFlg}
|
||||
, REG_DT = GETDATE()
|
||||
, UPT_DT = GETDATE()
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (
|
||||
HEAD_CD
|
||||
, HEAD_ID
|
||||
, HEAD_NM
|
||||
, HEAD_JP
|
||||
, HEAD_4TH
|
||||
, REF_CHR1
|
||||
, REF_CHR2
|
||||
, REF_CHR3
|
||||
, REF_CHR4
|
||||
, REF_CHR5
|
||||
, REF_NUM1
|
||||
, REF_NUM2
|
||||
, REF_NUM3
|
||||
, REF_NUM4
|
||||
, REF_NUM5
|
||||
, REMARKS
|
||||
, DEL_FLG
|
||||
, REG_DT
|
||||
, UPT_DT
|
||||
) VALUES (
|
||||
#{headCd}
|
||||
, #{headId}
|
||||
, #{headNm}
|
||||
, #{headJp}
|
||||
, #{head4Th}
|
||||
, #{refChr1}
|
||||
, #{refChr2}
|
||||
, #{refChr3}
|
||||
, #{refChr4}
|
||||
, #{refChr5}
|
||||
, #{refNum1}
|
||||
, #{refNum2}
|
||||
, #{refNum3}
|
||||
, #{refNum4}
|
||||
, #{refNum5}
|
||||
, #{remarks}
|
||||
, #{delFlg}
|
||||
, GETDATE()
|
||||
, GETDATE()
|
||||
);
|
||||
</insert>
|
||||
|
||||
<insert id="setCommLUpdate" parameterType="com.interplug.qcast.biz.commCode.dto.CommCodeRequest">
|
||||
MERGE M_COMM_L AS A
|
||||
USING
|
||||
( SELECT #{clHeadCd} AS HEAD_CD, #{clCode} AS CODE ) AS D
|
||||
ON (A.HEAD_CD = D.HEAD_CD AND A.CODE = D.CODE
|
||||
)
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET
|
||||
CODE = #{clCode}
|
||||
, READ_CD = #{clReadCd}
|
||||
, CODE_NM = #{clCodeNm}
|
||||
, CODE_JP = #{clCodeJp}
|
||||
, CODE_4TH = #{clCode4Th}
|
||||
, REF_CHR1 = #{clRefChr1}
|
||||
, REF_CHR2 = #{clRefChr2}
|
||||
, REF_CHR3 = #{clRefChr3}
|
||||
, REF_CHR4 = #{clRefChr4}
|
||||
, REF_CHR5 = #{clRefChr5}
|
||||
, REF_NUM1 = #{clRefNum1}
|
||||
, REF_NUM2 = #{clRefNum2}
|
||||
, REF_NUM3 = #{clRefNum3}
|
||||
, REF_NUM4 = #{clRefNum4}
|
||||
, REF_NUM5 = #{clRefNum5}
|
||||
, PRIORITY = #{clPriority}
|
||||
, REF_CNT = #{clRefCnt}
|
||||
, DEL_FLG = #{clDelFlg}
|
||||
, REG_DT = GETDATE()
|
||||
, UPT_DT = GETDATE()
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (
|
||||
HEAD_CD
|
||||
, CODE
|
||||
, READ_CD
|
||||
, CODE_NM
|
||||
, CODE_JP
|
||||
, CODE_4TH
|
||||
, REF_CHR1
|
||||
, REF_CHR2
|
||||
, REF_CHR3
|
||||
, REF_CHR4
|
||||
, REF_CHR5
|
||||
, REF_NUM1
|
||||
, REF_NUM2
|
||||
, REF_NUM3
|
||||
, REF_NUM4
|
||||
, REF_NUM5
|
||||
, PRIORITY
|
||||
, REF_CNT
|
||||
, DEL_FLG
|
||||
, REG_DT
|
||||
, UPT_DT
|
||||
) VALUES (
|
||||
#{clHeadCd}
|
||||
, #{clCode}
|
||||
, #{clReadCd}
|
||||
, #{clCodeNm}
|
||||
, #{clCodeJp}
|
||||
, #{clCode4Th}
|
||||
, #{clRefChr1}
|
||||
, #{clRefChr2}
|
||||
, #{clRefChr3}
|
||||
, #{clRefChr4}
|
||||
, #{clRefChr5}
|
||||
, #{clRefNum1}
|
||||
, #{clRefNum2}
|
||||
, #{clRefNum3}
|
||||
, #{clRefNum4}
|
||||
, #{clRefNum5}
|
||||
, #{clPriority}
|
||||
, #{clRefCnt}
|
||||
, #{clDelFlg}
|
||||
, GETDATE()
|
||||
, GETDATE()
|
||||
);
|
||||
</insert>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user