childChannelMapper.xml 7.7 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.iamberry.wechat.service.mapper.ChildChannelMapper">
  4. <resultMap id="BaseResultMap" type="ChildChannel" >
  5. <result column="child_channel_id" property="childChannelId" />
  6. <result column="child_channel_open_id" property="childChannelOpenId" />
  7. <result column="main_channel_id" property="mainChannelId" />
  8. <result column="child_channel_name" property="childChannelName" />
  9. <result column="child_channel_docking_name" property="childChannelDockingName" />
  10. <result column="child_channel_docking_tel" property="childChannelDockingTel" />
  11. <result column="child_channel_bank" property="childChannelBank" />
  12. <result column="child_channel_bank_account" property="childChannelBankAccount" />
  13. <result column="child_channel_bank_name" property="childChannelBankName" />
  14. <result column="child_channel_bank_branch" property="childChannelBankBranch" />
  15. <result column="child_channel_qrcode" property="childChannelQrcode" />
  16. <result column="child_channel_status" property="childChannelStatus" />
  17. <result column="child_channel_desc" property="childChannelDesc" />
  18. <result column="child_channel_create_time" property="childChannelCreateTime" />
  19. <result column="child_channel_update_time" property="childChannelUpdateTime" />
  20. </resultMap>
  21. <sql id="Base_List" >
  22. t.child_channel_id,
  23. t.child_channel_open_id,
  24. t.main_channel_id,
  25. t.child_channel_name,
  26. t.child_channel_docking_name,
  27. t.child_channel_docking_tel,
  28. t.child_channel_bank,
  29. t.child_channel_bank_account,
  30. t.child_channel_bank_name,
  31. t.child_channel_bank_branch,
  32. t.child_channel_qrcode,
  33. t.child_channel_status,
  34. t.child_channel_desc,
  35. t.child_channel_create_time,
  36. t.child_channel_update_time
  37. </sql>
  38. <select id="getChildChannelList" resultType="ChildChannel" parameterType="ChildChannel" >
  39. select
  40. t.child_channel_id,
  41. t.child_channel_open_id,
  42. t.main_channel_id,
  43. t.child_channel_name,
  44. t.child_channel_docking_name,
  45. t.child_channel_docking_tel,
  46. t.child_channel_bank,
  47. t.child_channel_bank_account,
  48. t.child_channel_bank_name,
  49. t.child_channel_bank_branch,
  50. t.child_channel_qrcode,
  51. t.child_channel_status,
  52. t.child_channel_desc,
  53. t.child_channel_create_time,
  54. t.child_channel_update_time,
  55. mt.main_channel_name
  56. from tb_iamberry_child_channel t
  57. left JOIN tb_iamberry_main_channel mt
  58. ON t.main_channel_id = mt.main_channel_id
  59. <where>
  60. <if test="childChannelId != null ">
  61. AND t.child_channel_id = #{childChannelId}
  62. </if >
  63. <if test="childChannelOpenId != null and childChannelOpenId != ''">
  64. AND t.child_channel_open_id = #{childChannelOpenId}
  65. </if >
  66. <if test="mainChannelId != null ">
  67. AND t.main_channel_id = #{mainChannelId}
  68. </if >
  69. <if test="childChannelName != null and childChannelName != ''">
  70. AND t.child_channel_name like CONCAT ('%',#{childChannelName},'%')
  71. </if >
  72. <if test="childChannelDockingName != null and childChannelDockingName != ''">
  73. AND t.child_channel_docking_name like CONCAT ('%',#{childChannelDockingName},'%')
  74. </if >
  75. <if test="childChannelDockingTel != null and childChannelDockingTel != ''">
  76. AND t.child_channel_docking_tel like CONCAT ('%',#{childChannelDockingTel},'%')
  77. </if >
  78. <if test="childChannelBank != null and childChannelBank != ''">
  79. AND t.child_channel_bank = #{childChannelBank}
  80. </if >
  81. <if test="childChannelBankAccount != null and childChannelBankAccount != ''">
  82. AND t.child_channel_bank_account = #{childChannelBankAccount}
  83. </if >
  84. <if test="childChannelStatus != null ">
  85. AND t.child_channel_status = #{childChannelStatus}
  86. </if >
  87. </where>
  88. </select>
  89. <select id="getChildChannelById" resultMap="BaseResultMap" parameterType="Integer" >
  90. select
  91. <include refid="Base_List" />
  92. from tb_iamberry_child_channel t
  93. where t.child_channel_id= #{childChannelId}
  94. </select>
  95. <insert id="save" parameterType="ChildChannel" >
  96. insert into
  97. tb_iamberry_child_channel
  98. (
  99. child_channel_open_id,
  100. main_channel_id,
  101. child_channel_name,
  102. child_channel_docking_name,
  103. child_channel_docking_tel,
  104. child_channel_bank,
  105. child_channel_bank_account,
  106. child_channel_bank_name,
  107. child_channel_bank_branch,
  108. child_channel_qrcode,
  109. child_channel_status,
  110. child_channel_desc
  111. )
  112. values
  113. (
  114. #{childChannelOpenId},
  115. #{mainChannelId},
  116. #{childChannelName},
  117. #{childChannelDockingName},
  118. #{childChannelDockingTel},
  119. #{childChannelBank},
  120. #{childChannelBankAccount},
  121. #{childChannelBankName},
  122. #{childChannelBankBranch},
  123. #{childChannelQrcode},
  124. #{childChannelStatus},
  125. #{childChannelDesc}
  126. )
  127. </insert>
  128. <update id="update" parameterType="ChildChannel" >
  129. update
  130. tb_iamberry_child_channel
  131. <set >
  132. <if test="childChannelOpenId != null and childChannelOpenId != ''">
  133. child_channel_open_id = #{childChannelOpenId},
  134. </if >
  135. <if test="mainChannelId != null ">
  136. main_channel_id = #{mainChannelId},
  137. </if >
  138. <if test="childChannelName != null and childChannelName != ''">
  139. child_channel_name = #{childChannelName},
  140. </if >
  141. <if test="childChannelDockingName != null and childChannelDockingName != ''">
  142. child_channel_docking_name = #{childChannelDockingName},
  143. </if >
  144. <if test="childChannelDockingTel != null and childChannelDockingTel != ''">
  145. child_channel_docking_tel = #{childChannelDockingTel},
  146. </if >
  147. <if test="childChannelBank != null and childChannelBank != ''">
  148. child_channel_bank = #{childChannelBank},
  149. </if >
  150. <if test="childChannelBankAccount != null and childChannelBankAccount != ''">
  151. child_channel_bank_account = #{childChannelBankAccount},
  152. </if >
  153. <if test="childChannelBankName != null and childChannelBankName != ''">
  154. child_channel_bank_name = #{childChannelBankName},
  155. </if >
  156. <if test="childChannelBankBranch != null and childChannelBankBranch != ''">
  157. child_channel_bank_branch = #{childChannelBankBranch},
  158. </if >
  159. <if test="childChannelQrcode != null and childChannelQrcode != ''">
  160. child_channel_qrcode = #{childChannelQrcode},
  161. </if >
  162. <if test="childChannelStatus != null ">
  163. child_channel_status = #{childChannelStatus},
  164. </if >
  165. <if test="childChannelDesc != null and childChannelDesc != ''">
  166. child_channel_desc = #{childChannelDesc},
  167. </if >
  168. </set >
  169. where child_channel_id= #{childChannelId}
  170. </update>
  171. <delete id="delete" parameterType="Integer" >
  172. delete
  173. tb_iamberry_child_channel
  174. where child_channel_id=#{childChannelId}
  175. </delete>
  176. </mapper>