SysPaymentConfigMapper.xml 9.2 KB

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