34 lines
1017 B
XML
34 lines
1017 B
XML
<?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_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> |