UserBusinessMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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.UserBusinessMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserBusiness">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Sat May 05 10:50:19 CST 2018.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="uid" jdbcType="VARCHAR" property="uid" />
  12. <result column="aid" jdbcType="VARCHAR" property="aid" />
  13. <result column="follow_situation" jdbcType="INTEGER" property="followSituation" />
  14. <result column="customer_status" jdbcType="INTEGER" property="customerStatus" />
  15. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  16. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  17. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  18. <result column="business_project_id" jdbcType="VARCHAR" property="businessProjectId" />
  19. </resultMap>
  20. <sql id="Example_Where_Clause">
  21. <!--
  22. WARNING - @mbg.generated
  23. This element is automatically generated by MyBatis Generator, do not modify.
  24. This element was generated on Sat May 05 10:50:19 CST 2018.
  25. -->
  26. <where>
  27. <foreach collection="oredCriteria" item="criteria" separator="or">
  28. <if test="criteria.valid">
  29. <trim prefix="(" prefixOverrides="and" suffix=")">
  30. <foreach collection="criteria.criteria" item="criterion">
  31. <choose>
  32. <when test="criterion.noValue">
  33. and ${criterion.condition}
  34. </when>
  35. <when test="criterion.singleValue">
  36. and ${criterion.condition} #{criterion.value}
  37. </when>
  38. <when test="criterion.betweenValue">
  39. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  40. </when>
  41. <when test="criterion.listValue">
  42. and ${criterion.condition}
  43. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  44. #{listItem}
  45. </foreach>
  46. </when>
  47. </choose>
  48. </foreach>
  49. </trim>
  50. </if>
  51. </foreach>
  52. </where>
  53. </sql>
  54. <sql id="Update_By_Example_Where_Clause">
  55. <!--
  56. WARNING - @mbg.generated
  57. This element is automatically generated by MyBatis Generator, do not modify.
  58. This element was generated on Sat May 05 10:50:19 CST 2018.
  59. -->
  60. <where>
  61. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  62. <if test="criteria.valid">
  63. <trim prefix="(" prefixOverrides="and" suffix=")">
  64. <foreach collection="criteria.criteria" item="criterion">
  65. <choose>
  66. <when test="criterion.noValue">
  67. and ${criterion.condition}
  68. </when>
  69. <when test="criterion.singleValue">
  70. and ${criterion.condition} #{criterion.value}
  71. </when>
  72. <when test="criterion.betweenValue">
  73. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  74. </when>
  75. <when test="criterion.listValue">
  76. and ${criterion.condition}
  77. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  78. #{listItem}
  79. </foreach>
  80. </when>
  81. </choose>
  82. </foreach>
  83. </trim>
  84. </if>
  85. </foreach>
  86. </where>
  87. </sql>
  88. <sql id="Base_Column_List">
  89. <!--
  90. WARNING - @mbg.generated
  91. This element is automatically generated by MyBatis Generator, do not modify.
  92. This element was generated on Sat May 05 10:50:19 CST 2018.
  93. -->
  94. id, uid, aid, follow_situation, customer_status, create_time, update_time, remarks,
  95. business_project_id
  96. </sql>
  97. <select id="selectByExample" parameterType="com.goafanti.common.model.UserBusinessExample" resultMap="BaseResultMap">
  98. <!--
  99. WARNING - @mbg.generated
  100. This element is automatically generated by MyBatis Generator, do not modify.
  101. This element was generated on Sat May 05 10:50:19 CST 2018.
  102. -->
  103. select
  104. <if test="distinct">
  105. distinct
  106. </if>
  107. <include refid="Base_Column_List" />
  108. from user_business
  109. <if test="_parameter != null">
  110. <include refid="Example_Where_Clause" />
  111. </if>
  112. <if test="orderByClause != null">
  113. order by ${orderByClause}
  114. </if>
  115. </select>
  116. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  117. <!--
  118. WARNING - @mbg.generated
  119. This element is automatically generated by MyBatis Generator, do not modify.
  120. This element was generated on Sat May 05 10:50:19 CST 2018.
  121. -->
  122. select
  123. <include refid="Base_Column_List" />
  124. from user_business
  125. where id = #{id,jdbcType=VARCHAR}
  126. </select>
  127. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  128. <!--
  129. WARNING - @mbg.generated
  130. This element is automatically generated by MyBatis Generator, do not modify.
  131. This element was generated on Sat May 05 10:50:19 CST 2018.
  132. -->
  133. delete from user_business
  134. where id = #{id,jdbcType=VARCHAR}
  135. </delete>
  136. <delete id="deleteByExample" parameterType="com.goafanti.common.model.UserBusinessExample">
  137. <!--
  138. WARNING - @mbg.generated
  139. This element is automatically generated by MyBatis Generator, do not modify.
  140. This element was generated on Sat May 05 10:50:19 CST 2018.
  141. -->
  142. delete from user_business
  143. <if test="_parameter != null">
  144. <include refid="Example_Where_Clause" />
  145. </if>
  146. </delete>
  147. <insert id="insert" parameterType="com.goafanti.common.model.UserBusiness">
  148. <!--
  149. WARNING - @mbg.generated
  150. This element is automatically generated by MyBatis Generator, do not modify.
  151. This element was generated on Sat May 05 10:50:19 CST 2018.
  152. -->
  153. insert into user_business (id, uid, aid,
  154. follow_situation, customer_status, create_time,
  155. update_time, remarks, business_project_id
  156. )
  157. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
  158. #{followSituation,jdbcType=INTEGER}, #{customerStatus,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
  159. #{updateTime,jdbcType=TIMESTAMP}, #{remarks,jdbcType=VARCHAR}, #{businessProjectId,jdbcType=VARCHAR}
  160. )
  161. </insert>
  162. <insert id="insertSelective" parameterType="com.goafanti.common.model.UserBusiness">
  163. <!--
  164. WARNING - @mbg.generated
  165. This element is automatically generated by MyBatis Generator, do not modify.
  166. This element was generated on Sat May 05 10:50:19 CST 2018.
  167. -->
  168. insert into user_business
  169. <trim prefix="(" suffix=")" suffixOverrides=",">
  170. <if test="id != null">
  171. id,
  172. </if>
  173. <if test="uid != null">
  174. uid,
  175. </if>
  176. <if test="aid != null">
  177. aid,
  178. </if>
  179. <if test="followSituation != null">
  180. follow_situation,
  181. </if>
  182. <if test="customerStatus != null">
  183. customer_status,
  184. </if>
  185. <if test="createTime != null">
  186. create_time,
  187. </if>
  188. <if test="updateTime != null">
  189. update_time,
  190. </if>
  191. <if test="remarks != null">
  192. remarks,
  193. </if>
  194. <if test="businessProjectId != null">
  195. business_project_id,
  196. </if>
  197. </trim>
  198. <trim prefix="values (" suffix=")" suffixOverrides=",">
  199. <if test="id != null">
  200. #{id,jdbcType=VARCHAR},
  201. </if>
  202. <if test="uid != null">
  203. #{uid,jdbcType=VARCHAR},
  204. </if>
  205. <if test="aid != null">
  206. #{aid,jdbcType=VARCHAR},
  207. </if>
  208. <if test="followSituation != null">
  209. #{followSituation,jdbcType=INTEGER},
  210. </if>
  211. <if test="customerStatus != null">
  212. #{customerStatus,jdbcType=INTEGER},
  213. </if>
  214. <if test="createTime != null">
  215. #{createTime,jdbcType=TIMESTAMP},
  216. </if>
  217. <if test="updateTime != null">
  218. #{updateTime,jdbcType=TIMESTAMP},
  219. </if>
  220. <if test="remarks != null">
  221. #{remarks,jdbcType=VARCHAR},
  222. </if>
  223. <if test="businessProjectId != null">
  224. #{businessProjectId,jdbcType=VARCHAR},
  225. </if>
  226. </trim>
  227. </insert>
  228. <select id="countByExample" parameterType="com.goafanti.common.model.UserBusinessExample" resultType="java.lang.Long">
  229. <!--
  230. WARNING - @mbg.generated
  231. This element is automatically generated by MyBatis Generator, do not modify.
  232. This element was generated on Sat May 05 10:50:19 CST 2018.
  233. -->
  234. select count(*) from user_business
  235. <if test="_parameter != null">
  236. <include refid="Example_Where_Clause" />
  237. </if>
  238. </select>
  239. <update id="updateByExampleSelective" parameterType="map">
  240. <!--
  241. WARNING - @mbg.generated
  242. This element is automatically generated by MyBatis Generator, do not modify.
  243. This element was generated on Sat May 05 10:50:19 CST 2018.
  244. -->
  245. update user_business
  246. <set>
  247. <if test="record.id != null">
  248. id = #{record.id,jdbcType=VARCHAR},
  249. </if>
  250. <if test="record.uid != null">
  251. uid = #{record.uid,jdbcType=VARCHAR},
  252. </if>
  253. <if test="record.aid != null">
  254. aid = #{record.aid,jdbcType=VARCHAR},
  255. </if>
  256. <if test="record.followSituation != null">
  257. follow_situation = #{record.followSituation,jdbcType=INTEGER},
  258. </if>
  259. <if test="record.customerStatus != null">
  260. customer_status = #{record.customerStatus,jdbcType=INTEGER},
  261. </if>
  262. <if test="record.createTime != null">
  263. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  264. </if>
  265. <if test="record.updateTime != null">
  266. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  267. </if>
  268. <if test="record.remarks != null">
  269. remarks = #{record.remarks,jdbcType=VARCHAR},
  270. </if>
  271. <if test="record.businessProjectId != null">
  272. business_project_id = #{record.businessProjectId,jdbcType=VARCHAR},
  273. </if>
  274. </set>
  275. <if test="_parameter != null">
  276. <include refid="Update_By_Example_Where_Clause" />
  277. </if>
  278. </update>
  279. <update id="updateByExample" parameterType="map">
  280. <!--
  281. WARNING - @mbg.generated
  282. This element is automatically generated by MyBatis Generator, do not modify.
  283. This element was generated on Sat May 05 10:50:19 CST 2018.
  284. -->
  285. update user_business
  286. set id = #{record.id,jdbcType=VARCHAR},
  287. uid = #{record.uid,jdbcType=VARCHAR},
  288. aid = #{record.aid,jdbcType=VARCHAR},
  289. follow_situation = #{record.followSituation,jdbcType=INTEGER},
  290. customer_status = #{record.customerStatus,jdbcType=INTEGER},
  291. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  292. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  293. remarks = #{record.remarks,jdbcType=VARCHAR},
  294. business_project_id = #{record.businessProjectId,jdbcType=VARCHAR}
  295. <if test="_parameter != null">
  296. <include refid="Update_By_Example_Where_Clause" />
  297. </if>
  298. </update>
  299. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserBusiness">
  300. <!--
  301. WARNING - @mbg.generated
  302. This element is automatically generated by MyBatis Generator, do not modify.
  303. This element was generated on Sat May 05 10:50:19 CST 2018.
  304. -->
  305. update user_business
  306. <set>
  307. <if test="uid != null">
  308. uid = #{uid,jdbcType=VARCHAR},
  309. </if>
  310. <if test="aid != null">
  311. aid = #{aid,jdbcType=VARCHAR},
  312. </if>
  313. <if test="followSituation != null">
  314. follow_situation = #{followSituation,jdbcType=INTEGER},
  315. </if>
  316. <if test="customerStatus != null">
  317. customer_status = #{customerStatus,jdbcType=INTEGER},
  318. </if>
  319. <if test="createTime != null">
  320. create_time = #{createTime,jdbcType=TIMESTAMP},
  321. </if>
  322. <if test="updateTime != null">
  323. update_time = #{updateTime,jdbcType=TIMESTAMP},
  324. </if>
  325. <if test="remarks != null">
  326. remarks = #{remarks,jdbcType=VARCHAR},
  327. </if>
  328. <if test="businessProjectId != null">
  329. business_project_id = #{businessProjectId,jdbcType=VARCHAR},
  330. </if>
  331. </set>
  332. where id = #{id,jdbcType=VARCHAR}
  333. </update>
  334. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserBusiness">
  335. <!--
  336. WARNING - @mbg.generated
  337. This element is automatically generated by MyBatis Generator, do not modify.
  338. This element was generated on Sat May 05 10:50:19 CST 2018.
  339. -->
  340. update user_business
  341. set uid = #{uid,jdbcType=VARCHAR},
  342. aid = #{aid,jdbcType=VARCHAR},
  343. follow_situation = #{followSituation,jdbcType=INTEGER},
  344. customer_status = #{customerStatus,jdbcType=INTEGER},
  345. create_time = #{createTime,jdbcType=TIMESTAMP},
  346. update_time = #{updateTime,jdbcType=TIMESTAMP},
  347. remarks = #{remarks,jdbcType=VARCHAR},
  348. business_project_id = #{businessProjectId,jdbcType=VARCHAR}
  349. where id = #{id,jdbcType=VARCHAR}
  350. </update>
  351. <select id="selectBusinessGlossory" resultType="com.goafanti.customer.bo.BusinessListBo">
  352. select id as businessGlossoryId,name as businessName from business_glossory
  353. </select>
  354. <select id="judgeBusiness" resultType="java.lang.Integer">
  355. select count(0) from user_business where
  356. uid = #{uid,jdbcType=VARCHAR} and customer_status != 6
  357. <if test="businessProjectId != null and businessProjectId != ''">
  358. and business_project_id = #{businessProjectId,jdbcType=VARCHAR}
  359. </if>
  360. <if test="aid != null and aid != ''">
  361. and aid = #{aid,jdbcType=VARCHAR}
  362. </if>
  363. </select>
  364. <select id="selectBusinessByUAid" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BusinessListBo">
  365. select
  366. a.id as businessId,
  367. a.uid,
  368. a.business_project_id as businessProjectId,
  369. a.follow_situation as followSituation,
  370. a.customer_status as customerStatus,
  371. a.remarks,
  372. b.bname as businessProjectName,
  373. c.cname as businessvarietiesName
  374. from user_business a
  375. left join business_project b on a.business_project_id = b.id
  376. left join business_category c on b.cid = c.id
  377. where a.uid = #{uid,jdbcType=VARCHAR} and a.aid = #{aid,jdbcType=VARCHAR} and a.customer_status != 6
  378. order by a.create_time
  379. </select>
  380. <select id="selectLockedBusinessByUAid" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BusinessListBo">
  381. select
  382. x.id as businessId,
  383. x.uid,
  384. 5 as followSituation,
  385. x.customer_status as customerStatus,
  386. y.business_project_id as businessProjectId,
  387. y.bname as businessProjectName,
  388. y.cname as businessvarietiesName
  389. from(
  390. select
  391. id,
  392. uid,
  393. business_project_id,
  394. follow_situation,
  395. customer_status,
  396. remarks
  397. from user_business
  398. where uid = #{uid} and aid = #{aid} and customer_status != 6
  399. )x right join(
  400. select
  401. a.business_project_id,
  402. b.bname,
  403. c.cname
  404. from user_lock_release a
  405. left join business_project b on a.business_project_id = b.id
  406. left join business_category c on b.cid = c.id
  407. where a.uid = #{uid} and a.aid = #{aid} and a.type = 1 and a.status = 0
  408. )y on x.business_project_id = y.business_project_id
  409. </select>
  410. <select id="selectFollowCountByUAid" parameterType="java.lang.String" resultType="java.lang.Integer">
  411. select count(0) from user_follow where uid = #{uid,jdbcType=VARCHAR} and aid = #{aid,jdbcType=VARCHAR}
  412. </select>
  413. <select id="findBusinessDetail" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BussinessFollowBo">
  414. select
  415. a.id as businessId,
  416. a.uid,
  417. a.business_project_id as businessProjectId,
  418. a.create_time as createTime,
  419. a.follow_situation as followSituation,
  420. a.customer_status as customerStatus,
  421. a.remarks,
  422. b.identify_name as identifyName,
  423. c.name as adminName,
  424. d.bname as businessProjectName
  425. from
  426. user_business a left join user b on
  427. a.uid = b.id left join admin c on
  428. a.aid = c.id left join business_project d on
  429. a.business_project_id = d.id
  430. where a.id = #{businessId,jdbcType=VARCHAR}
  431. </select>
  432. <select id="findFollowOneBusiness" parameterType="java.lang.String" resultType="com.goafanti.customer.bo.BussinessFollowBo">
  433. select
  434. a.customer_status as customerStatus,
  435. a.follow_situation as followSituation,
  436. a.remarks,
  437. a.business_project_id as businessProjectId,
  438. b.id as followId,
  439. b.create_time as createTime,
  440. b.result,
  441. b.contact_type as contactType,
  442. d.name as contacts,
  443. d.mobile as contactMobile,
  444. b.create_time as followTime,
  445. e.name as adminName,
  446. f.identify_name as identifyName,
  447. g.bname as businessProjectName
  448. from
  449. user_follow_business a
  450. left join user_follow b on a.follow_id = b.id
  451. left join user_business c on a.business_id = c.id
  452. left join organization_contact_book d on b.ocb_id = d.id
  453. left join admin e on b.aid = e.id
  454. left join user f on b.uid = f.id
  455. left join business_project g on a.business_project_id = g.id
  456. where a.id = #{ufbId,jdbcType=VARCHAR}
  457. </select>
  458. <update id="updateDimissionTransfer" parameterType="java.lang.String">
  459. update user_business
  460. set aid= #{transferId,jdbcType=VARCHAR}
  461. where aid= #{aid,jdbcType=VARCHAR}
  462. </update>
  463. <select id="selectBusinessProjectByUAPid" resultType="com.goafanti.customer.bo.BusinessListBo">
  464. select
  465. a.id as businessId,
  466. a.uid,
  467. a.business_project_id as businessProjectId,
  468. a.follow_situation as followSituation,
  469. a.customer_status as customerStatus,
  470. a.remarks,
  471. b.bname as businessProjectName,
  472. c.cname as businessvarietiesName
  473. from user_business a
  474. left join business_project b on a.business_project_id = b.id
  475. left join business_category c on b.cid = c.id
  476. where a.uid = #{uid,jdbcType=VARCHAR} and a.aid = #{aid,jdbcType=VARCHAR}
  477. and a.business_project_id= #{pid} and a.customer_status != 6
  478. </select>
  479. <select id="checkLock" resultType="java.lang.Integer">
  480. select count(*) from user_business
  481. where aid= #{aid} and uid= #{uid} and business_project_id = #{pid}
  482. </select>
  483. </mapper>