UserFollowMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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.UserFollowMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.UserFollow">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. -->
  9. <id column="id" jdbcType="VARCHAR" property="id" />
  10. <result column="uid" jdbcType="VARCHAR" property="uid" />
  11. <result column="aid" jdbcType="VARCHAR" property="aid" />
  12. <result column="paid" jdbcType="VARCHAR" property="paid" />
  13. <result column="result" jdbcType="VARCHAR" property="result" />
  14. <result column="attachment_url" jdbcType="VARCHAR" property="attachmentUrl" />
  15. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  16. <result column="ocb_id" jdbcType="VARCHAR" property="ocbId" />
  17. <result column="contact_type" jdbcType="INTEGER" property="contactType" />
  18. <result column="effective" jdbcType="INTEGER" property="effective" />
  19. <result column="time_stamp" jdbcType="TIMESTAMP" property="timeStamp" />
  20. <result column="follow_count" jdbcType="INTEGER" property="followCount" />
  21. <result column="guidance" jdbcType="VARCHAR" property="guidance" />
  22. <result column="guidance_time" jdbcType="TIMESTAMP" property="guidanceTime" />
  23. <result column="guidance_aid" jdbcType="VARCHAR" property="guidanceAid" />
  24. <result column="guidance_name" jdbcType="VARCHAR" property="guidanceName" />
  25. </resultMap>
  26. <sql id="Base_Column_List">
  27. <!--
  28. WARNING - @mbg.generated
  29. This element is automatically generated by MyBatis Generator, do not modify.
  30. -->
  31. id, `uid`, aid, paid, `result`, attachment_url, create_time, ocb_id, contact_type,
  32. effective, time_stamp, follow_count, guidance, guidance_time, guidance_aid, guidance_name
  33. </sql>
  34. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  35. <!--
  36. WARNING - @mbg.generated
  37. This element is automatically generated by MyBatis Generator, do not modify.
  38. -->
  39. select
  40. <include refid="Base_Column_List" />
  41. from user_follow
  42. where id = #{id,jdbcType=VARCHAR}
  43. </select>
  44. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  45. <!--
  46. WARNING - @mbg.generated
  47. This element is automatically generated by MyBatis Generator, do not modify.
  48. -->
  49. delete from user_follow
  50. where id = #{id,jdbcType=VARCHAR}
  51. </delete>
  52. <insert id="insert" parameterType="com.goafanti.common.model.UserFollow">
  53. <!--
  54. WARNING - @mbg.generated
  55. This element is automatically generated by MyBatis Generator, do not modify.
  56. -->
  57. insert into user_follow (id, `uid`, aid,
  58. paid, `result`, attachment_url,
  59. create_time, ocb_id, contact_type,
  60. effective, time_stamp, follow_count,
  61. guidance, guidance_time, guidance_aid,
  62. guidance_name,follow_name,follow_dep)
  63. values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
  64. #{paid,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{attachmentUrl,jdbcType=VARCHAR},
  65. #{createTime,jdbcType=TIMESTAMP}, #{ocbId,jdbcType=VARCHAR}, #{contactType,jdbcType=INTEGER},
  66. #{effective,jdbcType=INTEGER}, #{timeStamp,jdbcType=TIMESTAMP}, #{followCount,jdbcType=INTEGER},
  67. #{guidance,jdbcType=VARCHAR}, #{guidanceTime,jdbcType=TIMESTAMP}, #{guidanceAid,jdbcType=VARCHAR},
  68. #{guidanceName,jdbcType=VARCHAR},#{followName},#{followDep})
  69. </insert>
  70. <insert id="insertSelective" parameterType="com.goafanti.common.model.UserFollow">
  71. <!--
  72. WARNING - @mbg.generated
  73. This element is automatically generated by MyBatis Generator, do not modify.
  74. -->
  75. insert into user_follow
  76. <trim prefix="(" suffix=")" suffixOverrides=",">
  77. <if test="id != null">
  78. id,
  79. </if>
  80. <if test="uid != null">
  81. `uid`,
  82. </if>
  83. <if test="aid != null">
  84. aid,
  85. </if>
  86. <if test="paid != null">
  87. paid,
  88. </if>
  89. <if test="result != null">
  90. `result`,
  91. </if>
  92. <if test="attachmentUrl != null">
  93. attachment_url,
  94. </if>
  95. <if test="createTime != null">
  96. create_time,
  97. </if>
  98. <if test="ocbId != null">
  99. ocb_id,
  100. </if>
  101. <if test="contactType != null">
  102. contact_type,
  103. </if>
  104. <if test="effective != null">
  105. effective,
  106. </if>
  107. <if test="timeStamp != null">
  108. time_stamp,
  109. </if>
  110. <if test="followCount != null">
  111. follow_count,
  112. </if>
  113. <if test="guidance != null">
  114. guidance,
  115. </if>
  116. <if test="guidanceTime != null">
  117. guidance_time,
  118. </if>
  119. <if test="guidanceAid != null">
  120. guidance_aid,
  121. </if>
  122. <if test="guidanceName != null">
  123. guidance_name,
  124. </if>
  125. </trim>
  126. <trim prefix="values (" suffix=")" suffixOverrides=",">
  127. <if test="id != null">
  128. #{id,jdbcType=VARCHAR},
  129. </if>
  130. <if test="uid != null">
  131. #{uid,jdbcType=VARCHAR},
  132. </if>
  133. <if test="aid != null">
  134. #{aid,jdbcType=VARCHAR},
  135. </if>
  136. <if test="paid != null">
  137. #{paid,jdbcType=VARCHAR},
  138. </if>
  139. <if test="result != null">
  140. #{result,jdbcType=VARCHAR},
  141. </if>
  142. <if test="attachmentUrl != null">
  143. #{attachmentUrl,jdbcType=VARCHAR},
  144. </if>
  145. <if test="createTime != null">
  146. #{createTime,jdbcType=TIMESTAMP},
  147. </if>
  148. <if test="ocbId != null">
  149. #{ocbId,jdbcType=VARCHAR},
  150. </if>
  151. <if test="contactType != null">
  152. #{contactType,jdbcType=INTEGER},
  153. </if>
  154. <if test="effective != null">
  155. #{effective,jdbcType=INTEGER},
  156. </if>
  157. <if test="timeStamp != null">
  158. #{timeStamp,jdbcType=TIMESTAMP},
  159. </if>
  160. <if test="followCount != null">
  161. #{followCount,jdbcType=INTEGER},
  162. </if>
  163. <if test="guidance != null">
  164. #{guidance,jdbcType=VARCHAR},
  165. </if>
  166. <if test="guidanceTime != null">
  167. #{guidanceTime,jdbcType=TIMESTAMP},
  168. </if>
  169. <if test="guidanceAid != null">
  170. #{guidanceAid,jdbcType=VARCHAR},
  171. </if>
  172. <if test="guidanceName != null">
  173. #{guidanceName,jdbcType=VARCHAR},
  174. </if>
  175. </trim>
  176. </insert>
  177. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.UserFollow">
  178. <!--
  179. WARNING - @mbg.generated
  180. This element is automatically generated by MyBatis Generator, do not modify.
  181. -->
  182. update user_follow
  183. <set>
  184. <if test="uid != null">
  185. `uid` = #{uid,jdbcType=VARCHAR},
  186. </if>
  187. <if test="aid != null">
  188. aid = #{aid,jdbcType=VARCHAR},
  189. </if>
  190. <if test="paid != null">
  191. paid = #{paid,jdbcType=VARCHAR},
  192. </if>
  193. <if test="result != null">
  194. `result` = #{result,jdbcType=VARCHAR},
  195. </if>
  196. <if test="attachmentUrl != null">
  197. attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
  198. </if>
  199. <if test="createTime != null">
  200. create_time = #{createTime,jdbcType=TIMESTAMP},
  201. </if>
  202. <if test="ocbId != null">
  203. ocb_id = #{ocbId,jdbcType=VARCHAR},
  204. </if>
  205. <if test="contactType != null">
  206. contact_type = #{contactType,jdbcType=INTEGER},
  207. </if>
  208. <if test="effective != null">
  209. effective = #{effective,jdbcType=INTEGER},
  210. </if>
  211. <if test="timeStamp != null">
  212. time_stamp = #{timeStamp,jdbcType=TIMESTAMP},
  213. </if>
  214. <if test="followCount != null">
  215. follow_count = #{followCount,jdbcType=INTEGER},
  216. </if>
  217. <if test="guidance != null">
  218. guidance = #{guidance,jdbcType=VARCHAR},
  219. </if>
  220. <if test="guidanceTime != null">
  221. guidance_time = #{guidanceTime,jdbcType=TIMESTAMP},
  222. </if>
  223. <if test="guidanceAid != null">
  224. guidance_aid = #{guidanceAid,jdbcType=VARCHAR},
  225. </if>
  226. <if test="guidanceName != null">
  227. guidance_name = #{guidanceName,jdbcType=VARCHAR},
  228. </if>
  229. </set>
  230. where id = #{id,jdbcType=VARCHAR}
  231. </update>
  232. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.UserFollow">
  233. <!--
  234. WARNING - @mbg.generated
  235. This element is automatically generated by MyBatis Generator, do not modify.
  236. -->
  237. update user_follow
  238. set `uid` = #{uid,jdbcType=VARCHAR},
  239. aid = #{aid,jdbcType=VARCHAR},
  240. paid = #{paid,jdbcType=VARCHAR},
  241. `result` = #{result,jdbcType=VARCHAR},
  242. attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
  243. create_time = #{createTime,jdbcType=TIMESTAMP},
  244. ocb_id = #{ocbId,jdbcType=VARCHAR},
  245. contact_type = #{contactType,jdbcType=INTEGER},
  246. effective = #{effective,jdbcType=INTEGER},
  247. time_stamp = #{timeStamp,jdbcType=TIMESTAMP},
  248. follow_count = #{followCount,jdbcType=INTEGER},
  249. guidance = #{guidance,jdbcType=VARCHAR},
  250. guidance_time = #{guidanceTime,jdbcType=TIMESTAMP},
  251. guidance_aid = #{guidanceAid,jdbcType=VARCHAR},
  252. guidance_name = #{guidanceName,jdbcType=VARCHAR}
  253. where id = #{id,jdbcType=VARCHAR}
  254. </update>
  255. <update id="pushUserGuidance">
  256. update user_follow b, `user` a
  257. set a.guidance= #{guidance}
  258. where a.id=b.uid and b.id= #{id}
  259. </update>
  260. <select id="selectbyUid" resultMap="BaseResultMap">
  261. select
  262. <include refid="Base_Column_List" />
  263. from user_follow a
  264. where a.uid= #{uid}
  265. and a.aid= #{aid}
  266. </select>
  267. <select id="userFollowList" resultType="com.goafanti.user.bo.outUserFollowList">
  268. select b.nickname,b.share_type shareType ,b.channel,b.id,date_format(b.transfer_time,'%Y-%m-%d %H:%i:%s')startTimes,
  269. a.contact_type contactType,a.follow_name followName ,a.follow_dep followDep,a.`result` ,a.follow_count followCount,
  270. date_format(a.create_time ,'%Y-%m-%d %H:%i:%s')followTimes,a.guidance_name guidanceName, a.guidance ,
  271. date_format(a.guidance_time,'%Y-%m-%d %H:%i:%s') guidanceTimes
  272. from user_follow a left join `user`b on a.uid =b.id
  273. where 1=1
  274. <if test="shiroType == 0">
  275. and a.aid= #{aid}
  276. </if>
  277. <if test="shiroType == 1">
  278. and aid in
  279. <foreach close=")" collection="aids" item="listItem" open="(" separator=",">
  280. #{listItem}
  281. </foreach>
  282. </if>
  283. <if test="followName != null">
  284. and a.follow_name like concat('%',#{followName},'%')
  285. </if>
  286. <if test="userName != null">
  287. and b.nickname like concat('%',#{userName},'%')
  288. </if>
  289. <if test="userType == 1">
  290. and b.share_type =0
  291. </if>
  292. <if test="userType == 2">
  293. and b.share_type =1
  294. </if>
  295. <if test="userType == 3">
  296. and b.share_type =2
  297. </if>
  298. <if test="userType == 4">
  299. and b.share_type =3
  300. </if>
  301. <if test="contactType != null">
  302. and a.contact_type = #{contactType}
  303. </if>
  304. <if test="followStartTime !=null and followEndTime !=null">
  305. and a.create_time between #{followStartTime} and #{followEndTime}
  306. </if>
  307. <if test="createStartTime !=null and createEndTime !=null">
  308. and b.transfer_time between #{createStartTime} and #{createEndTime}
  309. </if>
  310. <if test="guidanceStartTime !=null and guidanceEndTime !=null">
  311. and a.guidance_time between #{guidanceStartTime} and #{guidanceEndTime}
  312. </if>
  313. <if test="depId != null">
  314. and a.follow_dep = #{depId}
  315. </if>
  316. order by a.create_time desc
  317. <if test="page_sql != null">
  318. ${page_sql}
  319. </if>
  320. </select>
  321. <select id="userFollowCount" resultType="java.lang.Integer">
  322. select count(*)
  323. from user_follow a left join `user`b on a.uid =b.id where 1=1
  324. <if test="shiroType == 0">
  325. and a.aid= #{aid}
  326. </if>
  327. <if test="shiroType == 1">
  328. and aid in
  329. <foreach close=")" collection="aids" item="listItem" open="(" separator=",">
  330. #{listItem}
  331. </foreach>
  332. </if>
  333. <if test="followName != null">
  334. and a.follow_name like concat('%',#{followName},'%')
  335. </if>
  336. <if test="userName != null">
  337. and b.nickname like concat('%',#{userName},'%')
  338. </if>
  339. <if test="userType == 1">
  340. and b.share_type =0
  341. </if>
  342. <if test="userType == 2">
  343. and b.share_type =1
  344. </if>
  345. <if test="userType == 3">
  346. and b.share_type =2
  347. </if>
  348. <if test="userType == 4">
  349. and b.share_type =3
  350. </if>
  351. <if test="contactType != null">
  352. and a.contact_type = #{contactType}
  353. </if>
  354. <if test="followStartTime !=null and followEndTime !=null">
  355. and a.create_time between #{followStartTime} and #{followEndTime}
  356. </if>
  357. <if test="createStartTime !=null and createEndTime !=null">
  358. and b.transfer_time between #{createStartTime} and #{createEndTime}
  359. </if>
  360. <if test="guidanceStartTime !=null and guidanceEndTime !=null">
  361. and a.guidance_time between #{guidanceStartTime} and #{guidanceEndTime}
  362. </if>
  363. <if test="depId != null">
  364. and a.follow_dep = #{depId}
  365. </if>
  366. </select>
  367. </mapper>