PayPayAgentbranchMapper.xml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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.bz.smart_city.dao.pay.PayPayAgentbranchMapper">
  4. <insert id="insert" useGeneratedKeys="true" keyProperty="id">
  5. insert into pay_pay_agentbranch(
  6. code,
  7. name,
  8. type,
  9. appid,
  10. appsecret,
  11. mchid,
  12. paykey,
  13. create_by,
  14. create_date,
  15. update_by,
  16. update_date,
  17. remarks,
  18. del_flag,
  19. site_id,
  20. customer_id
  21. )
  22. values
  23. (
  24. #{payPayAgentbranch.code,jdbcType=VARCHAR},
  25. #{payPayAgentbranch.name,jdbcType=VARCHAR},
  26. #{payPayAgentbranch.type,jdbcType=INTEGER},
  27. #{payPayAgentbranch.appid,jdbcType=VARCHAR},
  28. #{payPayAgentbranch.appsecret,jdbcType=VARCHAR},
  29. #{payPayAgentbranch.mchid,jdbcType=VARCHAR},
  30. #{payPayAgentbranch.paykey,jdbcType=VARCHAR},
  31. #{payPayAgentbranch.createBy,jdbcType=BIGINT},
  32. #{payPayAgentbranch.createDate,jdbcType=TIMESTAMP},
  33. #{payPayAgentbranch.updateBy,jdbcType=BIGINT},
  34. #{payPayAgentbranch.updateDate,jdbcType=TIMESTAMP},
  35. #{payPayAgentbranch.remarks,jdbcType=VARCHAR},
  36. #{payPayAgentbranch.delFlag,jdbcType=VARCHAR},
  37. #{payPayAgentbranch.siteId,jdbcType=BIGINT},
  38. #{payPayAgentbranch.customerId,jdbcType=BIGINT}
  39. )
  40. </insert>
  41. <update id="update">
  42. update pay_pay_agentbranch
  43. <set>
  44. <if test="payPayAgentbranch.code != null"> code = #{payPayAgentbranch.code,jdbcType=VARCHAR},</if>
  45. <if test="payPayAgentbranch.name != null"> name = #{payPayAgentbranch.name,jdbcType=VARCHAR},</if>
  46. <if test="payPayAgentbranch.type != null"> type = #{payPayAgentbranch.type,jdbcType=INTEGER},</if>
  47. <if test="payPayAgentbranch.appid != null"> appid = #{payPayAgentbranch.appid,jdbcType=VARCHAR},</if>
  48. <if test="payPayAgentbranch.appsecret != null"> appsecret = #{payPayAgentbranch.appsecret,jdbcType=VARCHAR},</if>
  49. <if test="payPayAgentbranch.mchid != null"> mchid = #{payPayAgentbranch.mchid,jdbcType=VARCHAR},</if>
  50. <if test="payPayAgentbranch.paykey != null"> paykey = #{payPayAgentbranch.paykey,jdbcType=VARCHAR},</if>
  51. <if test="payPayAgentbranch.remarks != null"> remarks = #{payPayAgentbranch.remarks,jdbcType = VARCHAR},</if>
  52. <if test="payPayAgentbranch.updateBy != null"> update_by = #{payPayAgentbranch.updateBy,jdbcType = BIGINT},</if>
  53. <if test="payPayAgentbranch.updateDate != null"> update_date = #{payPayAgentbranch.updateDate,jdbcType=TIMESTAMP}</if>
  54. </set>
  55. where
  56. id=#{payPayAgentbranch.id,jdbcType=BIGINT}
  57. </update>
  58. <delete id="delete">
  59. delete from pay_pay_agentbranch
  60. where id=#{id,jdbcType=BIGINT}
  61. </delete>
  62. <select id="findList" resultType="com.bz.smart_city.entity.pay.PayPayAgentbranch">
  63. select
  64. ppa.id,
  65. ppa.type,
  66. ppa.code,
  67. ppa.mchid,
  68. ppa.paykey,
  69. ppa.appid,
  70. ppa.appsecret,
  71. ppa.name,
  72. ppa.create_by,
  73. ppa.create_date,
  74. ppa.update_by,
  75. ppa.update_date,
  76. ppa.remarks
  77. from pay_pay_agentbranch ppa
  78. where ppa.site_id=#{siteId} and ppa.customer_id=#{customerId}
  79. </select>
  80. <select id="getAll" resultType="com.bz.smart_city.dto.pay.PayPayAgentbranchSelectDto">
  81. select
  82. pa1.id,
  83. pa1.type,
  84. pa1.`code`,
  85. pa1.name,
  86. pa1.mchid,
  87. pa1.paykey paykey,
  88. pa1.appid,
  89. scu.`name` as updateName,
  90. pa1.update_date as updateDate,
  91. psd.label as agentbranchType,
  92. pa2.number as transactionsNumber,
  93. IFNULL(pa2.sumAmount,0) as transactionsMoney
  94. from pay_pay_agentbranch pa1
  95. left join sc_user scu on pa1.update_by=scu.id
  96. left join pay_sys_dict psd on pa1.type = psd.value and psd.type='机构类型' and psd.site_id=#{siteId} and psd.customer_id=#{customerId}
  97. left join (
  98. select count(1) number,sum(trans_fee) sumAmount,machid
  99. from pay_pay_checkbalance
  100. <where>
  101. state != 0 and state != 4
  102. <if test ="startTime != null"> and transtime >= #{startTime,jdbcType=TIMESTAMP}</if>
  103. <if test="siteId != null"> and site_id=#{siteId}</if>
  104. <if test="customerId != null"> and customer_id=#{customerId}</if>
  105. </where>
  106. group by machid) pa2
  107. on pa1.mchid = pa2.machid
  108. <where>
  109. <if test="questParams != null"> (pa1.code like concat('%',#{questParams,jdbcType=VARCHAR} ,'%') or pa1.name like concat('%',#{questParams,jdbcType=VARCHAR} ,'%'))</if>
  110. <if test="siteId != null"> and pa1.site_id=#{siteId}</if>
  111. <if test="customerId != null"> and pa1.customer_id=#{customerId}</if>
  112. </where>
  113. order by pa1.create_date desc
  114. </select>
  115. <select id="ExitsData" resultType="java.lang.Long">
  116. select id from pay_pay_agentbranch
  117. where site_id =#{siteId} and customer_id =#{customerId}
  118. and ( code=#{code} or name=#{name} or mchid=#{mchid} or appid=#{appid})
  119. <if test="id != null and id != ''"> and id <![CDATA[ <> ]]> #{id,jdbcType=BIGINT}</if>
  120. </select>
  121. </mapper>