CustomerMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  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. <!--
  132. WARNING - @mbg.generated
  133. This element is automatically generated by MyBatis Generator, do not modify.
  134. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  135. -->
  136. delete from customer
  137. where id = #{id,jdbcType=VARCHAR}
  138. </delete>
  139. <delete id="deleteByExample" parameterType="com.goafanti.common.model.CustomerExample">
  140. <!--
  141. WARNING - @mbg.generated
  142. This element is automatically generated by MyBatis Generator, do not modify.
  143. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  144. -->
  145. delete from customer
  146. <if test="_parameter != null">
  147. <include refid="Example_Where_Clause" />
  148. </if>
  149. </delete>
  150. <insert id="insert" parameterType="com.goafanti.common.model.Customer">
  151. <!--
  152. WARNING - @mbg.generated
  153. This element is automatically generated by MyBatis Generator, do not modify.
  154. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  155. -->
  156. insert into customer (id, aid, paid,
  157. share_type, customer_type, customer_status,
  158. company_intention, follow_situation, tag,
  159. create_time, follow_id, effective
  160. )
  161. values (#{id,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR}, #{paid,jdbcType=VARCHAR},
  162. #{shareType,jdbcType=INTEGER}, #{customerType,jdbcType=INTEGER}, #{customerStatus,jdbcType=INTEGER},
  163. #{companyIntention,jdbcType=CHAR}, #{followSituation,jdbcType=INTEGER}, #{tag,jdbcType=VARCHAR},
  164. #{createTime,jdbcType=TIMESTAMP}, #{followId,jdbcType=VARCHAR}, #{effective,jdbcType=INTEGER}
  165. )
  166. </insert>
  167. <insert id="insertSelective" parameterType="com.goafanti.common.model.Customer">
  168. <!--
  169. WARNING - @mbg.generated
  170. This element is automatically generated by MyBatis Generator, do not modify.
  171. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  172. -->
  173. insert into customer
  174. <trim prefix="(" suffix=")" suffixOverrides=",">
  175. <if test="id != null">
  176. id,
  177. </if>
  178. <if test="aid != null">
  179. aid,
  180. </if>
  181. <if test="paid != null">
  182. paid,
  183. </if>
  184. <if test="shareType != null">
  185. share_type,
  186. </if>
  187. <if test="customerType != null">
  188. customer_type,
  189. </if>
  190. <if test="customerStatus != null">
  191. customer_status,
  192. </if>
  193. <if test="companyIntention != null">
  194. company_intention,
  195. </if>
  196. <if test="followSituation != null">
  197. follow_situation,
  198. </if>
  199. <if test="tag != null">
  200. tag,
  201. </if>
  202. <if test="createTime != null">
  203. create_time,
  204. </if>
  205. <if test="followId != null">
  206. follow_id,
  207. </if>
  208. <if test="effective != null">
  209. effective,
  210. </if>
  211. </trim>
  212. <trim prefix="values (" suffix=")" suffixOverrides=",">
  213. <if test="id != null">
  214. #{id,jdbcType=VARCHAR},
  215. </if>
  216. <if test="aid != null">
  217. #{aid,jdbcType=VARCHAR},
  218. </if>
  219. <if test="paid != null">
  220. #{paid,jdbcType=VARCHAR},
  221. </if>
  222. <if test="shareType != null">
  223. #{shareType,jdbcType=INTEGER},
  224. </if>
  225. <if test="customerType != null">
  226. #{customerType,jdbcType=INTEGER},
  227. </if>
  228. <if test="customerStatus != null">
  229. #{customerStatus,jdbcType=INTEGER},
  230. </if>
  231. <if test="companyIntention != null">
  232. #{companyIntention,jdbcType=CHAR},
  233. </if>
  234. <if test="followSituation != null">
  235. #{followSituation,jdbcType=INTEGER},
  236. </if>
  237. <if test="tag != null">
  238. #{tag,jdbcType=VARCHAR},
  239. </if>
  240. <if test="createTime != null">
  241. #{createTime,jdbcType=TIMESTAMP},
  242. </if>
  243. <if test="followId != null">
  244. #{followId,jdbcType=VARCHAR},
  245. </if>
  246. <if test="effective != null">
  247. #{effective,jdbcType=INTEGER},
  248. </if>
  249. </trim>
  250. </insert>
  251. <select id="countByExample" parameterType="com.goafanti.common.model.CustomerExample" resultType="java.lang.Long">
  252. <!--
  253. WARNING - @mbg.generated
  254. This element is automatically generated by MyBatis Generator, do not modify.
  255. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  256. -->
  257. select count(*) from customer
  258. <if test="_parameter != null">
  259. <include refid="Example_Where_Clause" />
  260. </if>
  261. </select>
  262. <update id="updateByExampleSelective" parameterType="map">
  263. <!--
  264. WARNING - @mbg.generated
  265. This element is automatically generated by MyBatis Generator, do not modify.
  266. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  267. -->
  268. update customer
  269. <set>
  270. <if test="record.id != null">
  271. id = #{record.id,jdbcType=VARCHAR},
  272. </if>
  273. <if test="record.aid != null">
  274. aid = #{record.aid,jdbcType=VARCHAR},
  275. </if>
  276. <if test="record.paid != null">
  277. paid = #{record.paid,jdbcType=VARCHAR},
  278. </if>
  279. <if test="record.shareType != null">
  280. share_type = #{record.shareType,jdbcType=INTEGER},
  281. </if>
  282. <if test="record.customerType != null">
  283. customer_type = #{record.customerType,jdbcType=INTEGER},
  284. </if>
  285. <if test="record.customerStatus != null">
  286. customer_status = #{record.customerStatus,jdbcType=INTEGER},
  287. </if>
  288. <if test="record.companyIntention != null">
  289. company_intention = #{record.companyIntention,jdbcType=CHAR},
  290. </if>
  291. <if test="record.followSituation != null">
  292. follow_situation = #{record.followSituation,jdbcType=INTEGER},
  293. </if>
  294. <if test="record.tag != null">
  295. tag = #{record.tag,jdbcType=VARCHAR},
  296. </if>
  297. <if test="record.createTime != null">
  298. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  299. </if>
  300. <if test="record.followId != null">
  301. follow_id = #{record.followId,jdbcType=VARCHAR},
  302. </if>
  303. <if test="record.effective != null">
  304. effective = #{record.effective,jdbcType=INTEGER},
  305. </if>
  306. </set>
  307. <if test="_parameter != null">
  308. <include refid="Update_By_Example_Where_Clause" />
  309. </if>
  310. </update>
  311. <update id="updateByExample" parameterType="map">
  312. <!--
  313. WARNING - @mbg.generated
  314. This element is automatically generated by MyBatis Generator, do not modify.
  315. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  316. -->
  317. update customer
  318. set id = #{record.id,jdbcType=VARCHAR},
  319. aid = #{record.aid,jdbcType=VARCHAR},
  320. paid = #{record.paid,jdbcType=VARCHAR},
  321. share_type = #{record.shareType,jdbcType=INTEGER},
  322. customer_type = #{record.customerType,jdbcType=INTEGER},
  323. customer_status = #{record.customerStatus,jdbcType=INTEGER},
  324. company_intention = #{record.companyIntention,jdbcType=CHAR},
  325. follow_situation = #{record.followSituation,jdbcType=INTEGER},
  326. tag = #{record.tag,jdbcType=VARCHAR},
  327. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  328. follow_id = #{record.followId,jdbcType=VARCHAR},
  329. effective = #{record.effective,jdbcType=INTEGER}
  330. <if test="_parameter != null">
  331. <include refid="Update_By_Example_Where_Clause" />
  332. </if>
  333. </update>
  334. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Customer">
  335. <!--
  336. WARNING - @mbg.generated
  337. This element is automatically generated by MyBatis Generator, do not modify.
  338. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  339. -->
  340. update customer
  341. <set>
  342. <if test="aid != null">
  343. aid = #{aid,jdbcType=VARCHAR},
  344. </if>
  345. <if test="paid != null">
  346. paid = #{paid,jdbcType=VARCHAR},
  347. </if>
  348. <if test="shareType != null">
  349. share_type = #{shareType,jdbcType=INTEGER},
  350. </if>
  351. <if test="customerType != null">
  352. customer_type = #{customerType,jdbcType=INTEGER},
  353. </if>
  354. <if test="customerStatus != null">
  355. customer_status = #{customerStatus,jdbcType=INTEGER},
  356. </if>
  357. <if test="companyIntention != null">
  358. company_intention = #{companyIntention,jdbcType=CHAR},
  359. </if>
  360. <if test="followSituation != null">
  361. follow_situation = #{followSituation,jdbcType=INTEGER},
  362. </if>
  363. <if test="tag != null">
  364. tag = #{tag,jdbcType=VARCHAR},
  365. </if>
  366. <if test="createTime != null">
  367. create_time = #{createTime,jdbcType=TIMESTAMP},
  368. </if>
  369. <if test="followId != null">
  370. follow_id = #{followId,jdbcType=VARCHAR},
  371. </if>
  372. <if test="effective != null">
  373. effective = #{effective,jdbcType=INTEGER},
  374. </if>
  375. </set>
  376. where id = #{id,jdbcType=VARCHAR}
  377. </update>
  378. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Customer">
  379. <!--
  380. WARNING - @mbg.generated
  381. This element is automatically generated by MyBatis Generator, do not modify.
  382. This element was generated on Fri Oct 13 15:28:17 CST 2017.
  383. -->
  384. update customer
  385. set aid = #{aid,jdbcType=VARCHAR},
  386. paid = #{paid,jdbcType=VARCHAR},
  387. share_type = #{shareType,jdbcType=INTEGER},
  388. customer_type = #{customerType,jdbcType=INTEGER},
  389. customer_status = #{customerStatus,jdbcType=INTEGER},
  390. company_intention = #{companyIntention,jdbcType=CHAR},
  391. follow_situation = #{followSituation,jdbcType=INTEGER},
  392. tag = #{tag,jdbcType=VARCHAR},
  393. create_time = #{createTime,jdbcType=TIMESTAMP},
  394. follow_id = #{followId,jdbcType=VARCHAR},
  395. effective = #{effective,jdbcType=INTEGER}
  396. where id = #{id,jdbcType=VARCHAR}
  397. </update>
  398. <select id="selectCustomerByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.CustomerOut">
  399. select
  400. a.customer_typ as customerTyp,
  401. a.share_typ as shareTyp,
  402. a.company_intention as companyIntention,
  403. a.create_time as createTime,
  404. a.follow_situation as followSituation,
  405. a.customer_statue as customerStatue,
  406. b.name,b.sex,b.mobile,b.tel_num as telNum,b.email,b.qq,b.wechat,b.depatrment,b.remarks,
  407. b.customer_position as customerPosition,
  408. c.company_name as companyName,
  409. c.location_province as locationProvince,
  410. c.company_industry as companyIndustry,
  411. c.adress --&gt;
  412. from customer a
  413. left join customer_user_info b on a.id=b.cid
  414. left join customer_organization_info c on a.id=c.cid
  415. where id = #{id,jdbcType=VARCHAR}
  416. </select>
  417. <select id="selectCustomer" parameterType="com.goafanti.customer.bo.CustomerIn" resultType="com.goafanti.customer.bo.CustomerOut">
  418. select a.id,a.customer_typ as customerTyp,a.share_typ as shareTyp,a.tag,a.follow_situation as followSituation,
  419. c.name as contactName,c.mobile,c.tel_num as telNum,
  420. d.company_name as customerName,d.location_province as locationProvince,
  421. e.name as adminName
  422. from customer a
  423. left join follow_up_record b on a.follow_id = b.id
  424. left join customer_user_info c on b.cuid = c.id
  425. left join customer_organization_info d on a.id = d.cid
  426. left join admin e on a.aid = e.id
  427. where a.effective = 0
  428. <if test="aid != null">
  429. and a.aid = #{aid,jdbcType=VARCHAR}
  430. </if>
  431. <if test="shareTyp != null">
  432. and a.share_typ = #{shareTyp,jdbcType=INTEGER}
  433. </if>
  434. <if test="customerType != null">
  435. and a.customer_typ = #{customerTyp,jdbcType=INTEGER}
  436. </if>
  437. <if test="customerStauts != null">
  438. and a.customer_status = #{customerStauts,jdbcType=INTEGER}
  439. </if>
  440. <if test="companyIntention != null">
  441. and a.company_intention = #{companyIntention,jdbcType=INTEGER}
  442. </if>
  443. <if test="followSituation != null">
  444. and a.follow_situation = #{followSituation,jdbcType=INTEGER}
  445. </if>
  446. <if test="contactName != null">
  447. and c.name = #{contactName,jdbcType=VARCHAR}
  448. </if>
  449. <if test="contactTel != null">
  450. and c.tel_num = #{contactTel,jdbcType=VARCHAR}
  451. </if>
  452. <if test="adminName != null">
  453. and e.name = #{adminName,jdbcType=VARCHAR}
  454. </if>
  455. <if test="page_sql!=null">
  456. ${page_sql}
  457. </if>
  458. </select>
  459. </mapper>