ActivitiesServiceDaoImplMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="activitiesServiceDaoImpl">
  5. <!-- 保存活动信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveBusinessActivitiesInfo" parameterType="Map">
  7. insert into business_activities(collect_count, like_count, title, read_count, user_name, user_id, activities_id,
  8. operate, type_cd, context, start_time, end_time, community_id, b_id, header_img,
  9. state)
  10. values (#{collectCount}, #{likeCount}, #{title}, #{readCount}, #{userName}, #{userId}, #{activitiesId},
  11. #{operate}, #{typeCd}, #{context}, #{startTime}, #{endTime},
  12. #{communityId}, #{bId}, #{headerImg}, #{state})
  13. </insert>
  14. <!-- 查询活动信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessActivitiesInfo" parameterType="Map" resultType="Map">
  16. select t.collect_count,t.collect_count collectCount,t.like_count,t.like_count
  17. likeCount,t.title,t.read_count,t.read_count readCount,t.user_name,t.user_name userName,t.user_id,t.user_id
  18. userId,t.activities_id,t.activities_id activitiesId,t.operate,t.type_cd,t.type_cd
  19. typeCd,t.context,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id
  20. communityId,t.b_id,t.b_id bId,t.header_img,t.header_img headerImg,t.state
  21. from business_activities t
  22. where 1 =1
  23. <if test="collectCount !=null and collectCount != ''">
  24. and t.collect_count= #{collectCount}
  25. </if>
  26. <if test="likeCount !=null and likeCount != ''">
  27. and t.like_count= #{likeCount}
  28. </if>
  29. <if test="title !=null and title != ''">
  30. and t.title= #{title}
  31. </if>
  32. <if test="readCount !=null and readCount != ''">
  33. and t.read_count= #{readCount}
  34. </if>
  35. <if test="userName !=null and userName != ''">
  36. and t.user_name= #{userName}
  37. </if>
  38. <if test="userId !=null and userId != ''">
  39. and t.user_id= #{userId}
  40. </if>
  41. <if test="activitiesId !=null and activitiesId != ''">
  42. and t.activities_id= #{activitiesId}
  43. </if>
  44. <if test="operate !=null and operate != ''">
  45. and t.operate= #{operate}
  46. </if>
  47. <if test="typeCd !=null and typeCd != ''">
  48. and t.type_cd= #{typeCd}
  49. </if>
  50. <if test="context !=null and context != ''">
  51. and t.context= #{context}
  52. </if>
  53. <if test="startTime !=null ">
  54. and t.start_time= #{startTime}
  55. </if>
  56. <if test="endTime !=null ">
  57. and t.end_time= #{endTime}
  58. </if>
  59. <if test="communityId !=null and communityId != ''">
  60. and t.community_id= #{communityId}
  61. </if>
  62. <if test="bId !=null and bId != ''">
  63. and t.b_id= #{bId}
  64. </if>
  65. <if test="headerImg !=null and headerImg != ''">
  66. and t.header_img= #{headerImg}
  67. </if>
  68. <if test="state !=null and state != ''">
  69. and t.state= #{state}
  70. </if>
  71. </select>
  72. <!-- 保存活动信息至 instance表中 add by wuxw 2018-07-03 -->
  73. <insert id="saveActivitiesInfoInstance" parameterType="Map">
  74. insert into activities(
  75. collect_count,like_count,status_cd,title,read_count,user_name,user_id,activities_id,type_cd,context,start_time,
  76. end_time,community_id,b_id,header_img,state
  77. ) select
  78. t.collect_count,t.like_count,'0',t.title,t.read_count,t.user_name,t.user_id,t.activities_id,t.type_cd,t.context,t.start_time,
  79. t.end_time,t.community_id,t.b_id,t.header_img,t.state
  80. from business_activities t where 1=1
  81. <if test="collectCount !=null and collectCount != ''">
  82. and t.collect_count= #{collectCount}
  83. </if>
  84. <if test="likeCount !=null and likeCount != ''">
  85. and t.like_count= #{likeCount}
  86. </if>
  87. <if test="title !=null and title != ''">
  88. and t.title= #{title}
  89. </if>
  90. <if test="readCount !=null and readCount != ''">
  91. and t.read_count= #{readCount}
  92. </if>
  93. <if test="userName !=null and userName != ''">
  94. and t.user_name= #{userName}
  95. </if>
  96. <if test="userId !=null and userId != ''">
  97. and t.user_id= #{userId}
  98. </if>
  99. <if test="activitiesId !=null and activitiesId != ''">
  100. and t.activities_id= #{activitiesId}
  101. </if>
  102. and t.operate= 'ADD'
  103. <if test="typeCd !=null and typeCd != ''">
  104. and t.type_cd= #{typeCd}
  105. </if>
  106. <if test="context !=null and context != ''">
  107. and t.context= #{context}
  108. </if>
  109. <if test="startTime !=null ">
  110. and t.start_time= #{startTime}
  111. </if>
  112. <if test="endTime !=null ">
  113. and t.end_time= #{endTime}
  114. </if>
  115. <if test="communityId !=null and communityId != ''">
  116. and t.community_id= #{communityId}
  117. </if>
  118. <if test="bId !=null and bId != ''">
  119. and t.b_id= #{bId}
  120. </if>
  121. <if test="headerImg !=null and headerImg != ''">
  122. and t.header_img= #{headerImg}
  123. </if>
  124. </insert>
  125. <!-- 查询活动信息 add by wuxw 2018-07-03 -->
  126. <select id="getActivitiesInfo" parameterType="Map" resultType="Map">
  127. select t.collect_count,t.collect_count collectCount,t.like_count,t.like_count likeCount,t.status_cd,t.status_cd
  128. statusCd,t.title,t.read_count,t.read_count readCount,t.user_name,t.user_name userName,t.user_id,t.user_id
  129. userId,t.activities_id,t.activities_id activitiesId,t.type_cd,t.type_cd
  130. typeCd,t.context,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id
  131. communityId,t.b_id,t.b_id bId,t.header_img,t.header_img headerImg,t.state,act.type_name typeCdName,t.create_time
  132. createTime
  133. from activities t
  134. left join activities_type act on t.type_cd = act.type_cd and t.community_id = act.community_id
  135. where 1 =1
  136. and t.status_cd= '0' and act.status_cd = '0'
  137. <if test="collectCount !=null and collectCount != ''">
  138. and t.collect_count= #{collectCount}
  139. </if>
  140. <if test="likeCount !=null and likeCount != ''">
  141. and t.like_count= #{likeCount}
  142. </if>
  143. <if test="title !=null and title != ''">
  144. and t.title like '%${title}%'
  145. </if>
  146. <if test="readCount !=null and readCount != ''">
  147. and t.read_count= #{readCount}
  148. </if>
  149. <if test="staffName !=null and staffName != ''">
  150. and t.user_name= #{staffName}
  151. </if>
  152. <if test="activitiesId !=null and activitiesId != ''">
  153. and t.activities_id= #{activitiesId}
  154. </if>
  155. <if test="typeCd !=null and typeCd != ''">
  156. and t.type_cd= #{typeCd}
  157. </if>
  158. <if test="context !=null and context != ''">
  159. and t.context= #{context}
  160. </if>
  161. <if test="startTime !=null ">
  162. and t.start_time &lt;= #{startTime}
  163. </if>
  164. <if test="endTime !=null ">
  165. and t.end_time &gt;= #{endTime}
  166. </if>
  167. <if test="communityId !=null and communityId != ''">
  168. and t.community_id= #{communityId}
  169. </if>
  170. <if test="bId !=null and bId != ''">
  171. and t.b_id= #{bId}
  172. </if>
  173. <if test="headerImg !=null and headerImg != ''">
  174. and t.header_img= #{headerImg}
  175. </if>
  176. <if test="state !=null and state != ''">
  177. and t.state= #{state}
  178. </if>
  179. order by t.create_time desc
  180. <if test="page != -1 and page != null ">
  181. limit #{page}, #{row}
  182. </if>
  183. </select>
  184. <!-- 修改活动信息 add by wuxw 2018-07-03 -->
  185. <update id="updateActivitiesInfoInstance" parameterType="Map">
  186. update activities t set t.status_cd = #{statusCd}
  187. <if test="newBId != null and newBId != ''">
  188. ,t.b_id = #{newBId}
  189. </if>
  190. <if test="collectCount !=null and collectCount != ''">
  191. , t.collect_count= #{collectCount}
  192. </if>
  193. <if test="likeCount !=null and likeCount != ''">
  194. , t.like_count= #{likeCount}
  195. </if>
  196. <if test="title !=null and title != ''">
  197. , t.title= #{title}
  198. </if>
  199. <if test="readCount !=null and readCount != ''">
  200. , t.read_count= #{readCount}
  201. </if>
  202. <if test="userName !=null and userName != ''">
  203. , t.user_name= #{userName}
  204. </if>
  205. <if test="userId !=null and userId != ''">
  206. , t.user_id= #{userId}
  207. </if>
  208. <if test="typeCd !=null and typeCd != ''">
  209. , t.type_cd= #{typeCd}
  210. </if>
  211. <if test="context !=null and context != ''">
  212. , t.context= #{context}
  213. </if>
  214. <if test="startTime !=null ">
  215. , t.start_time= #{startTime}
  216. </if>
  217. <if test="endTime !=null ">
  218. , t.end_time= #{endTime}
  219. </if>
  220. <if test="communityId !=null and communityId != ''">
  221. , t.community_id= #{communityId}
  222. </if>
  223. <if test="headerImg !=null and headerImg != ''">
  224. , t.header_img= #{headerImg}
  225. </if>
  226. <if test="state !=null and state != ''">
  227. , t.state= #{state}
  228. </if>
  229. where 1=1
  230. <if test="activitiesId !=null and activitiesId != ''">
  231. and t.activities_id= #{activitiesId}
  232. </if>
  233. <if test="bId !=null and bId != ''">
  234. and t.b_id= #{bId}
  235. </if>
  236. </update>
  237. <!-- 查询活动数量 add by wuxw 2018-07-03 -->
  238. <select id="queryActivitiessCount" parameterType="Map" resultType="Map">
  239. select count(1) count
  240. from activities t
  241. where 1 =1
  242. and t.status_cd= '0'
  243. <if test="collectCount !=null and collectCount != ''">
  244. and t.collect_count= #{collectCount}
  245. </if>
  246. <if test="likeCount !=null and likeCount != ''">
  247. and t.like_count= #{likeCount}
  248. </if>
  249. <if test="title !=null and title != ''">
  250. and t.title like '%${title}%'
  251. </if>
  252. <if test="readCount !=null and readCount != ''">
  253. and t.read_count= #{readCount}
  254. </if>
  255. <if test="staffName !=null and staffName != ''">
  256. and t.user_name= #{staffName}
  257. </if>
  258. <if test="activitiesId !=null and activitiesId != ''">
  259. and t.activities_id= #{activitiesId}
  260. </if>
  261. <if test="typeCd !=null and typeCd != ''">
  262. and t.type_cd= #{typeCd}
  263. </if>
  264. <if test="context !=null and context != ''">
  265. and t.context= #{context}
  266. </if>
  267. <if test="startTime !=null ">
  268. and t.start_time &lt;= #{startTime}
  269. </if>
  270. <if test="endTime !=null ">
  271. and t.end_time &gt;= #{endTime}
  272. </if>
  273. <if test="communityId !=null and communityId != ''">
  274. and t.community_id= #{communityId}
  275. </if>
  276. <if test="bId !=null and bId != ''">
  277. and t.b_id= #{bId}
  278. </if>
  279. <if test="headerImg !=null and headerImg != ''">
  280. and t.header_img= #{headerImg}
  281. </if>
  282. <if test="state !=null and state != ''">
  283. and t.state= #{state}
  284. </if>
  285. </select>
  286. </mapper>