<?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.ruoyi.process.mapper.ProcessMethodSearchNewFileSeqMapper">
|
|
<insert id="insertIfAbsent">
|
INSERT IGNORE INTO cnas_process_method_search_new_file_seq
|
(seq_date, sequence_value)
|
VALUES
|
(#{seqDate}, 0)
|
</insert>
|
|
<select id="selectForUpdate" resultType="java.lang.Integer">
|
SELECT sequence_value
|
FROM cnas_process_method_search_new_file_seq
|
WHERE seq_date = #{seqDate}
|
FOR UPDATE
|
</select>
|
|
<select id="selectMaxExisting" resultType="java.lang.Integer">
|
SELECT COALESCE(MAX(seq_value), 0)
|
FROM (
|
SELECT CAST(SUBSTRING(file_no, 9) AS UNSIGNED) AS seq_value
|
FROM cnas_process_method_search_new
|
WHERE file_no REGEXP CONCAT('^', #{prefix}, '[0-9]+$')
|
UNION ALL
|
SELECT CAST(SUBSTRING(file_no, 9) AS UNSIGNED) AS seq_value
|
FROM cnas_process_method_search_new_backups
|
WHERE file_no REGEXP CONCAT('^', #{prefix}, '[0-9]+$')
|
) numbers
|
</select>
|
|
<update id="updateValue">
|
UPDATE cnas_process_method_search_new_file_seq
|
SET sequence_value = #{value}
|
WHERE seq_date = #{seqDate}
|
</update>
|
|
</mapper>
|