UserMapperExt.xml 57 KB

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