UserMapperExt.xml 44 KB

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