UserMapperExt.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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.goafanti.common.dao.UserMapper">
  4. <select id="selectPersonalCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
  5. select
  6. a.id as uid,a.type,a.status, date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,
  7. a.service_certification as serviceCertification,
  8. a.user_certification as userCertification,a.current_member_status as
  9. currentMemberStatus,a.identify_name as name,a.lvl,
  10. b.contacts,b.contact_mobile as
  11. contactMobile,b.international,b.expert,b.celebrity,
  12. dg1.name as province,dg2.name as city, dg3.name as area,c.name as industry
  13. from
  14. (select
  15. id,type,status,create_time,service_certification,user_certification,current_member_status,identify_name,lvl
  16. from user
  17. where type = 0
  18. <if test="aid != null and aid !=''">
  19. and aid = #{aid,jdbcType=VARCHAR}
  20. </if>
  21. <if test="shareType != null">
  22. and share_type = #{shareType,jdbcType=VARCHAR}
  23. </if>
  24. <if test="status != null">
  25. and status = #{status,jdbcType=INTEGER}
  26. </if>
  27. <if test="serviceCertification != null">
  28. and service_certification = #{serviceCertification,jdbcType=INTEGER}
  29. </if>
  30. <if test="userCertification != null">
  31. and user_certification = #{userCertification,jdbcType=INTEGER}
  32. </if>
  33. <if test="currentMemberStatus != null">
  34. and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  35. </if>
  36. <if test="startDate != null and startDate != ''">
  37. and create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  38. </if>
  39. <if test="endDate != null and endDate != ''">
  40. and create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  41. </if>
  42. )as a inner join user_identity b on a.id = b.uid
  43. left join district_glossory dg1 on b.province = dg1.id
  44. left join district_glossory dg2 on b.city = dg2.id
  45. left join district_glossory dg3 on b.area = dg3.id
  46. left join industry_category c on b.industry = c.id
  47. where 1=1
  48. <if test="name != null and name !=''">
  49. and b.username = #{name,jdbcType=VARCHAR}
  50. </if>
  51. <if test="province != null">
  52. and b.province = #{province,jdbcType=INTEGER}
  53. </if>
  54. <if test="city != null">
  55. and b.city = #{province,city=INTEGER}
  56. </if>
  57. <if test="province != null">
  58. and b.area = #{area,jdbcType=INTEGER}
  59. </if>
  60. <if test="industry != null">
  61. and b.industry = #{industry,jdbcType=INTEGER}
  62. </if>
  63. <if test="expert != null">
  64. and b.expert = #{expert,jdbcType=INTEGER}
  65. </if>
  66. <if test="celebrity != null">
  67. and b.celebrity = #{celebrity,jdbcType=INTEGER}
  68. </if>
  69. </select>
  70. <select id="selectPersonalCustomerCount" resultType="java.lang.Integer">
  71. select
  72. count(0)
  73. from
  74. (select
  75. id
  76. from user
  77. where type = 0
  78. <if test="aid != null and aid !=''">
  79. and aid = #{aid,jdbcType=VARCHAR}
  80. </if>
  81. <if test="shareType != null">
  82. and share_type = #{shareType,jdbcType=VARCHAR}
  83. </if>
  84. <if test="status != null">
  85. and status = #{status,jdbcType=INTEGER}
  86. </if>
  87. <if test="serviceCertification != null">
  88. and service_certification = #{serviceCertification,jdbcType=INTEGER}
  89. </if>
  90. <if test="userCertification != null">
  91. and user_certification = #{userCertification,jdbcType=INTEGER}
  92. </if>
  93. <if test="currentMemberStatus != null">
  94. and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  95. </if>
  96. <if test="startDate != null and startDate != ''">
  97. and create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  98. </if>
  99. <if test="endDate != null and endDate != ''">
  100. and create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  101. </if>
  102. )as a inner join organization_identity b on a.id = b.uid
  103. where 1=1
  104. <if test="name != null and name !=''">
  105. and b.unit_name = #{name,jdbcType=VARCHAR}
  106. </if>
  107. <if test="province != null">
  108. and b.location_province = #{province,jdbcType=INTEGER}
  109. </if>
  110. <if test="city != null">
  111. and b.location_city = #{province,city=INTEGER}
  112. </if>
  113. <if test="province != null">
  114. and b.location_area = #{area,jdbcType=INTEGER}
  115. </if>
  116. <if test="industry != null">
  117. and b.industry = #{industry,jdbcType=INTEGER}
  118. </if>
  119. <if test="expert != null">
  120. and b.expert = #{expert,jdbcType=INTEGER}
  121. </if>
  122. <if test="celebrity != null">
  123. and b.celebrity = #{celebrity,jdbcType=INTEGER}
  124. </if>
  125. </select>
  126. <select id="selectOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
  127. select
  128. a.id as uid,a.type,a.status, date_format(a.create_time,'%Y-%m-%d
  129. %H:%i:%s') as createTime,a.service_certification as
  130. serviceCertification,
  131. a.user_certification as userCertification,a.current_member_status as
  132. currentMemberStatus,a.identify_name as name,a.lvl,
  133. b.contacts,b.contact_mobile as contactMobile,b.international,b.listed,b.high_tech_zone as highTechZone,
  134. dg1.name as province,dg2.name as city, dg3.name as area,c.name as industry
  135. from
  136. (select
  137. id,type,status,create_time,service_certification,user_certification,current_member_status,identify_name,lvl
  138. from user
  139. where type = 1
  140. <if test="aid != null and aid !=''">
  141. and aid = #{aid,jdbcType=VARCHAR}
  142. </if>
  143. <if test="shareType != null">
  144. and share_type = #{shareType,jdbcType=VARCHAR}
  145. </if>
  146. <if test="status != null">
  147. and status = #{status,jdbcType=INTEGER}
  148. </if>
  149. <if test="serviceCertification != null">
  150. and service_certification = #{serviceCertification,jdbcType=INTEGER}
  151. </if>
  152. <if test="userCertification != null">
  153. and user_certification = #{userCertification,jdbcType=INTEGER}
  154. </if>
  155. <if test="currentMemberStatus != null">
  156. and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  157. </if>
  158. <if test="startDate != null and startDate != ''">
  159. and create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  160. </if>
  161. <if test="endDate != null and endDate != ''">
  162. and create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  163. </if>
  164. )as a inner join organization_identity b on a.id = b.uid
  165. left join district_glossory dg1 on b.location_province = dg1.id
  166. left join district_glossory dg2 on b.location_city = dg2.id
  167. left join district_glossory dg3 on b.location_area = dg3.id
  168. left join industry_category c on b.industry = c.id
  169. where 1=1
  170. <if test="name != null and name != ''">
  171. and b.unit_name = #{name,jdbcType=VARCHAR}
  172. </if>
  173. <if test="province != null">
  174. and b.location_province = #{province,jdbcType=INTEGER}
  175. </if>
  176. <if test="city != null">
  177. and b.location_city = #{province,city=INTEGER}
  178. </if>
  179. <if test="province != null">
  180. and b.location_area = #{area,jdbcType=INTEGER}
  181. </if>
  182. <if test="industry != null">
  183. and b.industry = #{industry,jdbcType=INTEGER}
  184. </if>
  185. <if test="listed != null">
  186. and b.listed = #{listed,jdbcType=INTEGER}
  187. </if>
  188. <if test="highTechZone != null">
  189. and b.high_tech_zone = #{highTechZone,jdbcType=INTEGER}
  190. </if>
  191. </select>
  192. <select id="selectOrganizationCustomerCount" resultType="java.lang.Integer">
  193. select
  194. count(0)
  195. from
  196. (select
  197. id
  198. from user
  199. where type = 1
  200. <if test="aid != null and aid !=''">
  201. and aid = #{aid,jdbcType=VARCHAR}
  202. </if>
  203. <if test="shareType != null">
  204. and share_type = #{shareType,jdbcType=VARCHAR}
  205. </if>
  206. <if test="status != null">
  207. and status = #{status,jdbcType=INTEGER}
  208. </if>
  209. <if test="serviceCertification != null">
  210. and service_certification = #{serviceCertification,jdbcType=INTEGER}
  211. </if>
  212. <if test="userCertification != null">
  213. and user_certification = #{userCertification,jdbcType=INTEGER}
  214. </if>
  215. <if test="currentMemberStatus != null">
  216. and current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  217. </if>
  218. <if test="startDate != null and startDate != ''">
  219. and create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  220. </if>
  221. <if test="endDate != null and endDate != ''">
  222. and create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  223. </if>
  224. )as a inner join organization_identity b on a.id = b.uid
  225. where 1=1
  226. <if test="name != null and name !=''">
  227. and b.unit_name = #{name,jdbcType=VARCHAR}
  228. </if>
  229. <if test="province != null">
  230. and b.location_province = #{province,jdbcType=INTEGER}
  231. </if>
  232. <if test="city != null">
  233. and b.location_city = #{province,city=INTEGER}
  234. </if>
  235. <if test="province != null">
  236. and b.location_area = #{area,jdbcType=INTEGER}
  237. </if>
  238. <if test="industry != null">
  239. and b.industry = #{industry,jdbcType=INTEGER}
  240. </if>
  241. <if test="listed != null">
  242. and b.listed = #{listed,jdbcType=INTEGER}
  243. </if>
  244. <if test="highTechZone != null">
  245. and b.high_tech_zone = #{highTechZone,jdbcType=INTEGER}
  246. </if>
  247. </select>
  248. <select id="findCustomerByName" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
  249. select id,name from user where name like
  250. concat('%',#{identify_name},'%')
  251. </select>
  252. <select id="judgeCustomerByName" parameterType="java.lang.String" resultType="java.lang.Integer">
  253. select count(0) from user where identify_name = #{name,jdbcType=VARCHAR}
  254. </select>
  255. </mapper>