parent
0e3fd7c23b
commit
d2acc24567
@ -0,0 +1,36 @@
|
||||
package cokr.xit.ens.modules.common.ctgy.sys.mng.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import cokr.xit.ens.modules.common.ctgy.sys.mng.mapper.IKeySequenceMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class KeySequenceService {
|
||||
|
||||
private final IKeySequenceMapper mapper;
|
||||
|
||||
/**
|
||||
* 키 시퀀스 조회
|
||||
* @param seqName 키 시퀀스 이름
|
||||
* @return Long
|
||||
*/
|
||||
@Transactional
|
||||
public Long getKeySequence(String seqName) {
|
||||
Long nextSeq = mapper.selectKeySequence(seqName);
|
||||
if(nextSeq == null) {
|
||||
nextSeq = 1L;
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("seqName", seqName);
|
||||
map.put("nextVal", nextSeq);
|
||||
mapper.saveKeySequence(map);
|
||||
return nextSeq;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?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="cokr.xit.ens.modules.common.ctgy.sys.mng.mapper.IKeySequenceMapper">
|
||||
|
||||
<select id="selectKeySequence" parameterType="string" resultType="long">
|
||||
/** iup-keyseq-mapper|selectKeySequence-key sequence 조회|julim */
|
||||
SELECT next_val + 1
|
||||
FROM ens_seq_generator
|
||||
WHERE seq_name = #{seqName}
|
||||
FOR UPDATE
|
||||
</select>
|
||||
|
||||
<insert id="saveKeySequence" parameterType="map">
|
||||
/** iup-keyseq-mapper|saveKeySequence-key sequence 저장|julim */
|
||||
MERGE
|
||||
INTO ens_seq_generator tgt
|
||||
USING (SELECT #{seqName} AS seq_name, #{nextVal} AS next_val FROM dual) src
|
||||
ON (tgt.seq_name = src.seq_name)
|
||||
WHEN MATCHED THEN
|
||||
UPDATE SET tgt.next_val = src.next_val
|
||||
WHEN NOT MATCHED THEN
|
||||
INSERT (seq_name, next_val)
|
||||
VALUES (src.seq_name, src.next_val)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -1,79 +1,79 @@
|
||||
<?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">
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cokr.xit.ens.modules.kkotalk.mapper.IKkoTalkMapper">
|
||||
<!-- // FIXME: 카카오톡 신규 추가 -->
|
||||
<!-- =================================================================================== -->
|
||||
<!-- ================================ accept =========================================== -->
|
||||
<!-- =================================================================================== -->
|
||||
<insert id="saveSndDtlKkoTalk" parameterType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
|
||||
/** iup-kkotalk-mapper|saveSndDtlKkoTalk-카카오톡발송상세생성|julim */
|
||||
INSERT INTO ens_snd_dtl_kko_talk (
|
||||
send_detail_id,
|
||||
title,
|
||||
link,
|
||||
hash,
|
||||
guide,
|
||||
payload,
|
||||
read_expires_at,
|
||||
review_expires_at,
|
||||
use_non_personalized_noti,
|
||||
ci,
|
||||
phone_number,
|
||||
name,
|
||||
birthday,
|
||||
external_id,
|
||||
error_code,
|
||||
error_message,
|
||||
bill_uid,
|
||||
send_mast_id,
|
||||
regist_dt
|
||||
) VALUES (
|
||||
#{sendDetailId},
|
||||
#{title},
|
||||
#{link},
|
||||
#{hash},
|
||||
#{guide},
|
||||
#{payload},
|
||||
#{readExpiresAt},
|
||||
#{reviewExpiresAt},
|
||||
#{useNonPersonalizedNotification},
|
||||
#{ci},
|
||||
#{phoneNumber},
|
||||
#{name},
|
||||
#{birthday},
|
||||
#{externalId},
|
||||
#{errorCode},
|
||||
#{errorMessage},
|
||||
#{billUid},
|
||||
#{sendMastId},
|
||||
sysdate
|
||||
)
|
||||
</insert>
|
||||
<!-- =================================================================================== -->
|
||||
<!-- ================================ accept =========================================== -->
|
||||
<!-- =================================================================================== -->
|
||||
<insert id="saveSndDtlKkoTalk" parameterType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
|
||||
/** iup-kkotalk-mapper|saveSndDtlKkoTalk-카카오톡발송상세생성|julim */
|
||||
INSERT INTO ens_snd_dtl_kko_talk (
|
||||
send_detail_id,
|
||||
title,
|
||||
link,
|
||||
hash,
|
||||
guide,
|
||||
payload,
|
||||
read_expires_at,
|
||||
review_expires_at,
|
||||
use_non_personalized_noti,
|
||||
ci,
|
||||
phone_number,
|
||||
name,
|
||||
birthday,
|
||||
external_id,
|
||||
error_code,
|
||||
error_message,
|
||||
bill_uid,
|
||||
send_mast_id,
|
||||
regist_dt
|
||||
) VALUES (
|
||||
select ens_seq_generator.nextval from dual,
|
||||
#{title},
|
||||
#{link},
|
||||
#{hash},
|
||||
#{guide},
|
||||
#{payload},
|
||||
#{readExpiresAt},
|
||||
#{reviewExpiresAt},
|
||||
#{useNonPersonalizedNotification},
|
||||
#{ci},
|
||||
#{phoneNumber},
|
||||
#{name},
|
||||
#{birthday},
|
||||
#{externalId},
|
||||
#{errorCode},
|
||||
#{errorMessage},
|
||||
#{billUid},
|
||||
#{sendMastId},
|
||||
sysdate
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="findAllBySendMastId" parameterType="string" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
|
||||
/** iup-kkotalk-mapper|findAllBySendMastId-카카오톡발송대상 조회|julim */
|
||||
SELECT send_detail_id,
|
||||
title,
|
||||
link,
|
||||
hash,
|
||||
guide,
|
||||
payload,
|
||||
read_expires_at,
|
||||
review_expires_at,
|
||||
use_non_personalized_noti AS useNonPersonalizedNotification,
|
||||
ci,
|
||||
phone_number,
|
||||
name,
|
||||
birthday,
|
||||
external_id,
|
||||
error_code,
|
||||
error_message,
|
||||
bill_uid,
|
||||
send_mast_id,
|
||||
regist_dt
|
||||
FROM ens_snd_dtl_kko_talk
|
||||
WHERE send_mast_id = #{sendMastId}
|
||||
</select>
|
||||
<select id="findAllBySendMastId" parameterType="string" resultType="cokr.xit.ens.modules.kkotalk.model.KkotalkDTO$SendDetailKkoTalkDTO">
|
||||
/** iup-kkotalk-mapper|findAllBySendMastId-카카오톡발송대상 조회|julim */
|
||||
SELECT send_detail_id,
|
||||
title,
|
||||
link,
|
||||
hash,
|
||||
guide,
|
||||
payload,
|
||||
read_expires_at,
|
||||
review_expires_at,
|
||||
use_non_personalized_noti AS useNonPersonalizedNotification,
|
||||
ci,
|
||||
phone_number,
|
||||
name,
|
||||
birthday,
|
||||
external_id,
|
||||
error_code,
|
||||
error_message,
|
||||
bill_uid,
|
||||
send_mast_id,
|
||||
regist_dt
|
||||
FROM ens_snd_dtl_kko_talk
|
||||
WHERE send_mast_id = #{sendMastId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue