SysPaymentConfigMapper.xml 6.6 KB

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