SysAccountMapper.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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.ym.mec.biz.dal.dao.SysAccountDao">
  4. <resultMap id="SysAccount" type="com.ym.mec.biz.dal.entity.SysAccount">
  5. <!--@Table sys_account-->
  6. <id column="id_" jdbcType="INTEGER" property="id"/>
  7. <result column="company_" jdbcType="VARCHAR" property="company"/>
  8. <result column="mer_no_" jdbcType="VARCHAR" property="merNo"/>
  9. <result column="routing_mer_no_" jdbcType="VARCHAR" property="routingMerNo"/>
  10. <result column="max_receipt_" jdbcType="DECIMAL" property="maxReceipt"/>
  11. <result column="has_receipt_" jdbcType="DECIMAL" property="hasReceipt"/>
  12. <result column="channel_" jdbcType="VARCHAR" property="channel"/>
  13. <result column="type_" jdbcType="CHAR" property="type"/>
  14. <result column="status_" jdbcType="TINYINT" property="status"/>
  15. <result column="version" jdbcType="INTEGER" property="version"/>
  16. </resultMap>
  17. <sql id="Base_Column_List">
  18. id_,
  19. company_,
  20. mer_no_,
  21. routing_mer_no_,
  22. max_receipt_,
  23. has_receipt_,
  24. channel_,
  25. type_,
  26. status_,
  27. version
  28. </sql>
  29. <select id="get" parameterType="java.lang.Integer" resultMap="SysAccount">
  30. <!--@mbg.generated-->
  31. select
  32. <include refid="Base_Column_List"/>
  33. from sys_account
  34. where id_ = #{id,jdbcType=INTEGER}
  35. </select>
  36. <delete id="delete" parameterType="java.lang.Integer">
  37. <!--@mbg.generated-->
  38. delete from sys_account
  39. where id_ = #{id,jdbcType=INTEGER}
  40. </delete>
  41. <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.SysAccount"
  42. useGeneratedKeys="true">
  43. <!--@mbg.generated-->
  44. insert into sys_account
  45. <trim prefix="(" suffix=")" suffixOverrides=",">
  46. <if test="company != null">
  47. company_,
  48. </if>
  49. <if test="merNo != null">
  50. mer_no_,
  51. </if>
  52. <if test="merNo != null">
  53. routing_mer_no_,
  54. </if>
  55. <if test="maxReceipt != null">
  56. max_receipt_,
  57. </if>
  58. <if test="hasReceipt != null">
  59. has_receipt_,
  60. </if>
  61. <if test="channel != null">
  62. channel_,
  63. </if>
  64. <if test="type != null">
  65. type_,
  66. </if>
  67. <if test="status != null">
  68. status_,
  69. </if>
  70. <if test="version != null">
  71. version,
  72. </if>
  73. </trim>
  74. <trim prefix="values (" suffix=")" suffixOverrides=",">
  75. <if test="company != null">
  76. #{company,jdbcType=VARCHAR},
  77. </if>
  78. <if test="merNo != null">
  79. #{merNo,jdbcType=VARCHAR},
  80. </if>
  81. <if test="routingMerNo != null">
  82. #{routingMerNo,jdbcType=VARCHAR},
  83. </if>
  84. <if test="maxReceipt != null">
  85. #{maxReceipt,jdbcType=DECIMAL},
  86. </if>
  87. <if test="hasReceipt != null">
  88. #{hasReceipt,jdbcType=DECIMAL},
  89. </if>
  90. <if test="channel != null">
  91. #{channel,jdbcType=VARCHAR},
  92. </if>
  93. <if test="type != null">
  94. #{type,jdbcType=CHAR},
  95. </if>
  96. <if test="status != null">
  97. #{status,jdbcType=TINYINT},
  98. </if>
  99. <if test="version != null">
  100. #{version,jdbcType=INTEGER},
  101. </if>
  102. </trim>
  103. </insert>
  104. <update id="update" parameterType="com.ym.mec.biz.dal.entity.SysAccount">
  105. <!--@mbg.generated-->
  106. update sys_account
  107. <set>
  108. <if test="company != null">
  109. company_ = #{company,jdbcType=VARCHAR},
  110. </if>
  111. <if test="merNo != null">
  112. mer_no_ = #{merNo,jdbcType=VARCHAR},
  113. </if>
  114. <if test="routingMerNo != null">
  115. routing_mer_no_ = #{routingMerNo,jdbcType=VARCHAR},
  116. </if>
  117. <if test="maxReceipt != null">
  118. max_receipt_ = #{maxReceipt,jdbcType=DECIMAL},
  119. </if>
  120. <if test="hasReceipt != null">
  121. has_receipt_ = #{hasReceipt,jdbcType=DECIMAL},
  122. </if>
  123. <if test="channel != null">
  124. channel_ = #{channel,jdbcType=VARCHAR},
  125. </if>
  126. <if test="type != null">
  127. type_ = #{type,jdbcType=CHAR},
  128. </if>
  129. <if test="status != null">
  130. status_ = #{status,jdbcType=TINYINT},
  131. </if>
  132. <if test="version != null">
  133. version = version+1,
  134. </if>
  135. </set>
  136. where id_ = #{id,jdbcType=INTEGER} AND version =#{version}
  137. </update>
  138. <select id="getAccount" resultMap="SysAccount">
  139. SELECT * FROM sys_account WHERE status_=1 AND company_=#{company}
  140. <if test="channel != null">
  141. AND channel_ = #{channel}
  142. </if>
  143. <if test="type != null">
  144. AND FIND_IN_SET(type_,#{type})
  145. </if>
  146. <if test="amount != null">
  147. <![CDATA[AND max_receipt_ < has_receipt_+ #{amount}]]>
  148. </if>
  149. </select>
  150. <select id="getOneAccount" resultMap="SysAccount">
  151. SELECT * FROM sys_account WHERE status_ =1 AND company_=#{company}
  152. <if test="channel != null">
  153. AND channel_ = #{channel}
  154. </if>
  155. <if test="type != null">
  156. AND type_ = #{type}
  157. </if>
  158. <if test="amount != null">
  159. <![CDATA[AND max_receipt_ < has_receipt_+ #{amount}]]>
  160. </if>
  161. </select>
  162. </mapper>