SysAccountMapper.xml 6.4 KB

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