魏超 6 年前
父节点
当前提交
ae7cb7b482

+ 4
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpAnnouncementMapper.java 查看文件

@@ -5,6 +5,8 @@ import com.community.huiju.model.TpAnnouncement;
5 5
 import org.apache.ibatis.annotations.Mapper;
6 6
 import org.apache.ibatis.annotations.Param;
7 7
 
8
+import java.util.List;
9
+
8 10
 @Mapper
9 11
 public interface TpAnnouncementMapper {
10 12
     int deleteByPrimaryKey(Integer id);
@@ -18,4 +20,6 @@ public interface TpAnnouncementMapper {
18 20
     int updateByPrimaryKeySelective(@Param("id")Integer id, @Param("viewCount")Integer viewCount);
19 21
 
20 22
     int updateByPrimaryKey(TpAnnouncement record);
23
+	
24
+	List<TpAnnouncement> getAnnouncements(@Param("communityId") Integer communityId,@Param("title") String title);
21 25
 }

+ 0
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpSocialViewMapper.java 查看文件

@@ -1,6 +1,5 @@
1 1
 package com.community.huiju.dao;
2 2
 
3
-
4 3
 import com.community.huiju.model.TpSocialView;
5 4
 import org.apache.ibatis.annotations.Mapper;
6 5
 

+ 23
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java 查看文件

@@ -1,8 +1,11 @@
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.TpSocialView;
5 6
 
7
+import java.util.List;
8
+
6 9
 /**
7 10
  * @author weichaochao
8 11
  * @Title: SocialServiceI
@@ -10,5 +13,24 @@ import com.community.huiju.model.TpSocialView;
10 13
  */
11 14
 public interface SocialServiceI {
12 15
     TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId);
13
-    void insertSocialView(TpSocialView tpSocialView);
16
+
17
+	/**
18
+	 * 分页获取公告列表
19
+	 * @param communityId
20
+	 * @param title
21
+	 * @param pageNum
22
+	 * @param pageSize
23
+	 * @return
24
+	 */
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);
14 36
 }

+ 48
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java 查看文件

@@ -6,13 +6,21 @@ import com.community.huiju.dao.TpSocialViewMapper;
6 6
 import com.community.huiju.model.TpAnnouncement;
7 7
 import com.community.huiju.model.TpSocialView;
8 8
 import com.community.huiju.service.SocialServiceI;
9
-import io.swagger.models.auth.In;
9
+import com.community.huiju.dao.TpActivityMapper;
10
+import com.community.huiju.dao.TpAnnouncementMapper;
11
+import com.community.huiju.model.TpActivity;
12
+import com.community.huiju.model.TpAnnouncement;
13
+import com.community.huiju.model.TpMessage;
14
+import com.community.huiju.service.SocialServiceI;
15
+import com.github.pagehelper.PageHelper;
10 16
 import org.springframework.beans.factory.annotation.Autowired;
11 17
 import org.springframework.stereotype.Service;
12 18
 import org.springframework.transaction.annotation.Transactional;
13 19
 
14 20
 import java.util.Date;
15 21
 
22
+import java.util.List;
23
+
16 24
 /**
17 25
  * @author weichaochao
18 26
  * @Title: SocialServiceImpl
@@ -23,9 +31,13 @@ public class SocialServiceImpl implements SocialServiceI {
23 31
 
24 32
     @Autowired
25 33
     private TpAnnouncementMapper tpAnnouncementMapper;
34
+
26 35
     @Autowired
27 36
     private TpSocialViewMapper tpSocialViewMapper;
28 37
 
38
+    @Autowired
39
+    private TpActivityMapper tpActivityMapper;
40
+    
29 41
     @Override
30 42
     @Transactional
31 43
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId) {
@@ -47,8 +59,41 @@ public class SocialServiceImpl implements SocialServiceI {
47 59
         return tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
48 60
     }
49 61
 
62
+    /**
63
+     * 分页获取公告列表
64
+     * @param communityId
65
+     * @param title
66
+     * @param pageNum
67
+     * @param pageSize
68
+     * @return
69
+     */
50 70
     @Override
51
-    public void insertSocialView(TpSocialView tpSocialView) {
52
-
71
+    public List<TpAnnouncement> getAnnouncements(Integer communityId,String title, Integer pageNum, Integer pageSize) {
72
+        pageNum = null == pageNum ? 1 : pageNum;
73
+        pageSize = null == pageSize ? 10 : pageSize;
74
+        //使用分页插件
75
+        PageHelper.startPage(pageNum, pageSize);
76
+        // 获取数据
77
+        List<TpAnnouncement> announcementList = tpAnnouncementMapper.getAnnouncements(communityId,title);
78
+        return announcementList;
79
+    }
80
+    
81
+    /**
82
+     * 分页获取活动列表
83
+     * @param communityId
84
+     * @param title
85
+     * @param pageNum
86
+     * @param pageSize
87
+     * @return
88
+     */
89
+    @Override
90
+    public List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize) {
91
+        pageNum = null == pageNum ? 1 : pageNum;
92
+        pageSize = null == pageSize ? 10 : pageSize;
93
+        //使用分页插件
94
+        PageHelper.startPage(pageNum, pageSize);
95
+        // 获取数据
96
+        List<TpActivity> activityList = tpActivityMapper.getActivitys(communityId,title);
97
+        return activityList;
53 98
     }
54 99
 }

+ 23
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpAnnouncementMapper.xml 查看文件

@@ -7,6 +7,7 @@
7 7
     <result column="announcement_title" property="announcementTitle" jdbcType="VARCHAR" />
8 8
     <result column="announcement_carousel_img" property="announcementCarouselImg" jdbcType="VARCHAR" />
9 9
     <result column="announcement_content" property="announcementContent" jdbcType="VARCHAR" />
10
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
10 11
     <result column="sort" property="sort" jdbcType="INTEGER" />
11 12
     <result column="view_count" property="viewCount" jdbcType="INTEGER" />
12 13
     <result column="set_up_carousel" property="setUpCarousel" jdbcType="CHAR" />
@@ -153,4 +154,26 @@
153 154
       update_date = #{updateDate,jdbcType=TIMESTAMP}
154 155
     where id = #{id,jdbcType=INTEGER}
155 156
   </update>
157
+
158
+  <select id="getAnnouncements" resultMap="BaseResultMap">
159
+    SELECT
160
+      a.id,
161
+      a.announcement_title,
162
+      a.announcement_content,
163
+      a.create_date,
164
+      u.user_name as user_name,
165
+      a.sort,
166
+      a.view_count
167
+  FROM
168
+      tp_announcement a
169
+      LEFT JOIN tp_user u ON a.create_user = u.id
170
+      AND u.community_id = #{communityId,jdbcType=INTEGER}
171
+  WHERE
172
+      a.community_id = #{communityId,jdbcType=INTEGER}
173
+      AND ( a.STATUS = 1 OR a.STATUS = 3 )
174
+      and a.announcement_title like concat('%',#{title,jdbcType=VARCHAR},'%')
175
+  ORDER BY
176
+      a.sort,
177
+      a.create_date DESC
178
+  </select>
156 179
 </mapper>

+ 289
- 277
文档/MYSQL/smartCommunity.pdm
文件差异内容过多而无法显示
查看文件