You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

75 lines
2.4 KiB

<?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.spring.modules.base.dao.TransNoControlDao">
<update id="update">
EXEC UpdateTransNo #{site},#{no}
</update>
<select id="transNo" resultType="java.lang.String">
select dbo.Get_TransNo(#{site},#{no})
</select>
<insert id="addOtherRollTransNo">
INSERT INTO [dbo].[other_roll_trans_no]([order_no], [seq_no], [next_no])
VALUES (#{orderNo}, #{seqNo} , #{nextNo});
</insert>
<update id="updateOtherRollSeqNo">
update other_roll_trans_no set next_no = next_no+1
where order_no = #{orderNo} and seq_no = #{seqNo}
</update>
<select id="getRuleForUpdate" resultType="com.spring.modules.base.data.TransNoControlRuleData">
select
Site as site,
TransType as transType,
NextNumber as nextNumber,
Length as length,
TransNo as transNo,
generate_method as generateMethod,
date_format as dateFormat,
date_part as datePart
from TransNoControl with (updlock, rowlock)
where Site = #{site}
and TransType = #{no}
</select>
<select id="getBaseRuleForUpdate" resultType="com.spring.modules.base.data.TransNoControlRuleData">
select
Site as site,
TransType as transType,
NextNumber as nextNumber,
Length as length,
TransNo as transNo
from TransNoControl with (updlock, rowlock)
where Site = #{site}
and TransType = #{no}
</select>
<select id="checkExtendColumnsReady" resultType="java.lang.Integer">
select
case
when COL_LENGTH('dbo.TransNoControl', 'generate_method') is not null
and COL_LENGTH('dbo.TransNoControl', 'date_format') is not null
and COL_LENGTH('dbo.TransNoControl', 'date_part') is not null
then 1
else 0
end
</select>
<update id="increaseNextNumber">
update TransNoControl
set NextNumber =
case
when NextNumber is null then 2
else NextNumber + 1
end
where Site = #{site}
and TransType = #{no}
</update>
</mapper>