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.

74 lines
2.4 KiB

3 years ago
3 years ago
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="com.spring.modules.base.dao.TransNoControlDao">
  4. <update id="update">
  5. EXEC UpdateTransNo #{site},#{no}
  6. </update>
  7. <select id="transNo" resultType="java.lang.String">
  8. select dbo.Get_TransNo(#{site},#{no})
  9. </select>
  10. <insert id="addOtherRollTransNo">
  11. INSERT INTO [dbo].[other_roll_trans_no]([order_no], [seq_no], [next_no])
  12. VALUES (#{orderNo}, #{seqNo} , #{nextNo});
  13. </insert>
  14. <update id="updateOtherRollSeqNo">
  15. update other_roll_trans_no set next_no = next_no+1
  16. where order_no = #{orderNo} and seq_no = #{seqNo}
  17. </update>
  18. <select id="getRuleForUpdate" resultType="com.spring.modules.base.data.TransNoControlRuleData">
  19. select
  20. Site as site,
  21. TransType as transType,
  22. NextNumber as nextNumber,
  23. Length as length,
  24. TransNo as transNo,
  25. generate_method as generateMethod,
  26. date_format as dateFormat,
  27. date_part as datePart
  28. from TransNoControl with (updlock, rowlock)
  29. where Site = #{site}
  30. and TransType = #{no}
  31. </select>
  32. <select id="getBaseRuleForUpdate" resultType="com.spring.modules.base.data.TransNoControlRuleData">
  33. select
  34. Site as site,
  35. TransType as transType,
  36. NextNumber as nextNumber,
  37. Length as length,
  38. TransNo as transNo
  39. from TransNoControl with (updlock, rowlock)
  40. where Site = #{site}
  41. and TransType = #{no}
  42. </select>
  43. <select id="checkExtendColumnsReady" resultType="java.lang.Integer">
  44. select
  45. case
  46. when COL_LENGTH('dbo.TransNoControl', 'generate_method') is not null
  47. and COL_LENGTH('dbo.TransNoControl', 'date_format') is not null
  48. and COL_LENGTH('dbo.TransNoControl', 'date_part') is not null
  49. then 1
  50. else 0
  51. end
  52. </select>
  53. <update id="increaseNextNumber">
  54. update TransNoControl
  55. set NextNumber =
  56. case
  57. when NextNumber is null then 2
  58. else NextNumber + 1
  59. end
  60. where Site = #{site}
  61. and TransType = #{no}
  62. </update>
  63. </mapper>