CustomerMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  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.CustomerMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.Customer">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="aid" jdbcType="VARCHAR" property="aid" />
  12. <result column="paid" jdbcType="VARCHAR" property="paid" />
  13. <result column="share_type" jdbcType="INTEGER" property="shareType" />
  14. <result column="customer_type" jdbcType="INTEGER" property="customerType" />
  15. <result column="customer_status" jdbcType="INTEGER" property="customerStatus" />
  16. <result column="company_intention" jdbcType="CHAR" property="companyIntention" />
  17. <result column="follow_situation" jdbcType="INTEGER" property="followSituation" />
  18. <result column="tag" jdbcType="VARCHAR" property="tag" />
  19. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  20. <result column="follow_id" jdbcType="VARCHAR" property="followId" />
  21. <result column="effective" jdbcType="INTEGER" property="effective" />
  22. </resultMap>
  23. <sql id="Example_Where_Clause">
  24. <!--
  25. WARNING - @mbg.generated
  26. This element is automatically generated by MyBatis Generator, do not modify.
  27. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  28. -->
  29. <where>
  30. <foreach collection="oredCriteria" item="criteria" separator="or">
  31. <if test="criteria.valid">
  32. <trim prefix="(" prefixOverrides="and" suffix=")">
  33. <foreach collection="criteria.criteria" item="criterion">
  34. <choose>
  35. <when test="criterion.noValue">
  36. and ${criterion.condition}
  37. </when>
  38. <when test="criterion.singleValue">
  39. and ${criterion.condition} #{criterion.value}
  40. </when>
  41. <when test="criterion.betweenValue">
  42. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  43. </when>
  44. <when test="criterion.listValue">
  45. and ${criterion.condition}
  46. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  47. #{listItem}
  48. </foreach>
  49. </when>
  50. </choose>
  51. </foreach>
  52. </trim>
  53. </if>
  54. </foreach>
  55. </where>
  56. </sql>
  57. <sql id="Update_By_Example_Where_Clause">
  58. <!--
  59. WARNING - @mbg.generated
  60. This element is automatically generated by MyBatis Generator, do not modify.
  61. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  62. -->
  63. <where>
  64. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  65. <if test="criteria.valid">
  66. <trim prefix="(" prefixOverrides="and" suffix=")">
  67. <foreach collection="criteria.criteria" item="criterion">
  68. <choose>
  69. <when test="criterion.noValue">
  70. and ${criterion.condition}
  71. </when>
  72. <when test="criterion.singleValue">
  73. and ${criterion.condition} #{criterion.value}
  74. </when>
  75. <when test="criterion.betweenValue">
  76. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  77. </when>
  78. <when test="criterion.listValue">
  79. and ${criterion.condition}
  80. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  81. #{listItem}
  82. </foreach>
  83. </when>
  84. </choose>
  85. </foreach>
  86. </trim>
  87. </if>
  88. </foreach>
  89. </where>
  90. </sql>
  91. <sql id="Base_Column_List">
  92. <!--
  93. WARNING - @mbg.generated
  94. This element is automatically generated by MyBatis Generator, do not modify.
  95. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  96. -->
  97. id, aid, paid, share_type, customer_type, customer_status, company_intention, follow_situation,
  98. tag, create_time, follow_id, effective
  99. </sql>
  100. <select id="selectByExample" parameterType="com.goafanti.common.model.CustomerExample" resultMap="BaseResultMap">
  101. <!--
  102. WARNING - @mbg.generated
  103. This element is automatically generated by MyBatis Generator, do not modify.
  104. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  105. -->
  106. select
  107. <if test="distinct">
  108. distinct
  109. </if>
  110. <include refid="Base_Column_List" />
  111. from customer
  112. <if test="_parameter != null">
  113. <include refid="Example_Where_Clause" />
  114. </if>
  115. <if test="orderByClause != null">
  116. order by ${orderByClause}
  117. </if>
  118. </select>
  119. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  120. <!--
  121. WARNING - @mbg.generated
  122. This element is automatically generated by MyBatis Generator, do not modify.
  123. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  124. -->
  125. select
  126. <include refid="Base_Column_List" />
  127. from customer
  128. where id = #{id,jdbcType=VARCHAR}
  129. </select>
  130. <!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  131. WARNING - @mbg.generated
  132. This element is automatically generated by MyBatis Generator, do not modify.
  133. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  134. delete from customer
  135. where id = #{id,jdbcType=VARCHAR}
  136. </delete> -->
  137. <update id="deleteByPrimaryKey" parameterType="java.lang.String">
  138. update customer set effective =1 where id = #{id,jdbcType=VARCHAR}
  139. </update>
  140. <delete id="deleteByExample" parameterType="com.goafanti.common.model.CustomerExample">
  141. <!--
  142. WARNING - @mbg.generated
  143. This element is automatically generated by MyBatis Generator, do not modify.
  144. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  145. -->
  146. delete from customer
  147. <if test="_parameter != null">
  148. <include refid="Example_Where_Clause" />
  149. </if>
  150. </delete>
  151. <insert id="insert" parameterType="com.goafanti.common.model.Customer">
  152. <!--
  153. WARNING - @mbg.generated
  154. This element is automatically generated by MyBatis Generator, do not modify.
  155. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  156. -->
  157. insert into customer (id, aid, paid,
  158. share_type, customer_type, customer_status,
  159. company_intention, follow_situation, tag,
  160. create_time, follow_id, effective
  161. )
  162. values (#{id,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{paid,jdbcType=VARCHAR},
  163. #{shareType,jdbcType=INTEGER}, #{customerType,jdbcType=INTEGER}, #{customerStatus,jdbcType=INTEGER},
  164. #{companyIntention,jdbcType=CHAR}, #{followSituation,jdbcType=INTEGER}, #{tag,jdbcType=VARCHAR},
  165. #{createTime,jdbcType=TIMESTAMP}, #{followId,jdbcType=VARCHAR}, 0
  166. )
  167. </insert>
  168. <insert id="insertSelective" parameterType="com.goafanti.common.model.Customer">
  169. <!--
  170. WARNING - @mbg.generated
  171. This element is automatically generated by MyBatis Generator, do not modify.
  172. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  173. -->
  174. insert into customer
  175. <trim prefix="(" suffix=")" suffixOverrides=",">
  176. <if test="id != null">
  177. id,
  178. </if>
  179. <if test="aid != null">
  180. aid,
  181. </if>
  182. <if test="paid != null">
  183. paid,
  184. </if>
  185. <if test="shareType != null">
  186. share_type,
  187. </if>
  188. <if test="customerType != null">
  189. customer_type,
  190. </if>
  191. <if test="customerStatus != null">
  192. customer_status,
  193. </if>
  194. <if test="companyIntention != null">
  195. company_intention,
  196. </if>
  197. <if test="followSituation != null">
  198. follow_situation,
  199. </if>
  200. <if test="tag != null">
  201. tag,
  202. </if>
  203. <if test="createTime != null">
  204. create_time,
  205. </if>
  206. <if test="followId != null">
  207. follow_id,
  208. </if>
  209. <if test="effective != null">
  210. effective,
  211. </if>
  212. </trim>
  213. <trim prefix="values (" suffix=")" suffixOverrides=",">
  214. <if test="id != null">
  215. #{id,jdbcType=VARCHAR},
  216. </if>
  217. <if test="aid != null">
  218. #{aid,jdbcType=VARCHAR},
  219. </if>
  220. <if test="paid != null">
  221. #{paid,jdbcType=VARCHAR},
  222. </if>
  223. <if test="shareType != null">
  224. #{shareType,jdbcType=INTEGER},
  225. </if>
  226. <if test="customerType != null">
  227. #{customerType,jdbcType=INTEGER},
  228. </if>
  229. <if test="customerStatus != null">
  230. #{customerStatus,jdbcType=INTEGER},
  231. </if>
  232. <if test="companyIntention != null">
  233. #{companyIntention,jdbcType=CHAR},
  234. </if>
  235. <if test="followSituation != null">
  236. #{followSituation,jdbcType=INTEGER},
  237. </if>
  238. <if test="tag != null">
  239. #{tag,jdbcType=VARCHAR},
  240. </if>
  241. <if test="createTime != null">
  242. #{createTime,jdbcType=TIMESTAMP},
  243. </if>
  244. <if test="followId != null">
  245. #{followId,jdbcType=VARCHAR},
  246. </if>
  247. <if test="effective != null">
  248. #{effective,jdbcType=INTEGER},
  249. </if>
  250. </trim>
  251. </insert>
  252. <select id="countByExample" parameterType="com.goafanti.common.model.CustomerExample" resultType="java.lang.Long">
  253. <!--
  254. WARNING - @mbg.generated
  255. This element is automatically generated by MyBatis Generator, do not modify.
  256. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  257. -->
  258. select count(*) from customer
  259. <if test="_parameter != null">
  260. <include refid="Example_Where_Clause" />
  261. </if>
  262. </select>
  263. <update id="updateByExampleSelective" parameterType="map">
  264. <!--
  265. WARNING - @mbg.generated
  266. This element is automatically generated by MyBatis Generator, do not modify.
  267. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  268. -->
  269. update customer
  270. <set>
  271. <if test="record.id != null">
  272. id = #{record.id,jdbcType=VARCHAR},
  273. </if>
  274. <if test="record.aid != null">
  275. aid = #{record.aid,jdbcType=VARCHAR},
  276. </if>
  277. <if test="record.paid != null">
  278. paid = #{record.paid,jdbcType=VARCHAR},
  279. </if>
  280. <if test="record.shareType != null">
  281. share_type = #{record.shareType,jdbcType=INTEGER},
  282. </if>
  283. <if test="record.customerType != null">
  284. customer_type = #{record.customerType,jdbcType=INTEGER},
  285. </if>
  286. <if test="record.customerStatus != null">
  287. customer_status = #{record.customerStatus,jdbcType=INTEGER},
  288. </if>
  289. <if test="record.companyIntention != null">
  290. company_intention = #{record.companyIntention,jdbcType=CHAR},
  291. </if>
  292. <if test="record.followSituation != null">
  293. follow_situation = #{record.followSituation,jdbcType=INTEGER},
  294. </if>
  295. <if test="record.tag != null">
  296. tag = #{record.tag,jdbcType=VARCHAR},
  297. </if>
  298. <if test="record.createTime != null">
  299. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  300. </if>
  301. <if test="record.followId != null">
  302. follow_id = #{record.followId,jdbcType=VARCHAR},
  303. </if>
  304. <if test="record.effective != null">
  305. effective = #{record.effective,jdbcType=INTEGER},
  306. </if>
  307. </set>
  308. <if test="_parameter != null">
  309. <include refid="Update_By_Example_Where_Clause" />
  310. </if>
  311. </update>
  312. <update id="updateByExample" parameterType="map">
  313. <!--
  314. WARNING - @mbg.generated
  315. This element is automatically generated by MyBatis Generator, do not modify.
  316. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  317. -->
  318. update customer
  319. set id = #{record.id,jdbcType=VARCHAR},
  320. aid = #{record.aid,jdbcType=VARCHAR},
  321. paid = #{record.paid,jdbcType=VARCHAR},
  322. share_type = #{record.shareType,jdbcType=INTEGER},
  323. customer_type = #{record.customerType,jdbcType=INTEGER},
  324. customer_status = #{record.customerStatus,jdbcType=INTEGER},
  325. company_intention = #{record.companyIntention,jdbcType=CHAR},
  326. follow_situation = #{record.followSituation,jdbcType=INTEGER},
  327. tag = #{record.tag,jdbcType=VARCHAR},
  328. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  329. follow_id = #{record.followId,jdbcType=VARCHAR},
  330. effective = #{record.effective,jdbcType=INTEGER}
  331. <if test="_parameter != null">
  332. <include refid="Update_By_Example_Where_Clause" />
  333. </if>
  334. </update>
  335. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Customer">
  336. <!--
  337. WARNING - @mbg.generated
  338. This element is automatically generated by MyBatis Generator, do not modify.
  339. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  340. -->
  341. update customer
  342. <set>
  343. <if test="aid != null">
  344. aid = #{aid,jdbcType=VARCHAR},
  345. </if>
  346. <if test="paid != null">
  347. paid = #{paid,jdbcType=VARCHAR},
  348. </if>
  349. <if test="shareType != null">
  350. share_type = #{shareType,jdbcType=INTEGER},
  351. </if>
  352. <if test="customerType != null">
  353. customer_type = #{customerType,jdbcType=INTEGER},
  354. </if>
  355. <if test="customerStatus != null">
  356. customer_status = #{customerStatus,jdbcType=INTEGER},
  357. </if>
  358. <if test="companyIntention != null">
  359. company_intention = #{companyIntention,jdbcType=CHAR},
  360. </if>
  361. <if test="followSituation != null">
  362. follow_situation = #{followSituation,jdbcType=INTEGER},
  363. </if>
  364. <if test="tag != null">
  365. tag = #{tag,jdbcType=VARCHAR},
  366. </if>
  367. <if test="createTime != null">
  368. create_time = #{createTime,jdbcType=TIMESTAMP},
  369. </if>
  370. <if test="followId != null">
  371. follow_id = #{followId,jdbcType=VARCHAR},
  372. </if>
  373. <if test="effective != null">
  374. effective = #{effective,jdbcType=INTEGER},
  375. </if>
  376. </set>
  377. where id = #{id,jdbcType=VARCHAR}
  378. </update>
  379. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Customer">
  380. <!--
  381. WARNING - @mbg.generated
  382. This element is automatically generated by MyBatis Generator, do not modify.
  383. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  384. -->
  385. update customer
  386. set aid = #{aid,jdbcType=VARCHAR},
  387. paid = #{paid,jdbcType=VARCHAR},
  388. share_type = #{shareType,jdbcType=INTEGER},
  389. customer_type = #{customerType,jdbcType=INTEGER},
  390. customer_status = #{customerStatus,jdbcType=INTEGER},
  391. company_intention = #{companyIntention,jdbcType=CHAR},
  392. follow_situation = #{followSituation,jdbcType=INTEGER},
  393. tag = #{tag,jdbcType=VARCHAR},
  394. create_time = #{createTime,jdbcType=TIMESTAMP},
  395. follow_id = #{followId,jdbcType=VARCHAR},
  396. effective = #{effective,jdbcType=INTEGER}
  397. where id = #{id,jdbcType=VARCHAR}
  398. </update>
  399. <select id="selectCustomer" resultType="com.goafanti.customer.bo.CustomerOut">
  400. select a.id,a.aid,a.customer_type as customerType,a.share_type as shareType,a.company_intention as CompanyIntention,
  401. a.tag,a.follow_situation as followSituation,a.customer_status as customerStatus,
  402. b.follow_date as followDate,
  403. c.name as contactName ,c.mobile,c.tel_num as telNum,
  404. d.company_name as companyName,d.location_province as locationProvince,
  405. e.name as adminName,
  406. b.follow_date as followDate
  407. from customer a
  408. left join follow_up_record b on a.follow_id = b.id
  409. left join customer_user_info c on b.cuid = c.id
  410. left join customer_organization_info d on a.id = d.cid
  411. left join admin e on a.aid = e.id
  412. where a.effective = 0
  413. <if test="aid != null and aid != ''">
  414. and (a.aid = #{aid,jdbcType=VARCHAR}
  415. </if>
  416. <if test="aid == null or aid == ''">
  417. and (1=1
  418. </if>
  419. <if test="paid != null and paid != ''">
  420. or a.paid like concat('%',#{paid,jdbcType=VARCHAR},'%'))
  421. </if>
  422. <if test="paid == null or paid == ''">
  423. )
  424. </if>
  425. <if test="shareType != null">
  426. and a.share_type = #{shareType,jdbcType=INTEGER}
  427. </if>
  428. <if test="customerType != null">
  429. and a.customer_type = #{customerType,jdbcType=INTEGER}
  430. </if>
  431. <if test="customerStauts != null">
  432. and a.customer_status = #{customerStauts,jdbcType=INTEGER}
  433. </if>
  434. <if test="companyIntention != null">
  435. and a.company_intention = #{companyIntention,jdbcType=INTEGER}
  436. </if>
  437. <if test="followSituation != null">
  438. and a.follow_situation = #{followSituation,jdbcType=INTEGER}
  439. </if>
  440. <if test="contactName != null">
  441. and c.name = #{contactName,jdbcType=VARCHAR}
  442. </if>
  443. <if test="contactTel != null">
  444. and c.tel_num = #{contactTel,jdbcType=VARCHAR}
  445. </if>
  446. <if test="companyName != null and companyName != ''">
  447. and d.company_name like concat('%',#{companyName,jdbcType=VARCHAR},'%')
  448. </if>
  449. <if test="locationProvince != null">
  450. and d.location_province = #{locationProvince,jdbcType=VARCHAR}
  451. </if>
  452. <if test="adminName != null and adminName != ''">
  453. and e.name like concat('%',#{adminName,jdbcType=VARCHAR},'%')
  454. </if>
  455. order by a.create_time desc
  456. <if test="page_sql!=null">
  457. ${page_sql}
  458. </if>
  459. </select>
  460. <select id="selectCustomerCount" resultType="java.lang.Integer">
  461. select count(0)
  462. from customer a
  463. left join follow_up_record b on a.follow_id = b.id
  464. left join customer_user_info c on b.cuid = c.id
  465. left join customer_organization_info d on a.id = d.cid
  466. left join admin e on a.aid = e.id
  467. where a.effective = 0
  468. <if test="aid != null and aid != ''">
  469. and (a.aid = #{aid,jdbcType=VARCHAR}
  470. </if>
  471. <if test="aid == null or aid == ''">
  472. and (1=1
  473. </if>
  474. <if test="paid != null and paid != ''">
  475. or a.paid like concat('%',#{paid,jdbcType=VARCHAR},'%'))
  476. </if>
  477. <if test="paid == null or paid == ''">
  478. )
  479. </if>
  480. <if test="shareType != null">
  481. and a.share_type = #{shareType,jdbcType=INTEGER}
  482. </if>
  483. <if test="customerType != null">
  484. and a.customer_type = #{customerType,jdbcType=INTEGER}
  485. </if>
  486. <if test="customerStauts != null">
  487. and a.customer_status = #{customerStauts,jdbcType=INTEGER}
  488. </if>
  489. <if test="companyIntention != null">
  490. and a.company_intention = #{companyIntention,jdbcType=INTEGER}
  491. </if>
  492. <if test="followSituation != null">
  493. and a.follow_situation = #{followSituation,jdbcType=INTEGER}
  494. </if>
  495. <if test="contactName != null">
  496. and c.name = #{contactName,jdbcType=VARCHAR}
  497. </if>
  498. <if test="contactTel != null">
  499. and c.tel_num = #{contactTel,jdbcType=VARCHAR}
  500. </if>
  501. <if test="companyName != null and companyName != ''">
  502. and d.company_name like concat('%',#{companyName,jdbcType=VARCHAR},'%')
  503. </if>
  504. <if test="locationProvince != null">
  505. and d.location_province = #{locationProvince,jdbcType=VARCHAR}
  506. </if>
  507. <if test="adminName != null and adminName != ''">
  508. and e.name like concat('%',#{adminName,jdbcType=VARCHAR},'%')
  509. </if>
  510. </select>
  511. <select id="selectCustomerById" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerOut">
  512. select
  513. a.id as cid,
  514. a.tag,
  515. a.customer_type as customerType,
  516. a.share_type as shareType,
  517. a.company_intention as companyIntention,
  518. a.create_time as createTime,
  519. a.follow_situation as followSituation,
  520. a.customer_status as customerStatus,
  521. c.company_name as companyName,
  522. c.location_province as locationProvince,
  523. c.company_industry as companyIndustry,
  524. c.adress,c.remarks,
  525. d.name as adminName
  526. from customer a
  527. left join customer_organization_info c on a.id=c.cid
  528. left join admin d on a.aid=d.id
  529. where a.id = #{id,jdbcType=VARCHAR}
  530. </select>
  531. <select id="selectByLadderId" parameterType="java.lang.String" resultMap="BaseResultMap">
  532. select
  533. <include refid="Base_Column_List" />
  534. from customer
  535. where aid = #{ladderId} or paid like concat('%',#{ladderId},'%')
  536. </select>
  537. <select id="findCustomerHistory" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerOut">
  538. select
  539. a.id as cid,a.aid, a.create_time as createTime,
  540. a.follow_situation as followSituation,a.customer_status as customerStatus,
  541. b.company_name as customerName,
  542. c.followCount,
  543. d.follow_date as followDate,
  544. e.name as contactName,
  545. f.operatorTime,
  546. g.name as adminName
  547. from customer a
  548. left join customer_organization_info b on a.id = b.cid
  549. left join (select ifnull(0,count(0)) as followCount,r.aid,r.cid from follow_up_record r group by r.aid,r.cid) c
  550. on a.id = c.cid and a.aid = c.aid
  551. left join follow_up_record d on a.follow_id = d.id
  552. left join customer_user_info e on d.cuid = e.id
  553. left join (select l1.cid,l1.operator_time as operatorTime from customer_log l1 ,
  554. (select cid, max(operator_time) as operator_time from customer_log group by cid ) l2
  555. where l1.cid = l2.cid and l1.operator_time = l2.operator_time)f
  556. on a.id = f.cid
  557. left join admin g on a.aid = g.id
  558. where a.id = #{id,jdbcType=VARCHAR}
  559. </select>
  560. </mapper>