Bladeren bron

公告轮播图

dingxin 6 jaren geleden
bovenliggende
commit
a0dc9b2932

+ 14
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Bestand weergeven

@@ -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;
@@ -73,4 +74,17 @@ public class SocialController {
73 74
         return responseBean;
74 75
     }
75 76
 
77
+    
78
+    @ApiOperation(value = "按小区获取分页活动列表", notes = "按小区获取分页活动列表,公告标题模糊查询")
79
+    @ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
80
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "title", value = "活动标题"),
81
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
82
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
83
+    @RequestMapping(value = "/activitys/{communityId}",method = RequestMethod.GET)
84
+    public ResponseBean getActivitys(@PathVariable Integer communityId,@RequestParam String title,@RequestParam Integer pageNum,@RequestParam Integer pageSize){
85
+        ResponseBean responseBean = new ResponseBean();
86
+        List<TpActivity> activityList = socialServiceI.getActivitys(communityId,title,pageNum,pageSize);
87
+        responseBean.addSuccess(activityList);
88
+        return responseBean;
89
+    }
76 90
 }

+ 5
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivityMapper.java Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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,6 +17,7 @@ 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
@@ -29,4 +31,14 @@ public interface SocialServiceI {
29 31
 	 * @return
30 32
 	 */
31 33
 	List<TpAnnouncement> getAnnouncement(Integer communityId, Integer sum);
34
+	
35
+	/**
36
+	 * 分页获取活动列表
37
+	 * @param communityId
38
+	 * @param title
39
+	 * @param pageNum
40
+	 * @param pageSize
41
+	 * @return
42
+	 */
43
+	List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize);
32 44
 }

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MessageServiceImpl.java Bestand weergeven

@@ -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 Bestand weergeven

@@ -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
@@ -54,4 +61,23 @@ public class SocialServiceImpl implements SocialServiceI {
54 61
         return listAnnouncement;
55 62
     }
56 63
 
64
+    
65
+    /**
66
+     * 分页获取活动列表
67
+     * @param communityId
68
+     * @param title
69
+     * @param pageNum
70
+     * @param pageSize
71
+     * @return
72
+     */
73
+    @Override
74
+    public List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize) {
75
+        pageNum = null == pageNum ? 1 : pageNum;
76
+        pageSize = null == pageSize ? 10 : pageSize;
77
+        //使用分页插件
78
+        PageHelper.startPage(pageNum, pageSize);
79
+        // 获取数据
80
+        List<TpActivity> activityList = tpActivityMapper.getActivitys(communityId,title);
81
+        return activityList;
82
+    }
57 83
 }

+ 24
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml Bestand weergeven

@@ -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 Bestand weergeven

@@ -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