ActivitiesServiceDaoImplMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="activitiesServiceDaoImpl">
  6. <!-- 保存活动信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessActivitiesInfo" parameterType="Map">
  8. insert into business_activities(
  9. collect_count,like_count,title,read_count,user_name,user_id,activities_id,operate,type_cd,context,start_time,end_time,community_id,b_id,header_img,state
  10. ) values (
  11. #{collectCount},#{likeCount},#{title},#{readCount},#{userName},#{userId},#{activitiesId},#{operate},#{typeCd},#{context},#{startTime},#{endTime},
  12. #{communityId},#{bId},#{headerImg},#{state}
  13. )
  14. </insert>
  15. <!-- 查询活动信息(Business) add by wuxw 2018-07-03 -->
  16. <select id="getBusinessActivitiesInfo" parameterType="Map" resultType="Map">
  17. select t.collect_count,t.collect_count collectCount,t.like_count,t.like_count
  18. likeCount,t.title,t.read_count,t.read_count readCount,t.user_name,t.user_name userName,t.user_id,t.user_id
  19. userId,t.activities_id,t.activities_id activitiesId,t.operate,t.type_cd,t.type_cd
  20. typeCd,t.context,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id
  21. communityId,t.b_id,t.b_id bId,t.header_img,t.header_img headerImg,t.state
  22. from business_activities t
  23. where 1 =1
  24. <if test="collectCount !=null and collectCount != ''">
  25. and t.collect_count= #{collectCount}
  26. </if>
  27. <if test="likeCount !=null and likeCount != ''">
  28. and t.like_count= #{likeCount}
  29. </if>
  30. <if test="title !=null and title != ''">
  31. and t.title= #{title}
  32. </if>
  33. <if test="readCount !=null and readCount != ''">
  34. and t.read_count= #{readCount}
  35. </if>
  36. <if test="userName !=null and userName != ''">
  37. and t.user_name= #{userName}
  38. </if>
  39. <if test="userId !=null and userId != ''">
  40. and t.user_id= #{userId}
  41. </if>
  42. <if test="activitiesId !=null and activitiesId != ''">
  43. and t.activities_id= #{activitiesId}
  44. </if>
  45. <if test="operate !=null and operate != ''">
  46. and t.operate= #{operate}
  47. </if>
  48. <if test="typeCd !=null and typeCd != ''">
  49. and t.type_cd= #{typeCd}
  50. </if>
  51. <if test="context !=null and context != ''">
  52. and t.context= #{context}
  53. </if>
  54. <if test="startTime !=null ">
  55. and t.start_time= #{startTime}
  56. </if>
  57. <if test="endTime !=null ">
  58. and t.end_time= #{endTime}
  59. </if>
  60. <if test="communityId !=null and communityId != ''">
  61. and t.community_id= #{communityId}
  62. </if>
  63. <if test="bId !=null and bId != ''">
  64. and t.b_id= #{bId}
  65. </if>
  66. <if test="headerImg !=null and headerImg != ''">
  67. and t.header_img= #{headerImg}
  68. </if>
  69. <if test="state !=null and state != ''">
  70. and t.state= #{state}
  71. </if>
  72. </select>
  73. <!-- 保存活动信息至 instance表中 add by wuxw 2018-07-03 -->
  74. <insert id="saveActivitiesInfoInstance" parameterType="Map">
  75. insert into activities(
  76. collect_count,like_count,status_cd,title,read_count,user_name,user_id,activities_id,type_cd,context,start_time,
  77. end_time,community_id,b_id,header_img,state
  78. ) select
  79. 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,
  80. t.end_time,t.community_id,t.b_id,t.header_img,t.state
  81. from business_activities t where 1=1
  82. <if test="collectCount !=null and collectCount != ''">
  83. and t.collect_count= #{collectCount}
  84. </if>
  85. <if test="likeCount !=null and likeCount != ''">
  86. and t.like_count= #{likeCount}
  87. </if>
  88. <if test="title !=null and title != ''">
  89. and t.title= #{title}
  90. </if>
  91. <if test="readCount !=null and readCount != ''">
  92. and t.read_count= #{readCount}
  93. </if>
  94. <if test="userName !=null and userName != ''">
  95. and t.user_name= #{userName}
  96. </if>
  97. <if test="userId !=null and userId != ''">
  98. and t.user_id= #{userId}
  99. </if>
  100. <if test="activitiesId !=null and activitiesId != ''">
  101. and t.activities_id= #{activitiesId}
  102. </if>
  103. and t.operate= 'ADD'
  104. <if test="typeCd !=null and typeCd != ''">
  105. and t.type_cd= #{typeCd}
  106. </if>
  107. <if test="context !=null and context != ''">
  108. and t.context= #{context}
  109. </if>
  110. <if test="startTime !=null ">
  111. and t.start_time= #{startTime}
  112. </if>
  113. <if test="endTime !=null ">
  114. and t.end_time= #{endTime}
  115. </if>
  116. <if test="communityId !=null and communityId != ''">
  117. and t.community_id= #{communityId}
  118. </if>
  119. <if test="bId !=null and bId != ''">
  120. and t.b_id= #{bId}
  121. </if>
  122. <if test="headerImg !=null and headerImg != ''">
  123. and t.header_img= #{headerImg}
  124. </if>
  125. </insert>
  126. <!-- 查询活动信息 add by wuxw 2018-07-03 -->
  127. <select id="getActivitiesInfo" parameterType="Map" resultType="Map">
  128. select t.collect_count,t.collect_count collectCount,t.like_count,t.like_count likeCount,t.status_cd,t.status_cd
  129. statusCd,t.title,t.read_count,t.read_count readCount,t.user_name,t.user_name userName,t.user_id,t.user_id
  130. userId,t.activities_id,t.activities_id activitiesId,t.type_cd,t.type_cd
  131. typeCd,t.context,t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id
  132. communityId,t.b_id,t.b_id bId,t.header_img,t.header_img headerImg,t.state,act.type_name typeCdName,t.create_time createTime
  133. from activities t
  134. left join activities_type act on t.type_cd = act.type_cd and act.status_cd = '0' and t.community_id = act.community_id
  135. where 1 =1
  136. and t.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= #{title}
  145. </if>
  146. <if test="readCount !=null and readCount != ''">
  147. and t.read_count= #{readCount}
  148. </if>
  149. <if test="userName !=null and userName != ''">
  150. and t.user_name= #{userName}
  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= #{startTime}
  163. </if>
  164. <if test="endTime !=null ">
  165. and t.end_time= #{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= #{title}
  251. </if>
  252. <if test="readCount !=null and readCount != ''">
  253. and t.read_count= #{readCount}
  254. </if>
  255. <if test="userName !=null and userName != ''">
  256. and t.user_name= #{userName}
  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= #{startTime}
  269. </if>
  270. <if test="endTime !=null ">
  271. and t.end_time= #{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>