배치이력 생성 작업

This commit is contained in:
kangsunlee
2025-07-11 16:39:52 +09:00
parent 8e03d434ee
commit 5b50fe92a8
19 changed files with 255 additions and 143 deletions

View File

@@ -0,0 +1,34 @@
<?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="app.module.admin.usecase.batchLog.adapters.persistence.BatchLogMapper">
<!-- 실행 중인지 확인 -->
<select id="exists" resultType="boolean">
SELECT EXISTS (
SELECT 1
FROM batch_log
WHERE type = #{type}
AND status = 'RUNNING'
AND start_at::date = CURRENT_DATE
)
</select>
<!-- 실행 로그 insert -->
<insert id="create">
<selectKey keyProperty="id" resultType="long" order="BEFORE">
SELECT nextval('batch_log_id_seq')
</selectKey>
INSERT INTO batch_log (id, type, status, start_at, created_at)
VALUES (#{id}, #{type}, #{status}, #{startAt}, now())
</insert>
<!-- 상태 업데이트 -->
<update id="update">
UPDATE batch_log
SET status = #{status},
error_message = #{errorMessage},
end_at = now()
WHERE id = #{id}
</update>
</mapper>

View File

@@ -3,38 +3,11 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace="app.module.admin.usecase.schedule.autoSchedules.adapters.persistence.AutoSchedulesMapper">
<select id="createMonthlyInputStatus">
<select id="createMonthlyInputStatus" resultType="java.lang.String">
select fn_monthly_input_status()
</select>
<insert id="createSmsAutoSend">
/* createSmsAutoSend : 문자 발송 insert */
INSERT INTO biz_msg
(
MSG_TYPE,
CMID,
REQUEST_TIME,
SEND_TIME,
DEST_PHONE,
SEND_PHONE,
MSG_BODY
)
VALUES
<foreach collection="sendHouseholds" item="item" separator=",">
(
5,
TO_CHAR(NOW(), 'YYYYMMDDHH24MISS') || '_' || #{item.householdNum},
NOW(),
NOW(),
#{item.phone},
#{sendPhone},
#{message}
)
</foreach>
</insert>
<select id="createMonthlyCarryOver">
<select id="createMonthlyCarryOver" resultType="java.lang.String">
select fn_monthly_carry_over(null)
</select>
</select>
</mapper>