BranchManageMapper.xml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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.minpay.db.table.own.mapper.BranchManageMapper">
  4. <select id="queryBranchByLevel" resultType="hashmap" parameterType="java.util.Map">
  5. SELECT
  6. BRH_ID AS "branchId",
  7. BRH_NAME AS "name",
  8. BRH_LEVEL AS "level",
  9. BRH_PARENTID AS "parentId",
  10. BRH_REGIONID AS "regionId",
  11. BRH_DESC AS "desc",
  12. BRH_ADDRESS AS "address",
  13. BRH_STT AS "stt",
  14. BRH_PERSON AS "person",
  15. BRH_PHONE AS "phone",
  16. BRH_SHORTNAME AS "shortName",
  17. brh_name AS "branchName",
  18. usr_name AS "usrName",
  19. COUNT(USR_BRANCHID) AS "count"
  20. FROM IM_BRANCH
  21. LEFT JOIN im_user
  22. ON im_user.USR_BRANCHID = im_branch.BRH_ID
  23. where 1=1
  24. <if test=" bId !=null and bId != ''">
  25. and BRH_ID in(SELECT BRH_ID FROM im_branch WHERE BRH_ID= #{bId,jdbcType=VARCHAR} OR BRH_PARENTID = #{bId,jdbcType=VARCHAR} )
  26. </if>
  27. <if test=" branchId !=null and branchId != ''">
  28. and BRH_ID = #{branchId,jdbcType=VARCHAR}
  29. </if>
  30. <if test=" branchName !=null and branchName != ''">
  31. and BRH_NAME like concat('%' , #{branchName,jdbcType=VARCHAR},'%')
  32. </if>
  33. <if test=" branchStatus !=null and branchStatus != ''">
  34. and BRH_STT = #{branchStatus,jdbcType=VARCHAR}
  35. </if>
  36. <if test=" branchType !=null and branchType != ''">
  37. and BRH_TYPE = #{branchType,jdbcType=VARCHAR}
  38. </if>
  39. GROUP BY BRH_ID
  40. ORDER BY BRH_LEVEL, BRH_ID
  41. </select>
  42. <select id="queryAllBranch" resultType="hashmap" parameterType="java.util.Map">
  43. SELECT
  44. BRH_ID AS "branchId",
  45. BRH_NAME AS "name",
  46. BRH_LEVEL AS "level",
  47. BRH_PARENTID AS "parentId",
  48. BRH_REGIONID AS "regionId",
  49. BRH_DESC AS "desc",
  50. BRH_ADDRESS AS "address",
  51. BRH_STT AS "stt",
  52. BRH_PERSON AS "person",
  53. BRH_PHONE AS "phone",
  54. BRH_SHORTNAME AS "shortName",
  55. brh_name AS "branchName",
  56. usr_name AS "usrName",
  57. COUNT(USR_BRANCHID) AS "count"
  58. FROM IM_BRANCH
  59. LEFT JOIN im_user
  60. ON im_user.USR_BRANCHID = im_branch.BRH_ID
  61. where 1=1
  62. and BRH_STT != "2"
  63. <!-- and BRH_ID in(SELECT brh_id FROM im_branch WHERE FIND_IN_SET(brh_id, getChildBranch({bId,jdbcType=VARCHAR})) ) 0 -->
  64. <if test=" branchId !=null and branchId != ''">
  65. and BRH_ID = #{branchId,jdbcType=VARCHAR}
  66. </if>
  67. <if test=" branchName !=null and branchName != ''">
  68. and BRH_NAME like concat('%' , #{branchName,jdbcType=VARCHAR},'%')
  69. </if>
  70. <if test=" branchStatus !=null and branchStatus != ''">
  71. and BRH_STT = #{branchStatus,jdbcType=VARCHAR}
  72. </if>
  73. <if test=" agentId !=null and agentId != ''">
  74. and BRH_PARENTID = #{agentId,jdbcType=VARCHAR}
  75. </if>
  76. <if test=" branchType !=null and branchType != ''">
  77. and BRH_TYPE = #{branchType,jdbcType=VARCHAR}
  78. </if>
  79. <if test=" person !=null and person != ''">
  80. and BRH_PERSON like concat('%' , #{person,jdbcType=VARCHAR},'%')
  81. </if>
  82. <if test=" phone !=null and phone != ''">
  83. and BRH_PHONE like concat('%' , #{phone,jdbcType=VARCHAR},'%')
  84. </if>
  85. GROUP BY BRH_ID
  86. ORDER BY BRH_ID desc
  87. </select>
  88. <select id="queryAllSchool" resultType="hashmap" parameterType="java.util.Map">
  89. SELECT BRH_ID AS "branchId",
  90. BRH_NAME AS "name",
  91. BRH_LEVEL AS "level",
  92. BRH_PARENTID AS "parentId",
  93. BRH_REGIONID AS "regionId",
  94. BRH_DESC AS "desc",
  95. BRH_ADDRESS AS "address",
  96. BRH_STT AS "stt",
  97. BRH_PERSON AS "person",
  98. BRH_PHONE AS "phone",
  99. BRH_SHORTNAME AS "shortName",
  100. BRH_TYPE AS "branchType",
  101. BRH_IMG AS "img",
  102. BRH_CONTENT AS "content",
  103. BRH_NAME AS "branchName",
  104. BRH_PROVINCE AS "province",
  105. BRH_CITY AS "city",
  106. BRH_AREA AS "area",
  107. MCD_CODE as "code"
  108. FROM IM_BRANCH
  109. LEFT JOIN ms_invite_code ON MCD_BRANCHID = BRH_ID
  110. where 1=1
  111. <!-- and BRH_ID in(SELECT brh_id FROM im_branch WHERE FIND_IN_SET(brh_id, getChildBranch({bId,jdbcType=VARCHAR})) ) 0 -->
  112. <if test=" branchName !=null and branchName != ''">
  113. and BRH_NAME like concat('%' , #{branchName,jdbcType=VARCHAR},'%')
  114. </if>
  115. <if test=" branchStatus !=null and branchStatus != ''">
  116. and BRH_STT = #{branchStatus,jdbcType=VARCHAR}
  117. </if>
  118. <if test=" type !=null and type != ''">
  119. and BRH_TYPE = #{type,jdbcType=VARCHAR}
  120. </if>
  121. <if test=" agentId !=null and agentId != ''">
  122. and BRH_PARENTID = #{agentId,jdbcType=VARCHAR}
  123. </if>
  124. <if test=" branchId !=null and branchId != ''">
  125. and BRH_ID = #{branchId,jdbcType=VARCHAR}
  126. </if>
  127. ORDER BY BRH_ID desc
  128. </select>
  129. <select id="queryBranchNo" resultType="hashmap" parameterType="java.util.Map">
  130. SELECT BRH_ID AS "branchNo",
  131. BRH_NAME AS "branchName"
  132. FROM IM_BRANCH
  133. WHERE BRH_LEVEL = '1'
  134. </select>
  135. <select id="queryBranchNoByPointNo" resultType="hashmap" parameterType="java.util.Map">
  136. SELECT BRH_ID AS "branchNo",
  137. BRH_NAME AS "branchName"
  138. FROM IM_BRANCH
  139. WHERE
  140. <if test=" pointNo !=null and pointNo != ''">
  141. BRH_ID = #{pointNo,jdbcType=VARCHAR}
  142. </if>
  143. </select>
  144. <select id="getUnInstallSchool" resultType="hashmap" parameterType="java.util.Map">
  145. SELECT BRH_ID AS "branchNo",
  146. BRH_NAME AS "branchName",
  147. BRH_TYPE AS "type",
  148. BRH_LEVEL AS "level"
  149. FROM IM_BRANCH
  150. WHERE BRH_TYPE = '02'
  151. AND BRH_READY = #{ready,jdbcType=VARCHAR}
  152. AND BRH_STT = #{state,jdbcType=VARCHAR}
  153. AND BRH_ID NOT IN (
  154. SELECT MWT_BRHID
  155. FROM ms_worker_task )
  156. </select>
  157. <select id="getChildBranch" resultType="hashmap" parameterType="java.util.Map">
  158. SELECT BRH_ID AS "branchId",
  159. BRH_NAME AS "branchName"
  160. FROM IM_BRANCH
  161. WHERE
  162. BRH_ID = #{branchId,jdbcType=VARCHAR} OR
  163. BRH_PARENTID = #{branchId,jdbcType=VARCHAR}
  164. ORDER BY BRH_LEVEL, BRH_ID
  165. </select>
  166. <select id="getChildBranchById" resultType="hashmap" parameterType="java.util.Map">
  167. SELECT BRH_ID AS "branchId",
  168. BRH_NAME AS "branchName"
  169. FROM IM_BRANCH
  170. WHERE BRH_PARENTID = #{branchId,jdbcType=VARCHAR}
  171. ORDER BY BRH_LEVEL, BRH_ID
  172. </select>
  173. <update id="updateBranchUrl" parameterType="java.util.Map">
  174. UPDATE im_branch SET
  175. BRH_URL = (#{url,jdbcType=VARCHAR})
  176. WHERE
  177. <if test="branchId != null and branchId != ''">
  178. BRH_ID= (#{branchId,jdbcType=VARCHAR})
  179. </if>
  180. </update>
  181. <update id="updateBranchUrlState" parameterType="java.util.Map">
  182. UPDATE im_branch SET
  183. <if test="urlState != null and urlState != ''">
  184. BRH_URLSTATE = (#{urlState,jdbcType=VARCHAR})
  185. </if>
  186. WHERE
  187. <if test="branchId != null and branchId != ''">
  188. BRH_ID= (#{branchId,jdbcType=VARCHAR})
  189. </if>
  190. </update>
  191. </mapper>