소스 검색

活动列表获取

傅行帆 6 년 전
부모
커밋
effda06aa2

+ 14
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java 파일 보기

@@ -2,6 +2,7 @@ package com.community.huiju.controller;
2 2
 
3 3
 import com.community.commom.constant.Constant;
4 4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.huiju.model.TpActivity;
5 6
 import com.community.huiju.model.TpAnnouncement;
6 7
 import com.community.huiju.model.TpMessage;
7 8
 import com.community.huiju.service.SocialServiceI;
@@ -59,4 +60,17 @@ public class SocialController {
59 60
         responseBean.addSuccess(announcementList);
60 61
         return responseBean;
61 62
     }
63
+    
64
+    @ApiOperation(value = "按小区获取分页活动列表", notes = "按小区获取分页活动列表,公告标题模糊查询")
65
+    @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
66
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "title", value = "活动标题"),
67
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
68
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
69
+    @RequestMapping(value = "/activitys/{communityId}",method = RequestMethod.GET)
70
+    public ResponseBean getActivitys(@PathVariable Integer communityId,@RequestParam String title,@RequestParam Integer pageNum,@RequestParam Integer pageSize){
71
+        ResponseBean responseBean = new ResponseBean();
72
+        List<TpActivity> activityList = socialServiceI.getActivitys(communityId,title,pageNum,pageSize);
73
+        responseBean.addSuccess(activityList);
74
+        return responseBean;
75
+    }
62 76
 }

+ 5
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivityMapper.java 파일 보기

@@ -3,6 +3,9 @@ package com.community.huiju.dao;
3 3
 
4 4
 import com.community.huiju.model.TpActivity;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
6 9
 
7 10
 @Mapper
8 11
 public interface TpActivityMapper {
@@ -17,4 +20,6 @@ public interface TpActivityMapper {
17 20
     int updateByPrimaryKeySelective(TpActivity record);
18 21
 
19 22
     int updateByPrimaryKey(TpActivity record);
23
+    
24
+    List<TpActivity> getActivitys(@Param("communityId")Integer communityId,@Param("title") String title);
20 25
 }

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpSocialViewMapper.java 파일 보기

@@ -1,7 +1,9 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpSocialView;
4
+import org.apache.ibatis.annotations.Mapper;
4 5
 
6
+@Mapper
5 7
 public interface TpSocialViewMapper {
6 8
     int deleteByPrimaryKey(Integer id);
7 9
 

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java 파일 보기

@@ -1,7 +1,9 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpTransaction;
4
+import org.apache.ibatis.annotations.Mapper;
4 5
 
6
+@Mapper
5 7
 public interface TpTransactionMapper {
6 8
     int deleteByPrimaryKey(Integer id);
7 9
 

+ 10
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpActivity.java 파일 보기

@@ -38,6 +38,8 @@ public class TpActivity {
38 38
     private Integer updateUser;
39 39
 
40 40
     private Date updateDate;
41
+    
42
+    private String userName;
41 43
 
42 44
     public Integer getId() {
43 45
         return id;
@@ -182,4 +184,12 @@ public class TpActivity {
182 184
     public void setUpdateDate(Date updateDate) {
183 185
         this.updateDate = updateDate;
184 186
     }
187
+    
188
+    public String getUserName() {
189
+        return userName;
190
+    }
191
+    
192
+    public void setUserName(String userName) {
193
+        this.userName = userName;
194
+    }
185 195
 }

+ 12
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java 파일 보기

@@ -1,5 +1,6 @@
1 1
 package com.community.huiju.service;
2 2
 
3
+import com.community.huiju.model.TpActivity;
3 4
 import com.community.huiju.model.TpAnnouncement;
4 5
 import com.community.huiju.model.TpMessage;
5 6
 
@@ -16,9 +17,20 @@ public interface SocialServiceI {
16 17
 	/**
17 18
 	 * 分页获取公告列表
18 19
 	 * @param communityId
20
+	 * @param title
19 21
 	 * @param pageNum
20 22
 	 * @param pageSize
21 23
 	 * @return
22 24
 	 */
23 25
 	List<TpAnnouncement> getAnnouncements(Integer communityId, String title, Integer pageNum, Integer pageSize);
26
+	
27
+	/**
28
+	 * 分页获取活动列表
29
+	 * @param communityId
30
+	 * @param title
31
+	 * @param pageNum
32
+	 * @param pageSize
33
+	 * @return
34
+	 */
35
+	List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize);
24 36
 }

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MessageServiceImpl.java 파일 보기

@@ -27,6 +27,7 @@ public class MessageServiceImpl implements MessageServiceI {
27 27
 	 */
28 28
 	@Override
29 29
 	public Map<String, Object> getMessageTotal(Integer communityId) {
30
+		//todo
30 31
 		Integer userId = 1;
31 32
 		return tpMessageMapper.getMessageTotal(userId,communityId);
32 33
 	}
@@ -41,6 +42,7 @@ public class MessageServiceImpl implements MessageServiceI {
41 42
 	 */
42 43
 	@Override
43 44
 	public List<TpMessage> getMessages(Integer communityId, Integer pageNum, Integer pageSize,Integer modelType) {
45
+		//todo
44 46
 		Integer userId = 1;
45 47
 		pageNum = null == pageNum ? 1 : pageNum;
46 48
 		pageSize = null == pageSize ? 10 : pageSize;

+ 26
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java 파일 보기

@@ -1,6 +1,8 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.community.huiju.dao.TpActivityMapper;
3 4
 import com.community.huiju.dao.TpAnnouncementMapper;
5
+import com.community.huiju.model.TpActivity;
4 6
 import com.community.huiju.model.TpAnnouncement;
5 7
 import com.community.huiju.model.TpMessage;
6 8
 import com.community.huiju.service.SocialServiceI;
@@ -20,6 +22,10 @@ import java.util.List;
20 22
 public class SocialServiceImpl implements SocialServiceI {
21 23
     @Autowired
22 24
     private TpAnnouncementMapper tpAnnouncementMapper;
25
+    
26
+    @Autowired
27
+    private TpActivityMapper tpActivityMapper;
28
+    
23 29
     @Override
24 30
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId) {
25 31
         return tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
@@ -28,6 +34,7 @@ public class SocialServiceImpl implements SocialServiceI {
28 34
     /**
29 35
      * 分页获取公告列表
30 36
      * @param communityId
37
+     * @param title
31 38
      * @param pageNum
32 39
      * @param pageSize
33 40
      * @return
@@ -42,4 +49,23 @@ public class SocialServiceImpl implements SocialServiceI {
42 49
         List<TpAnnouncement> announcementList = tpAnnouncementMapper.getAnnouncements(communityId,title);
43 50
         return announcementList;
44 51
     }
52
+    
53
+    /**
54
+     * 分页获取活动列表
55
+     * @param communityId
56
+     * @param title
57
+     * @param pageNum
58
+     * @param pageSize
59
+     * @return
60
+     */
61
+    @Override
62
+    public List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize) {
63
+        pageNum = null == pageNum ? 1 : pageNum;
64
+        pageSize = null == pageSize ? 10 : pageSize;
65
+        //使用分页插件
66
+        PageHelper.startPage(pageNum, pageSize);
67
+        // 获取数据
68
+        List<TpActivity> activityList = tpActivityMapper.getActivitys(communityId,title);
69
+        return activityList;
70
+    }
45 71
 }

+ 24
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml 파일 보기

@@ -7,6 +7,7 @@
7 7
     <result column="activity_title" property="activityTitle" jdbcType="VARCHAR" />
8 8
     <result column="activity_carousel_img" property="activityCarouselImg" jdbcType="VARCHAR" />
9 9
     <result column="activity_content" property="activityContent" jdbcType="VARCHAR" />
10
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
10 11
     <result column="sort" property="sort" jdbcType="INTEGER" />
11 12
     <result column="sign_up_count" property="signUpCount" jdbcType="INTEGER" />
12 13
     <result column="sign_up_max" property="signUpMax" jdbcType="INTEGER" />
@@ -246,4 +247,27 @@
246 247
       update_date = #{updateDate,jdbcType=TIMESTAMP}
247 248
     where id = #{id,jdbcType=INTEGER}
248 249
   </update>
250
+
251
+  <select id="getActivitys" resultMap="BaseResultMap">
252
+    SELECT
253
+      a.id,
254
+      a.activity_title,
255
+      a.activity_content,
256
+      a.create_date,
257
+      u.user_name AS user_name,
258
+      a.sort,
259
+      a.view_count,
260
+      a.sign_up_count
261
+  FROM
262
+      tp_activity a
263
+      LEFT JOIN tp_user u ON a.create_user = u.id
264
+      AND u.community_id = #{communityId,jdbcType=INTEGER}
265
+  WHERE
266
+      a.community_id = #{communityId,jdbcType=INTEGER}
267
+      AND ( a.STATUS = 1 OR a.STATUS = 3 )
268
+      AND a.activity_title LIKE concat('%',#{title,jdbcType=VARCHAR},'%')
269
+  ORDER BY
270
+      a.sort,
271
+      a.create_date DESC
272
+  </select>
249 273
 </mapper>

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpAnnouncementMapper.xml 파일 보기

@@ -204,7 +204,7 @@
204 204
   WHERE
205 205
       a.community_id = #{communityId,jdbcType=INTEGER}
206 206
       AND ( a.STATUS = 1 OR a.STATUS = 3 )
207
-      and announcement_title like concat('%',#{title,jdbcType=VARCHAR},'%')
207
+      and a.announcement_title like concat('%',#{title,jdbcType=VARCHAR},'%')
208 208
   ORDER BY
209 209
       a.sort,
210 210
       a.create_date DESC

BIN
文档/需求/app接口需求-第二版.xlsx 파일 보기