SysPaymentConfigMapper.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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.SysPaymentConfigDao">
  4. <resultMap id="SysPaymentConfig" type="com.ym.mec.biz.dal.entity.SysPaymentConfig">
  5. <!--@Table sys_payment_config-->
  6. <id column="id_" jdbcType="INTEGER" property="id"/>
  7. <result column="organ_id_" property="organId"/>
  8. <result column="account_tyoe_" property="accountType"/>
  9. <result column="pay_type_" property="payType"/>
  10. <result column="yq_mer_no_" property="yqMerNo"/>
  11. <result column="hf_mer_no_" property="hfMerNo"/>
  12. <result column="type_" property="type"/>
  13. <result column="route_scale_" property="routeScale"/>
  14. <result column="organ_name" property="organName"/>
  15. <result column="per_scale_" property="perScale"/>
  16. <result column="com_scale_" property="comScale"/>
  17. <result column="course_fee_" property="courseFee"/>
  18. <result column="instrument_fee_" property="instrumentFee"/>
  19. <result column="accessories_fee_" property="accessoriesFee"/>
  20. <result column="other_fee_" property="otherFee"/>
  21. <result column="create_time_" property="createTime"/>
  22. <result column="update_time_" property="updateTime"/>
  23. </resultMap>
  24. <sql id="Base_Column_List">
  25. <!--@mbg.generated-->
  26. id_, organ_id_,account_type_,pay_type_,yq_mer_no_,hf_mer_no_,type_,route_scale_,create_time_, update_time_
  27. </sql>
  28. <select id="get" parameterType="java.lang.Integer" resultMap="SysPaymentConfig">
  29. <!--@mbg.generated-->
  30. select
  31. <include refid="Base_Column_List"/>
  32. from sys_payment_config
  33. where id_ = #{id,jdbcType=INTEGER}
  34. </select>
  35. <delete id="delete" parameterType="java.lang.Integer">
  36. delete
  37. from sys_payment_config
  38. where id_ = #{id,jdbcType=INTEGER}
  39. </delete>
  40. <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.SysPaymentConfig"
  41. useGeneratedKeys="true">
  42. <!--@mbg.generated-->
  43. insert into sys_payment_config
  44. <trim prefix="(" suffix=")" suffixOverrides=",">
  45. <if test="organId != null">
  46. organ_id_,
  47. </if>
  48. <if test="accountType != null">
  49. account_type_,
  50. </if>
  51. <if test="payType != null">
  52. pay_type_,
  53. </if>
  54. <if test="yqMerNo != null">
  55. yq_mer_no_,
  56. </if>
  57. <if test="hfMerNo != null">
  58. hf_mer_no_,
  59. </if>
  60. <if test="routeScale != null">
  61. route_scale_,
  62. </if>
  63. <if test="type != null">
  64. type_,
  65. </if>
  66. <if test="createTime != null">
  67. create_time_,
  68. </if>
  69. <if test="updateTime != null">
  70. update_time_,
  71. </if>
  72. </trim>
  73. <trim prefix="values (" suffix=")" suffixOverrides=",">
  74. <if test="organId != null">
  75. #{organId},
  76. </if>
  77. <if test="accountType != null">
  78. #{accountType},
  79. </if>
  80. <if test="payType != null">
  81. #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  82. </if>
  83. <if test="yqMerNo != null">
  84. #{yqMerNo},
  85. </if>
  86. <if test="hfMerNo != null">
  87. #{hfMerNo},
  88. </if>
  89. <if test="routeScale != null">
  90. #{routeScale},
  91. </if>
  92. <if test="type != null">
  93. #{type},
  94. </if>
  95. <if test="createTime != null">
  96. #{createTime},
  97. </if>
  98. <if test="updateTime != null">
  99. #{updateTime},
  100. </if>
  101. </trim>
  102. </insert>
  103. <update id="update" parameterType="com.ym.mec.biz.dal.entity.SysPaymentConfig">
  104. <!--@mbg.generated-->
  105. update sys_payment_config
  106. <set>
  107. <if test="organId != null">
  108. organ_id_ = #{organId},
  109. </if>
  110. <if test="accountType != null">
  111. account_type_ = #{accountType},
  112. </if>
  113. <if test="payType != null">
  114. pay_type_ = #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
  115. </if>
  116. <if test="yqMerNo != null">
  117. yq_mer_no_ = #{yqMerNo},
  118. </if>
  119. <if test="hfMerNo != null">
  120. hf_mer_no_ = #{hfMerNo},
  121. </if>
  122. <if test="routeScale != null">
  123. route_scale_ = #{routeScale},
  124. </if>
  125. <if test="type != null">
  126. type_ = #{type},
  127. </if>
  128. update_time_ = now()
  129. </set>
  130. where id_ = #{id,jdbcType=INTEGER}
  131. </update>
  132. <!-- 全查询 -->
  133. <select id="findAll" resultMap="SysPaymentConfig">
  134. SELECT *
  135. FROM sys_payment_config
  136. ORDER BY id_
  137. </select>
  138. <!-- 分页查询 -->
  139. <select id="queryPage" resultMap="SysPaymentConfig" parameterType="map">
  140. SELECT spc.*,o.name_ organ_name FROM sys_payment_config spc LEFT JOIN organization o on spc.organ_id_ = o.id_
  141. <include refid="global.limit"/>
  142. </select>
  143. <!-- 查询当前表的总记录数 -->
  144. <select id="queryCount" resultType="int">
  145. SELECT COUNT(*) FROM sys_payment_config
  146. <include refid="global.limit"/>
  147. </select>
  148. <!-- 按分部编号查配置 -->
  149. <select id="findPaymentConfigByOrganId" resultMap="SysPaymentConfig">
  150. SELECT *
  151. FROM sys_payment_config
  152. WHERE organ_id_ = #{organId}
  153. </select>
  154. <select id="findPaymentConfigByOrganIds" resultMap="SysPaymentConfig">
  155. SELECT *
  156. FROM sys_payment_config
  157. WHERE organ_id_ IN
  158. <foreach collection="organIds" item="organId" open="(" close=")" separator=",">
  159. #{organId}
  160. </foreach>
  161. </select>
  162. <!-- 根据支付类型获取支付配置 -->
  163. <select id="getPaymentConfigs" resultMap="SysPaymentConfig">
  164. SELECT spc.*, o.name_ organ_name
  165. FROM sys_payment_config spc
  166. LEFT JOIN organization o on spc.organ_id_ = o.id_
  167. <where>
  168. <if test="payType == null">
  169. pay_type_ IS NOT NULL
  170. AND (spc.yq_mer_no_ !='' OR spc.hf_mer_no_ !='')
  171. </if>
  172. <if test="payType != null">
  173. AND pay_type_ = #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
  174. </if>
  175. <if test='payType != null and payType.code.equals("YQPAY")'>
  176. AND spc.yq_mer_no_ != ''
  177. </if>
  178. <if test='payType != null and payType.code.equals("ADAPAY")'>
  179. AND spc.hf_mer_no_ !=''
  180. </if>
  181. </where>
  182. </select>
  183. <!-- 获取所有账户类型为外部的账户 -->
  184. <select id="getOutAccounts" resultMap="SysPaymentConfig">
  185. SELECT * FROM sys_payment_config WHERE account_type_ = 1
  186. </select>
  187. </mapper>