UserMapperExt.xml 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268
  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,
  7. a.type,
  8. a.status,
  9. date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,
  10. a.business_audit as businessAudit,
  11. a.current_member_status as currentMemberStatus,
  12. a.identify_name as name,
  13. a.lvl,a.is_member as isMember,
  14. a.society_tag as societyTag,
  15. a.share_type as shareType,
  16. b.contacts,
  17. b.contact_mobile as contactMobile,
  18. b.international,
  19. b.expert,
  20. b.audit_status as auditStatus,
  21. dg1.name as province,
  22. dg2.name as city,
  23. dg3.name as area,
  24. c.name as industry,
  25. d.name as adminName,
  26. b.expert_audit as expertAudit
  27. from user a inner join user_identity b on a.id = b.uid
  28. left join district_glossory dg1 on b.province = dg1.id
  29. left join district_glossory dg2 on b.city = dg2.id
  30. left join district_glossory dg3 on b.area = dg3.id
  31. left join industry_category c on b.industry = c.id
  32. left join admin d on a.aid = d.id
  33. where a.type = 0 and a.status != 1 and a.audit_status = 1
  34. AND a.audit_status=1
  35. <if test="aid != null and aid !=''">
  36. and a.aid = #{aid,jdbcType=VARCHAR}
  37. </if>
  38. <if test="expertAudit != null and expertAudit !=''">
  39. and b.expert_audit = #{expertAudit,jdbcType=VARCHAR}
  40. </if>
  41. <if test="name != null and name != ''">
  42. and a.identify_name like concat('%',#{name},'%')
  43. </if>
  44. <if test="shareType != null">
  45. and a.share_type = #{shareType,jdbcType=VARCHAR}
  46. </if>
  47. <if test="status != null">
  48. and a.status = #{status,jdbcType=INTEGER}
  49. </if>
  50. <if test="businessAudit != null">
  51. and a.business_audit = #{businessAudit,jdbcType=INTEGER}
  52. </if>
  53. <if test="isMember != null">
  54. and a.is_member = #{isMember,jdbcType=INTEGER}
  55. </if>
  56. <if test="lvl != null">
  57. and a.lvl = #{lvl,jdbcType=INTEGER}
  58. </if>
  59. <if test="currentMemberStatus != null">
  60. and a.current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  61. </if>
  62. <if test="societyTag != null and societyTag != ''">
  63. and a.society_tag = #{societyTag,jdbcType=VARCHAR}
  64. </if>
  65. <if test="startDate != null and startDate != ''">
  66. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  67. </if>
  68. <if test="endDate != null and endDate != ''">
  69. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  70. </if>
  71. <if test="province != null">
  72. and b.province = #{province,jdbcType=INTEGER}
  73. </if>
  74. <if test="city != null">
  75. and b.city = #{city,jdbcType=INTEGER}
  76. </if>
  77. <if test="area != null">
  78. and b.area = #{area,jdbcType=INTEGER}
  79. </if>
  80. <if test="industry != null">
  81. and b.industry = #{industry,jdbcType=INTEGER}
  82. </if>
  83. <if test="expert != null">
  84. and b.expert = #{expert,jdbcType=INTEGER}
  85. </if>
  86. <if test="international != null">
  87. and b.international = #{international,jdbcType=INTEGER}
  88. </if>
  89. <if test="auditStatus != null">
  90. and b.audit_status = #{auditStatus,jdbcType=INTEGER}
  91. </if>
  92. <if test="page_sql != null">
  93. ${page_sql}
  94. </if>
  95. </select>
  96. <select id="selectPersonalCustomerCount" resultType="java.lang.Integer">
  97. select count(0)
  98. from user a inner join user_identity b on a.id = b.uid
  99. left join district_glossory dg1 on b.province = dg1.id
  100. left join district_glossory dg2 on b.city = dg2.id
  101. left join district_glossory dg3 on b.area = dg3.id
  102. left join industry_category c on b.industry = c.id
  103. left join admin d on a.aid = d.id
  104. where a.type = 0 and a.status != 1 and a.audit_status = 1
  105. AND b.expert_audit=2
  106. <if test="aid != null and aid !=''">
  107. and a.aid = #{aid,jdbcType=VARCHAR}
  108. </if>
  109. <if test="name != null and name != ''">
  110. and a.identify_name like concat('%',#{name},'%')
  111. </if>
  112. <if test="shareType != null">
  113. and a.share_type = #{shareType,jdbcType=VARCHAR}
  114. </if>
  115. <if test="status != null">
  116. and a.status = #{status,jdbcType=INTEGER}
  117. </if>
  118. <if test="businessAudit != null">
  119. and a.business_audit = #{businessAudit,jdbcType=INTEGER}
  120. </if>
  121. <if test="isMember != null">
  122. and a.is_member = #{isMember,jdbcType=INTEGER}
  123. </if>
  124. <if test="lvl != null">
  125. and a.lvl = #{lvl,jdbcType=INTEGER}
  126. </if>
  127. <if test="currentMemberStatus != null">
  128. and a.current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  129. </if>
  130. <if test="societyTag != null and societyTag != ''">
  131. and a.society_tag = #{societyTag,jdbcType=VARCHAR}
  132. </if>
  133. <if test="startDate != null and startDate != ''">
  134. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  135. </if>
  136. <if test="endDate != null and endDate != ''">
  137. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  138. </if>
  139. <if test="province != null">
  140. and b.province = #{province,jdbcType=INTEGER}
  141. </if>
  142. <if test="city != null">
  143. and b.city = #{city,jdbcType=INTEGER}
  144. </if>
  145. <if test="area != null">
  146. and b.area = #{area,jdbcType=INTEGER}
  147. </if>
  148. <if test="industry != null">
  149. and b.industry = #{industry,jdbcType=INTEGER}
  150. </if>
  151. <if test="expert != null">
  152. and b.expert = #{expert,jdbcType=INTEGER}
  153. </if>
  154. <if test="international != null">
  155. and b.international = #{international,jdbcType=INTEGER}
  156. </if>
  157. <if test="auditStatus != null">
  158. and b.audit_status = #{auditStatus,jdbcType=INTEGER}
  159. </if>
  160. </select>
  161. <select id="selectOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
  162. select
  163. a.id as uid,
  164. a.type,
  165. a.status,
  166. date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,
  167. a.business_audit as businessAudit,
  168. a.current_member_status as currentMemberStatus,
  169. a.identify_name as name,
  170. a.lvl,
  171. a.is_member as isMember,
  172. a.society_tag as societyTag,
  173. share_type as shareType,
  174. b.contacts,
  175. b.contact_mobile as contactMobile,
  176. b.international,
  177. b.listed,
  178. b.high_tech_zone as highTechZone,
  179. b.audit_status as auditStatus,
  180. dg1.name as province,
  181. dg2.name as city,
  182. dg3.name as area,
  183. c.name as industry,
  184. d.name as adminName
  185. from user a inner join organization_identity b on a.id = b.uid
  186. left join district_glossory dg1 on b.location_province = dg1.id
  187. left join district_glossory dg2 on b.location_city = dg2.id
  188. left join district_glossory dg3 on b.location_area = dg3.id
  189. left join industry_category c on b.industry = c.id
  190. left join admin d on a.aid = d.id
  191. where a.type = 1 and a.status != 1 and a.audit_status = 1
  192. <if test="aid != null and aid !=''">
  193. and a.aid = #{aid,jdbcType=VARCHAR}
  194. </if>
  195. <if test="name != null and name != ''">
  196. and a.identify_name like concat('%',#{name},'%')
  197. </if>
  198. <if test="shareType != null">
  199. and a.share_type = #{shareType,jdbcType=VARCHAR}
  200. </if>
  201. <if test="status != null">
  202. and a.status = #{status,jdbcType=INTEGER}
  203. </if>
  204. <if test="businessAudit != null">
  205. and a.business_audit = #{businessAudit,jdbcType=INTEGER}
  206. </if>
  207. <if test="isMember != null">
  208. and a.is_member = #{isMember,jdbcType=INTEGER}
  209. </if>
  210. <if test="currentMemberStatus != null">
  211. and a.current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  212. </if>
  213. <if test="lvl != null">
  214. and a.lvl = #{lvl,jdbcType=INTEGER}
  215. </if>
  216. <if test="societyTag != null and societyTag != ''">
  217. and a.society_tag = #{societyTag,jdbcType=VARCHAR}
  218. </if>
  219. <if test="startDate != null and startDate != ''">
  220. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  221. </if>
  222. <if test="endDate != null and endDate != ''">
  223. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  224. </if>
  225. <if test="province != null">
  226. and b.location_province = #{province,jdbcType=INTEGER}
  227. </if>
  228. <if test="city != null">
  229. and b.location_city = #{city,jdbcType=INTEGER}
  230. </if>
  231. <if test="area != null">
  232. and b.location_area = #{area,jdbcType=INTEGER}
  233. </if>
  234. <if test="industry != null">
  235. and b.industry = #{industry,jdbcType=INTEGER}
  236. </if>
  237. <if test="listed != null">
  238. and b.listed = #{listed,jdbcType=INTEGER}
  239. </if>
  240. <if test="highTechZone != null">
  241. and b.high_tech_zone = #{highTechZone,jdbcType=INTEGER}
  242. </if>
  243. <if test="international != null">
  244. and b.international = #{international,jdbcType=INTEGER}
  245. </if>
  246. <if test="auditStatus != null">
  247. and b.audit_status = #{auditStatus,jdbcType=INTEGER}
  248. </if>
  249. <if test="page_sql != null">
  250. ${page_sql}
  251. </if>
  252. </select>
  253. <select id="selectOrganizationCustomerCount" resultType="java.lang.Integer">
  254. select
  255. count(0)
  256. from user a inner join organization_identity b on a.id = b.uid
  257. where a.type = 1 and a.status != 1 and a.audit_status = 1
  258. <if test="aid != null and aid !=''">
  259. and a.aid = #{aid,jdbcType=VARCHAR}
  260. </if>
  261. <if test="name != null and name != ''">
  262. and a.identify_name like concat('%',#{name},'%')
  263. </if>
  264. <if test="shareType != null">
  265. and a.share_type = #{shareType,jdbcType=VARCHAR}
  266. </if>
  267. <if test="status != null">
  268. and a.status = #{status,jdbcType=INTEGER}
  269. </if>
  270. <if test="businessAudit != null">
  271. and a.business_audit = #{businessAudit,jdbcType=INTEGER}
  272. </if>
  273. <if test="currentMemberStatus != null">
  274. and a.current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  275. </if>
  276. <if test="isMember != null">
  277. and a.is_member = #{isMember,jdbcType=INTEGER}
  278. </if>
  279. <if test="societyTag != null and societyTag != ''">
  280. and a.society_tag = #{societyTag,jdbcType=VARCHAR}
  281. </if>
  282. <if test="startDate != null and startDate != ''">
  283. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  284. </if>
  285. <if test="endDate != null and endDate != ''">
  286. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  287. </if>
  288. <if test="province != null">
  289. and b.location_province = #{province,jdbcType=INTEGER}
  290. </if>
  291. <if test="city != null">
  292. and b.location_city = #{city,jdbcType=INTEGER}
  293. </if>
  294. <if test="area != null">
  295. and b.location_area = #{area,jdbcType=INTEGER}
  296. </if>
  297. <if test="industry != null">
  298. and b.industry = #{industry,jdbcType=INTEGER}
  299. </if>
  300. <if test="listed != null">
  301. and b.listed = #{listed,jdbcType=INTEGER}
  302. </if>
  303. <if test="highTechZone != null">
  304. and b.high_tech_zone = #{highTechZone,jdbcType=INTEGER}
  305. </if>
  306. <if test="international != null">
  307. and b.international = #{international,jdbcType=INTEGER}
  308. </if>
  309. <if test="auditStatus != null">
  310. and b.audit_status = #{auditStatus,jdbcType=INTEGER}
  311. </if>
  312. </select>
  313. <select id="findCustomerByName" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerSimpleBo">
  314. select id,identify_name as name from user where identify_name like
  315. concat('%',#{identifyName},'%') and status <![CDATA[!= ]]> 1 and audit_status = 1
  316. </select>
  317. <select id="judgeCustomerByName" resultType="java.lang.Integer">
  318. select count(0) from user where identify_name = #{identifyName,jdbcType=VARCHAR}
  319. and status <![CDATA[!= ]]> 1
  320. </select>
  321. <select id="findOrganizationCustomerDetail" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerOrganizationDetailBo">
  322. select
  323. a.id as uid,
  324. a.society_tag as societyTag,
  325. a.company_logo_url as companyLogoUrl,
  326. a.introduction,
  327. a.identify_name as identifyName,
  328. a.business_audit as businessAudit,
  329. b.industry,
  330. b.location_province as locationProvince,
  331. b.location_city as locationCity,
  332. b.location_area as locationArea,
  333. b.postal_address as postalAddress,
  334. b.contacts_fixed_tel as contactsFixedTel,
  335. b.contacts_fax as contactsFax,
  336. b.registered_capital registeredCapital,
  337. b.enterprise_scale as enterpriseScale,
  338. b.legal_person as legalPerson,
  339. b.legal_person_id_card as legalPersonIdCard,
  340. b.legal_person_tel as legalPersonTel,
  341. b.legal_person_email as legalPersonEmail,
  342. b.high_tech_zone highTechZone,
  343. b.listed,
  344. b.international,
  345. b.org_code as orgCode,
  346. b.org_code_url as orgCodeUrl,
  347. b.business_scope as businessScope,
  348. b.id,
  349. b.contacts,
  350. b.contact_mobile as contactMobile,
  351. b.audit_status as auditStatus,
  352. b.licence_number as licenceNumber,
  353. a.aid as aid,d.name as adminName
  354. from
  355. user a inner join organization_identity b on a.id = b.uid
  356. left join admin d on d.id = a.aid
  357. where
  358. a.id = #{uid,jdbcType=VARCHAR}
  359. </select>
  360. <select id="findPersonalCustomerDetail" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerPersonalDetailBo">
  361. select
  362. a.id as uid,
  363. a.identify_name as identifyName,
  364. a.society_tag as societyTag,
  365. a.head_portrait_url as headPortraitUrl,
  366. a.introduction,
  367. a.business_audit as businessAudit,
  368. b.id,
  369. b.industry,
  370. b.sex,
  371. b.date_of_birth_year as dateOfBirthYear,
  372. b.date_of_birth_month as dateOfBirthMonth,
  373. b.id_number as idNumber,
  374. b.province,
  375. b.city,
  376. b.area,
  377. b.positive_id_url as positiveIdUrl,
  378. b.opposite_id_url as oppositeIdUrl,
  379. b.postal_address as postalAddress,
  380. b.contact_mobile as contactMobile,
  381. b.fixed_tel as fixedTel,
  382. b.email,
  383. b.expert,
  384. b.international,
  385. b.contacts,
  386. b.contact_mobile as contactMobile,
  387. b.qq,
  388. b.professional_title as professionalTitle,
  389. b.work_unit as workUnit,
  390. b.education,
  391. b.major_category as majorCategory,
  392. b.qualification,
  393. b.audit_status as auditStatus,
  394. b.graduate_school as graduateSchool,
  395. b.consultation_price as consultationPrice,
  396. b.expert_audit as expertAudit,
  397. b.release_status as releaseStatus,
  398. a.aid as aid,d.name as adminName
  399. from
  400. user a inner join user_identity b on
  401. a.id = b.uid
  402. left join admin d on d.id = a.aid
  403. where
  404. a.id = #{uid,jdbcType=VARCHAR}
  405. </select>
  406. <select id="selectFollowHistoryList" resultType="com.goafanti.customer.bo.FollowListBo">
  407. select
  408. a.id as followId,
  409. a.create_time as followTime,
  410. a.contact_type as contactType,
  411. a.result,
  412. b.identify_name as identifyName,
  413. c.name as contacts,
  414. c.mobile as contactMobile,
  415. d.name as adminName
  416. <if test="businessGlossoryId != null and businessGlossoryId != ''"><!-- 客户甲项目A所有的跟进记录 -->
  417. ,e.id as ufbId,e.follow_situation as followSituation,e.customer_status as customerStatus
  418. </if>
  419. from user_follow a
  420. left join user b on a.uid = b.id
  421. left join organization_contact_book c on a.ocb_id = c.id
  422. left join admin d on a.aid = d.id
  423. <if test="businessGlossoryId != null and businessGlossoryId != ''"><!-- 客户甲项目A所有的跟进记录 -->
  424. inner join user_follow_business e on a.id = e.follow_id
  425. </if>
  426. where a.effective = 0
  427. <if test="uid != null and uid != ''">
  428. and a.uid = #{uid,jdbcType=VARCHAR}
  429. </if>
  430. <if test="aid != null and aid != ''">
  431. and a.aid = #{aid,jdbcType=VARCHAR}
  432. </if>
  433. <if test="businessGlossoryId != null and businessGlossoryId != ''"><!-- 客户甲项目A所有的跟进记录 -->
  434. and e.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  435. </if>
  436. <if test="page_sql != null">
  437. ${page_sql}
  438. </if>
  439. </select>
  440. <select id="selectFollowHistoryCount" resultType="java.lang.Integer">
  441. select
  442. count(0)
  443. from user_follow a
  444. left join user b on a.uid = b.id
  445. left join organization_contact_book c on a.ocb_id = c.id
  446. left join admin d on a.aid = d.id
  447. <if test="businessGlossoryId != null and businessGlossoryId != ''"><!-- 客户甲项目A所有的跟进记录 -->
  448. inner join user_follow_business e on a.id = e.follow_id
  449. </if>
  450. where a.effective = 0
  451. <if test="uid != null and uid != ''">
  452. and a.uid = #{uid,jdbcType=VARCHAR}
  453. </if>
  454. <if test="aid != null and aid != ''">
  455. and a.aid = #{aid,jdbcType=VARCHAR}
  456. </if>
  457. <if test="businessGlossoryId != null and businessGlossoryId != ''"><!-- 客户甲项目A所有的跟进记录 -->
  458. and e.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  459. </if>
  460. </select>
  461. <select id="findUserAccountDetail" parameterType="java.lang.String" resultType="com.goafanti.common.model.User">
  462. select
  463. id,
  464. mobile,
  465. nickname,
  466. create_time as createTime,
  467. type,
  468. source,
  469. email,
  470. is_member as isMember,
  471. lvl,
  472. current_member_status currentMemberStatus,
  473. business_audit as businessAudit,
  474. identify_name as identifyName,
  475. status
  476. from
  477. user
  478. where id = #{uid,jdbcType=VARCHAR}
  479. </select>
  480. <select id="findCustomerContacts" parameterType="java.lang.String" resultType="com.goafanti.common.model.OrganizationContactBook">
  481. select id,name,mobile,email,qq,wechat,depatrment,position from organization_contact_book
  482. where uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
  483. </select>
  484. <select id="findAllContacts" parameterType="java.lang.String" resultType="com.goafanti.common.model.OrganizationContactBook">
  485. select id,name,mobile from organization_contact_book
  486. where uid = #{uid,jdbcType=VARCHAR}
  487. </select>
  488. <select id="findFollowById" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.FollowBusinessBo">
  489. select
  490. a.id as followId,
  491. a.uid,
  492. a.ocb_id as ocbId,
  493. a.contact_type as contactType,
  494. a.result,
  495. a.create_time as followTime,
  496. b.identify_name as identifyName,
  497. c.name as contacts,
  498. c.mobile as contactType,
  499. d.name as adminName
  500. from
  501. user_follow a
  502. left join user b on a.uid = b.id
  503. left join organization_contact_book c on a.ocb_id = c.id
  504. left join admin d on a.aid = d.id
  505. where a.id = #{followId,jdbcType=VARCHAR}
  506. </select>
  507. <select id="customerStatisticsList" resultType="com.goafanti.customer.bo.StatisticBo">
  508. select a.*,b.name as adminName,c.name as departmentName from (
  509. select
  510. aid,
  511. sum(case when customer_status = 0 then 1 else 0 end) as newNo, <!-- 新客户 -->
  512. sum(case when customer_status = 1 then 1 else 0 end) as intentionNo, <!-- 意向客户 -->
  513. sum(case when customer_status = 2 then 1 else 0 end) as pointNo, <!-- 重点客户 -->
  514. sum(case when customer_status = 3 then 1 else 0 end) as interviewNo, <!-- 面谈客户 -->
  515. sum(case when customer_status = 4 then 1 else 0 end) as signNo, <!-- 签单客户 -->
  516. sum(case when customer_status = 5 then 1 else 0 end) as refuseNo, <!-- 拒绝客户 -->
  517. sum(case when customer_status = 6 then 1 else 0 end) as stopNo <!-- 停止跟进 -->
  518. from user_business where 1=1
  519. <if test="sDate != null">
  520. and create_time &gt; #{sDate,jdbcType=DATE}
  521. </if>
  522. <if test="eDate != null">
  523. and create_time &lt; #{eDate,jdbcType=DATE}
  524. </if>
  525. <if test="businessGlossoryId != null">
  526. and business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  527. </if>
  528. group by aid
  529. )a
  530. left join admin b on a.aid = b.id
  531. left join department_management c on b.department_id = c.id
  532. <if test="depNo != null">
  533. where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
  534. </if>
  535. <if test="page_sql != null">
  536. ${page_sql}
  537. </if>
  538. </select>
  539. <select id="customerStatisticsCount" resultType="java.lang.Integer">
  540. select count(0) from (
  541. select
  542. aid
  543. from user_business where 1=1
  544. <if test="sDate != null">
  545. and create_time &gt; #{sDate,jdbcType=DATE}
  546. </if>
  547. <if test="eDate != null">
  548. and create_time &lt; #{eDate,jdbcType=DATE}
  549. </if>
  550. <if test="businessGlossoryId != null">
  551. and business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  552. </if>
  553. group by aid
  554. )a
  555. left join admin b on a.aid = b.id
  556. left join department_management c on b.department_id = c.id
  557. <if test="depNo !=null">
  558. where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
  559. </if>
  560. </select>
  561. <select id="businessStatisticList" resultType="com.goafanti.customer.bo.StatisticBo">
  562. select a.*,b.name as adminName,c.name as departmentName from (
  563. select
  564. aid,
  565. sum(case when follow_situation = 0 then 1 else 0 end) as sendMaterialNo, <!-- 已发项目介绍资料 -->
  566. sum(case when follow_situation = 1 then 1 else 0 end) as interviewNo, <!-- 已约面谈 -->
  567. sum(case when follow_situation = 2 then 1 else 0 end) as sendProspectusNo, <!-- 已发合同计划书 -->
  568. sum(case when follow_situation = 3 then 1 else 0 end) as quoteNo, <!-- 已报价 -->
  569. sum(case when follow_situation = 4 then 1 else 0 end) as sendContractNo, <!-- 已发合同 -->
  570. sum(case when follow_situation = 5 then 1 else 0 end) as signContractNo, <!-- 已签合同 -->
  571. sum(case when follow_situation = 6 then 1 else 0 end) as onVisaNo, <!-- 面谈中 -->
  572. sum(case when follow_situation = 7 then 1 else 0 end) as visaNo <!-- 已面签 -->
  573. from user_business where 1=1
  574. <if test="sDate != null">
  575. and create_time &gt; #{sDate,jdbcType=DATE}
  576. </if>
  577. <if test="eDate != null">
  578. and create_time &lt; #{eDate,jdbcType=DATE}
  579. </if>
  580. <if test="businessGlossoryId != null">
  581. and business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  582. </if>
  583. group by aid
  584. )a
  585. left join admin b on a.aid = b.id
  586. left join department_management c on b.department_id = c.id
  587. <if test="depNo !=null">
  588. where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
  589. </if>
  590. <if test="page_sql != null">
  591. ${page_sql}
  592. </if>
  593. </select>
  594. <select id="businessStatisticCount" resultType="java.lang.Integer">
  595. select count(0) from (
  596. select
  597. aid
  598. from user_business where 1=1
  599. <if test="sDate != null">
  600. and create_time &gt; #{sDate,jdbcType=DATE}
  601. </if>
  602. <if test="eDate != null">
  603. and create_time &lt; #{eDate,jdbcType=DATE}
  604. </if>
  605. <if test="businessGlossoryId != null">
  606. and business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  607. </if>
  608. group by aid
  609. )a
  610. left join admin b on a.aid = b.id
  611. left join department_management c on b.department_id = c.id
  612. <if test="depNo !=null">
  613. where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
  614. </if>
  615. </select>
  616. <select id="followStatisticList" resultType="com.goafanti.customer.bo.StatisticBo">
  617. select x.*,b.name as adminName,c.name as departmentName,y.* from (
  618. select
  619. count(0) as followNo,
  620. aid,
  621. sum(case when contact_type = 0 then 1 else 0 end) as visitNo, <!-- 外出 -->
  622. sum(case when contact_type = 1 then 1 else 0 end) as telNo, <!-- 电话 -->
  623. sum(case when contact_type = 2 then 1 else 0 end) as qqNo, <!-- QQ -->
  624. sum(case when contact_type = 3 then 1 else 0 end) as wxNo, <!-- 微信 -->
  625. sum(case when contact_type = 4 then 1 else 0 end) as emailNo, <!-- 邮件 -->
  626. sum(case when contact_type = 5 then 1 else 0 end) as letterNo <!-- 书信 -->
  627. from user_follow where 1=1
  628. <if test="sDate != null">
  629. and create_time &gt; #{sDate,jdbcType=DATE}
  630. </if>
  631. <if test="eDate != null">
  632. and create_time &lt; #{eDate,jdbcType=DATE}
  633. </if>
  634. group by aid
  635. )x
  636. left join admin b on x.aid = b.id
  637. left join department_management c on b.department_id = c.id
  638. left join
  639. (
  640. select
  641. count( 0 ) as customerNo,
  642. aid
  643. from
  644. (
  645. select
  646. aid,
  647. uid
  648. from
  649. user_follow
  650. group by
  651. aid,
  652. uid
  653. ) a
  654. group by
  655. aid
  656. )y on x.aid = y.aid
  657. <if test="depNo !=null">
  658. where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
  659. </if>
  660. </select>
  661. <select id="followStatisticCount" resultType="java.lang.Integer">
  662. select count(0) from (
  663. select
  664. aid
  665. from user_follow where 1=1
  666. <if test="sDate != null">
  667. and create_time &gt; #{sDate,jdbcType=DATE}
  668. </if>
  669. <if test="sDate != null">
  670. and create_time &lt; #{eDate,jdbcType=DATE}
  671. </if>
  672. group by aid
  673. )x
  674. left join admin b on x.aid = b.id
  675. left join department_management c on b.department_id = c.id
  676. <if test="depNo !=null">
  677. where c.dep_no like concat(#{depNo,jdbcType=VARCHAR},'%')
  678. </if>
  679. </select>
  680. <select id="findBusinessByFollowId" parameterType="java.lang.String" resultType="com.goafanti.common.model.UserBusiness">
  681. select
  682. a.id,
  683. a.follow_situation as followSituation,
  684. a.customer_status as customerStatus,
  685. a.remarks,
  686. a.business_glossory_id as businessGlossoryId
  687. from
  688. user_follow_business a
  689. where a.follow_id = #{followId,jdbcType=VARCHAR}
  690. </select>
  691. <select id="selectBusinessList" resultType="com.goafanti.customer.bo.BusinessListBo">
  692. select
  693. c.name as businessName,
  694. b.identify_name as identifyName,
  695. a.id as businessId,
  696. a.create_time as createTime,
  697. a.update_time as updateTime,
  698. a.follow_situation as followSituation,
  699. a.customer_status as customerStatus,
  700. d.name as adminName
  701. from
  702. user_business a inner join user b on
  703. a.uid = b.id left join business_glossory c on
  704. a.business_glossory_id = c.id left join admin d on
  705. a.aid = d.id
  706. where 1 = 1
  707. <if test="aid != null and aid != ''">
  708. and a.aid = #{aid,jdbcType=VARCHAR}
  709. </if>
  710. <if test="uid != null and uid !=''">
  711. and a.uid = #{uid,jdbcType=VARCHAR}
  712. </if>
  713. <if test="businessGlossoryId !=null and businessGlossoryId != ''">
  714. and a.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  715. </if>
  716. <if test="identifyName != null and identifyName != ''">
  717. and b.identify_name like concat('%', #{identifyName},'%')
  718. </if>
  719. <if test="followSituation != null">
  720. and a.follow_situation = #{followSituation,jdbcType=INTEGER}
  721. </if>
  722. <if test="customerStatus != null">
  723. and a.customer_status = #{customerStatus,jdbcType=INTEGER}
  724. </if>
  725. <if test="adminName != null and adminName != ''">
  726. and d.name = #{adminName,jdbcType=VARCHAR}
  727. </if>
  728. <if test="startDate != null and startDate != ''">
  729. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  730. </if>
  731. <if test="endDate != null and endDate != ''">
  732. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  733. </if>
  734. <if test="page_sql != null">
  735. ${page_sql}
  736. </if>
  737. </select>
  738. <select id="selectBusinessCount" parameterType="com.goafanti.customer.bo.BusinessListBo" resultType="java.lang.Integer">
  739. select
  740. count(0)
  741. from
  742. user_business a inner join user b on
  743. a.uid = b.id left join business_glossory c on
  744. a.business_glossory_id = c.id left join admin d on
  745. a.aid = d.id
  746. where 1 = 1
  747. <if test="aid != null and aid != ''">
  748. and a.aid = #{aid,jdbcType=VARCHAR}
  749. </if>
  750. <if test="uid != null and uid !=''">
  751. and a.uid = #{uid,jdbcType=VARCHAR}
  752. </if>
  753. <if test="businessGlossoryId !=null and businessGlossoryId != ''">
  754. and a.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  755. </if>
  756. <if test="identifyName != null and identifyName != ''">
  757. and b.identify_name like concat('%', #{identifyName},'%')
  758. </if>
  759. <if test="followSituation != null">
  760. and a.follow_situation = #{followSituation,jdbcType=INTEGER}
  761. </if>
  762. <if test="customerStatus != null">
  763. and a.customer_status = #{customerStatus,jdbcType=INTEGER}
  764. </if>
  765. <if test="adminName != null and adminName != ''">
  766. and d.name = #{adminName,jdbcType=VARCHAR}
  767. </if>
  768. <if test="startDate != null and startDate != ''">
  769. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  770. </if>
  771. <if test="endDate != null and endDate != ''">
  772. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  773. </if>
  774. </select>
  775. <select id="selectBusinessManageList" resultType="com.goafanti.customer.bo.BusinessListBo">
  776. select
  777. c.name as businessName,
  778. b.identify_name as identifyName,
  779. a.id as businessId,
  780. a.create_time as createTime,
  781. a.update_time as updateTime,
  782. a.follow_situation as followSituation,
  783. a.customer_status as customerStatus,
  784. d.name as adminName
  785. from
  786. user_business a inner join user b on
  787. a.uid = b.id left join business_glossory c on
  788. a.business_glossory_id = c.id left join admin d on
  789. a.aid = d.id
  790. LEFT JOIN department_management dm on dm.id = d.department_id
  791. where 1 = 1
  792. <if test="aid != null and aid != ''">
  793. and (b.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
  794. </if>
  795. <if test="uid != null and uid !=''">
  796. and a.uid = #{uid,jdbcType=VARCHAR}
  797. </if>
  798. <if test="businessGlossoryId !=null and businessGlossoryId != ''">
  799. and a.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  800. </if>
  801. <if test="identifyName != null and identifyName != ''">
  802. and b.identify_name like concat('%', #{identifyName},'%')
  803. </if>
  804. <if test="followSituation != null">
  805. and a.follow_situation = #{followSituation,jdbcType=INTEGER}
  806. </if>
  807. <if test="customerStatus != null">
  808. and a.customer_status = #{customerStatus,jdbcType=INTEGER}
  809. </if>
  810. <if test="adminName != null and adminName != ''">
  811. and d.name = #{adminName,jdbcType=VARCHAR}
  812. </if>
  813. <if test="startDate != null and startDate != ''">
  814. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  815. </if>
  816. <if test="endDate != null and endDate != ''">
  817. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  818. </if>
  819. <if test="page_sql != null">
  820. ${page_sql}
  821. </if>
  822. </select>
  823. <select id="selectBusinessManageCount" parameterType="com.goafanti.customer.bo.BusinessListBo" resultType="java.lang.Integer">
  824. select
  825. count(0)
  826. from
  827. user_business a inner join user b on
  828. a.uid = b.id left join business_glossory c on
  829. a.business_glossory_id = c.id left join admin d on
  830. a.aid = d.id
  831. LEFT JOIN department_management dm on dm.id = d.department_id
  832. where 1 = 1
  833. <if test="aid != null and aid != ''">
  834. and (b.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
  835. </if>
  836. <if test="uid != null and uid !=''">
  837. and a.uid = #{uid,jdbcType=VARCHAR}
  838. </if>
  839. <if test="businessGlossoryId !=null and businessGlossoryId != ''">
  840. and a.business_glossory_id = #{businessGlossoryId,jdbcType=VARCHAR}
  841. </if>
  842. <if test="identifyName != null and identifyName != ''">
  843. and b.identify_name like concat('%', #{identifyName},'%')
  844. </if>
  845. <if test="followSituation != null">
  846. and a.follow_situation = #{followSituation,jdbcType=INTEGER}
  847. </if>
  848. <if test="customerStatus != null">
  849. and a.customer_status = #{customerStatus,jdbcType=INTEGER}
  850. </if>
  851. <if test="adminName != null and adminName != ''">
  852. and d.name = #{adminName,jdbcType=VARCHAR}
  853. </if>
  854. <if test="startDate != null and startDate != ''">
  855. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  856. </if>
  857. <if test="endDate != null and endDate != ''">
  858. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  859. </if>
  860. </select>
  861. <select id="selectManagePersonalCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
  862. select
  863. a.id as uid,
  864. a.type,
  865. a.status,
  866. date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,
  867. a.business_audit as businessAudit,
  868. a.current_member_status as currentMemberStatus,
  869. a.identify_name as name,
  870. a.lvl,a.is_member as isMember,
  871. a.society_tag as societyTag,
  872. a.share_type as shareType,
  873. b.contacts,
  874. b.contact_mobile as contactMobile,
  875. b.international,
  876. b.expert,
  877. b.audit_status as auditStatus,
  878. dg1.name as province,
  879. dg2.name as city,
  880. dg3.name as area,
  881. c.name as industry,
  882. d.name as adminName,
  883. b.expert_audit as expertAudit,
  884. b.release_status as releaseStatus
  885. from user a inner join user_identity b on a.id = b.uid
  886. left join district_glossory dg1 on b.province = dg1.id
  887. left join district_glossory dg2 on b.city = dg2.id
  888. left join district_glossory dg3 on b.area = dg3.id
  889. left join industry_category c on b.industry = c.id
  890. left join admin d on a.aid = d.id
  891. LEFT JOIN department_management dm on dm.id = d.department_id
  892. where a.type = 0 and a.status != 1 and a.audit_status = 1
  893. AND a.audit_status=1
  894. and a.share_type =0
  895. <if test="aid != null and aid !=''">
  896. and (a.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
  897. </if>
  898. <if test="name != null and name != ''">
  899. and a.identify_name like concat('%',#{name},'%')
  900. </if>
  901. <if test="shareType != null">
  902. and a.share_type = #{shareType,jdbcType=INTEGER}
  903. </if>
  904. <if test="status != null">
  905. and a.status = #{status,jdbcType=INTEGER}
  906. </if>
  907. <if test="businessAudit != null">
  908. and a.business_audit = #{businessAudit,jdbcType=INTEGER}
  909. </if>
  910. <if test="isMember != null">
  911. and a.is_member = #{isMember,jdbcType=INTEGER}
  912. </if>
  913. <if test="lvl != null">
  914. and a.lvl = #{lvl,jdbcType=INTEGER}
  915. </if>
  916. <if test="currentMemberStatus != null">
  917. and a.current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  918. </if>
  919. <if test="societyTag != null and societyTag != ''">
  920. and a.society_tag = #{societyTag,jdbcType=VARCHAR}
  921. </if>
  922. <if test="startDate != null and startDate != ''">
  923. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  924. </if>
  925. <if test="endDate != null and endDate != ''">
  926. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  927. </if>
  928. <if test="province != null">
  929. and b.province = #{province,jdbcType=INTEGER}
  930. </if>
  931. <if test="city != null">
  932. and b.city = #{city,jdbcType=INTEGER}
  933. </if>
  934. <if test="area != null">
  935. and b.area = #{area,jdbcType=INTEGER}
  936. </if>
  937. <if test="industry != null">
  938. and b.industry = #{industry,jdbcType=INTEGER}
  939. </if>
  940. <if test="expert != null">
  941. and b.expert = #{expert,jdbcType=INTEGER}
  942. </if>
  943. <if test="international != null">
  944. and b.international = #{international,jdbcType=INTEGER}
  945. </if>
  946. <if test="auditStatus != null">
  947. and b.audit_status = #{auditStatus,jdbcType=INTEGER}
  948. </if>
  949. <if test="page_sql != null">
  950. ${page_sql}
  951. </if>
  952. </select>
  953. <select id="selectManagePersonalCustomerCount" resultType="java.lang.Integer">
  954. select count(0)
  955. from user a inner join user_identity b on a.id = b.uid
  956. left join admin d on a.aid = d.id
  957. LEFT JOIN department_management dm on dm.id = d.department_id
  958. where a.type = 0 and a.status != 1 and a.audit_status = 1
  959. <if test="aid != null and aid !=''">
  960. and (a.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
  961. </if>
  962. <if test="name != null and name != ''">
  963. and a.identify_name like concat('%',#{name},'%')
  964. </if>
  965. <if test="shareType != null">
  966. and a.share_type = #{shareType,jdbcType=VARCHAR}
  967. </if>
  968. <if test="status != null">
  969. and a.status = #{status,jdbcType=INTEGER}
  970. </if>
  971. <if test="businessAudit != null">
  972. and a.business_audit = #{businessAudit,jdbcType=INTEGER}
  973. </if>
  974. <if test="isMember != null">
  975. and a.is_member = #{isMember,jdbcType=INTEGER}
  976. </if>
  977. <if test="lvl != null">
  978. and a.lvl = #{lvl,jdbcType=INTEGER}
  979. </if>
  980. <if test="currentMemberStatus != null">
  981. and a.current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  982. </if>
  983. <if test="societyTag != null and societyTag != ''">
  984. and a.society_tag = #{societyTag,jdbcType=VARCHAR}
  985. </if>
  986. <if test="startDate != null and startDate != ''">
  987. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  988. </if>
  989. <if test="endDate != null and endDate != ''">
  990. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  991. </if>
  992. <if test="province != null">
  993. and b.province = #{province,jdbcType=INTEGER}
  994. </if>
  995. <if test="city != null">
  996. and b.city = #{city,jdbcType=INTEGER}
  997. </if>
  998. <if test="area != null">
  999. and b.area = #{area,jdbcType=INTEGER}
  1000. </if>
  1001. <if test="industry != null">
  1002. and b.industry = #{industry,jdbcType=INTEGER}
  1003. </if>
  1004. <if test="expert != null">
  1005. and b.expert = #{expert,jdbcType=INTEGER}
  1006. </if>
  1007. <if test="international != null">
  1008. and b.international = #{international,jdbcType=INTEGER}
  1009. </if>
  1010. <if test="auditStatus != null">
  1011. and b.audit_status = #{auditStatus,jdbcType=INTEGER}
  1012. </if>
  1013. </select>
  1014. <select id="selectManageOrganizationCustomerList" resultType="com.goafanti.customer.bo.CustomerListOut">
  1015. select
  1016. a.id as uid,
  1017. a.type,
  1018. a.status,
  1019. date_format(a.create_time,'%Y-%m-%d %H:%i:%s') as createTime,
  1020. a.business_audit as businessAudit,
  1021. a.current_member_status as currentMemberStatus,
  1022. a.identify_name as name,
  1023. a.lvl,
  1024. a.is_member as isMember,
  1025. a.society_tag as societyTag,
  1026. share_type as shareType,
  1027. b.contacts,
  1028. b.contact_mobile as contactMobile,
  1029. b.international,
  1030. b.listed,
  1031. b.high_tech_zone as highTechZone,
  1032. b.audit_status as auditStatus,
  1033. dg1.name as province,
  1034. dg2.name as city,
  1035. dg3.name as area,
  1036. c.name as industry,
  1037. d.name as adminName
  1038. from user a inner join organization_identity b on a.id = b.uid
  1039. left join district_glossory dg1 on b.location_province = dg1.id
  1040. left join district_glossory dg2 on b.location_city = dg2.id
  1041. left join district_glossory dg3 on b.location_area = dg3.id
  1042. left join industry_category c on b.industry = c.id
  1043. left join admin d on a.aid = d.id
  1044. LEFT JOIN department_management dm on dm.id = d.department_id
  1045. where a.type = 1 and a.status != 1 and a.audit_status = 1
  1046. <if test="aid != null and aid !=''">
  1047. and (a.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
  1048. </if>
  1049. <if test="name != null and name != ''">
  1050. and a.identify_name like concat('%',#{name},'%')
  1051. </if>
  1052. <if test="shareType != null">
  1053. and a.share_type = #{shareType,jdbcType=VARCHAR}
  1054. </if>
  1055. <if test="status != null">
  1056. and a.status = #{status,jdbcType=INTEGER}
  1057. </if>
  1058. <if test="businessAudit != null">
  1059. and a.business_audit = #{businessAudit,jdbcType=INTEGER}
  1060. </if>
  1061. <if test="isMember != null">
  1062. and a.is_member = #{isMember,jdbcType=INTEGER}
  1063. </if>
  1064. <if test="currentMemberStatus != null">
  1065. and a.current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  1066. </if>
  1067. <if test="lvl != null">
  1068. and a.lvl = #{lvl,jdbcType=INTEGER}
  1069. </if>
  1070. <if test="societyTag != null and societyTag != ''">
  1071. and a.society_tag = #{societyTag,jdbcType=VARCHAR}
  1072. </if>
  1073. <if test="startDate != null and startDate != ''">
  1074. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  1075. </if>
  1076. <if test="endDate != null and endDate != ''">
  1077. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  1078. </if>
  1079. <if test="province != null">
  1080. and b.location_province = #{province,jdbcType=INTEGER}
  1081. </if>
  1082. <if test="city != null">
  1083. and b.location_city = #{city,jdbcType=INTEGER}
  1084. </if>
  1085. <if test="area != null">
  1086. and b.location_area = #{area,jdbcType=INTEGER}
  1087. </if>
  1088. <if test="industry != null">
  1089. and b.industry = #{industry,jdbcType=INTEGER}
  1090. </if>
  1091. <if test="listed != null">
  1092. and b.listed = #{listed,jdbcType=INTEGER}
  1093. </if>
  1094. <if test="highTechZone != null">
  1095. and b.high_tech_zone = #{highTechZone,jdbcType=INTEGER}
  1096. </if>
  1097. <if test="international != null">
  1098. and b.international = #{international,jdbcType=INTEGER}
  1099. </if>
  1100. <if test="auditStatus != null">
  1101. and b.audit_status = #{auditStatus,jdbcType=INTEGER}
  1102. </if>
  1103. <if test="page_sql != null">
  1104. ${page_sql}
  1105. </if>
  1106. </select>
  1107. <select id="selectManageOrganizationCustomerCount" resultType="java.lang.Integer">
  1108. select
  1109. count(0)
  1110. from user a inner join organization_identity b on a.id = b.uid
  1111. left join admin d on a.aid = d.id
  1112. LEFT JOIN department_management dm on dm.id = d.department_id
  1113. where a.type = 1 and a.status != 1 and a.audit_status = 1
  1114. <if test="aid != null and aid !=''">
  1115. and (a.aid = #{aid,jdbcType=VARCHAR} or d.department_id=(select department_id from admin where id=#{aid,jdbcType=VARCHAR}))
  1116. </if>
  1117. <if test="name != null and name != ''">
  1118. and a.identify_name like concat('%',#{name},'%')
  1119. </if>
  1120. <if test="shareType != null">
  1121. and a.share_type = #{shareType,jdbcType=VARCHAR}
  1122. </if>
  1123. <if test="status != null">
  1124. and a.status = #{status,jdbcType=INTEGER}
  1125. </if>
  1126. <if test="businessAudit != null">
  1127. and a.business_audit = #{businessAudit,jdbcType=INTEGER}
  1128. </if>
  1129. <if test="currentMemberStatus != null">
  1130. and a.current_member_status = #{currentMemberStatus,jdbcType=INTEGER}
  1131. </if>
  1132. <if test="isMember != null">
  1133. and a.is_member = #{isMember,jdbcType=INTEGER}
  1134. </if>
  1135. <if test="societyTag != null and societyTag != ''">
  1136. and a.society_tag = #{societyTag,jdbcType=VARCHAR}
  1137. </if>
  1138. <if test="startDate != null and startDate != ''">
  1139. and a.create_time &gt; STR_TO_DATE(#{startDate},'%Y-%m-%d %H:%i:%s')
  1140. </if>
  1141. <if test="endDate != null and endDate != ''">
  1142. and a.create_time &lt; STR_TO_DATE(#{endDate},'%Y-%m-%d %H:%i:%s')
  1143. </if>
  1144. <if test="province != null">
  1145. and b.location_province = #{province,jdbcType=INTEGER}
  1146. </if>
  1147. <if test="city != null">
  1148. and b.location_city = #{city,jdbcType=INTEGER}
  1149. </if>
  1150. <if test="area != null">
  1151. and b.location_area = #{area,jdbcType=INTEGER}
  1152. </if>
  1153. <if test="industry != null">
  1154. and b.industry = #{industry,jdbcType=INTEGER}
  1155. </if>
  1156. <if test="listed != null">
  1157. and b.listed = #{listed,jdbcType=INTEGER}
  1158. </if>
  1159. <if test="highTechZone != null">
  1160. and b.high_tech_zone = #{highTechZone,jdbcType=INTEGER}
  1161. </if>
  1162. <if test="international != null">
  1163. and b.international = #{international,jdbcType=INTEGER}
  1164. </if>
  1165. <if test="auditStatus != null">
  1166. and b.audit_status = #{auditStatus,jdbcType=INTEGER}
  1167. </if>
  1168. </select>
  1169. <select id="findAdminName" resultType="com.goafanti.customer.bo.CustomerListOut">
  1170. select d.name as adminName,d.id as aid
  1171. from admin d left join department_management dm on dm.id = d.department_id
  1172. where d.department_id=(select department_id from admin where id=#{aid,jdbcType=INTEGER})
  1173. </select>
  1174. <select id="findEnteringAuditList" resultType="com.goafanti.customer.bo.CustomerListOut">
  1175. select u.id as uid,u.nickname as name,u.mobile as contactMobile,a.name as adminName,u.create_time as createTime,u.audit_status as auditStatus
  1176. from user u left join admin a on u.aid=a.id
  1177. where u.audit_status=0 and u.status != 1 and u.share_type=0
  1178. <if test="aid != null and aid !=''">
  1179. and u.aid = #{aid,jdbcType=VARCHAR}
  1180. </if>
  1181. <if test="name != null and name != ''">
  1182. and u.nickname = #{name,jdbcType=VARCHAR}
  1183. </if>
  1184. <if test="adminName != null and adminName != ''">
  1185. and a.name = #{adminName,jdbcType=VARCHAR}
  1186. </if>
  1187. <if test="page_sql != null">
  1188. ${page_sql}
  1189. </if>
  1190. </select>
  1191. <select id="findEnteringAuditCount" resultType="java.lang.Integer">
  1192. select
  1193. count(0)
  1194. from user u left join admin a on u.aid=a.id
  1195. where u.audit_status=0 and u.status != 1 and u.share_type=0
  1196. <if test="aid != null and aid !=''">
  1197. and u.aid = #{aid,jdbcType=VARCHAR}
  1198. </if>
  1199. <if test="name != null and name != ''">
  1200. and u.nickname = #{name,jdbcType=VARCHAR}
  1201. </if>
  1202. <if test="adminName != null and adminName != ''">
  1203. and a.name = #{adminName,jdbcType=VARCHAR}
  1204. </if>
  1205. </select>
  1206. <select id="findEnteringAuditIsNoList" resultType="com.goafanti.customer.bo.CustomerListOut">
  1207. select u.id as uid,u.nickname as name,u.mobile as contactMobile,a.name as adminName,u.create_time as createTime,
  1208. u.audit_status as auditStatus,u.audit_opinion as auditOpinion
  1209. from user u left join admin a on u.aid=a.id
  1210. where u.audit_status=2 and u.status != 1
  1211. <if test="aid != null and aid !=''">
  1212. and u.aid = #{aid,jdbcType=VARCHAR}
  1213. </if>
  1214. <if test="name != null and name != ''">
  1215. and u.nickname = #{name,jdbcType=VARCHAR}
  1216. </if>
  1217. <if test="adminName != null and adminName != ''">
  1218. and a.name = #{adminName,jdbcType=VARCHAR}
  1219. </if>
  1220. <if test="page_sql != null">
  1221. ${page_sql}
  1222. </if>
  1223. </select>
  1224. <select id="findEnteringAuditIsNoCount" resultType="java.lang.Integer">
  1225. select
  1226. count(0)
  1227. from user u left join admin a on u.aid=a.id
  1228. where u.audit_status=2 and u.status != 1
  1229. <if test="aid != null and aid !=''">
  1230. and u.aid = #{aid,jdbcType=VARCHAR}
  1231. </if>
  1232. <if test="name != null and name != ''">
  1233. and u.nickname = #{name,jdbcType=VARCHAR}
  1234. </if>
  1235. <if test="adminName != null and adminName != ''">
  1236. and a.name = #{adminName,jdbcType=VARCHAR}
  1237. </if>
  1238. </select>
  1239. </mapper>