Browse Source

活动列表获取

傅行帆 6 years ago
parent
commit
effda06aa2

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

2
 
2
 
3
 import com.community.commom.constant.Constant;
3
 import com.community.commom.constant.Constant;
4
 import com.community.commom.mode.ResponseBean;
4
 import com.community.commom.mode.ResponseBean;
5
+import com.community.huiju.model.TpActivity;
5
 import com.community.huiju.model.TpAnnouncement;
6
 import com.community.huiju.model.TpAnnouncement;
6
 import com.community.huiju.model.TpMessage;
7
 import com.community.huiju.model.TpMessage;
7
 import com.community.huiju.service.SocialServiceI;
8
 import com.community.huiju.service.SocialServiceI;
59
         responseBean.addSuccess(announcementList);
60
         responseBean.addSuccess(announcementList);
60
         return responseBean;
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 View File

3
 
3
 
4
 import com.community.huiju.model.TpActivity;
4
 import com.community.huiju.model.TpActivity;
5
 import org.apache.ibatis.annotations.Mapper;
5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
6
 
9
 
7
 @Mapper
10
 @Mapper
8
 public interface TpActivityMapper {
11
 public interface TpActivityMapper {
17
     int updateByPrimaryKeySelective(TpActivity record);
20
     int updateByPrimaryKeySelective(TpActivity record);
18
 
21
 
19
     int updateByPrimaryKey(TpActivity record);
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 View File

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

+ 2
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java View File

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

+ 10
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpActivity.java View File

38
     private Integer updateUser;
38
     private Integer updateUser;
39
 
39
 
40
     private Date updateDate;
40
     private Date updateDate;
41
+    
42
+    private String userName;
41
 
43
 
42
     public Integer getId() {
44
     public Integer getId() {
43
         return id;
45
         return id;
182
     public void setUpdateDate(Date updateDate) {
184
     public void setUpdateDate(Date updateDate) {
183
         this.updateDate = updateDate;
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 View File

1
 package com.community.huiju.service;
1
 package com.community.huiju.service;
2
 
2
 
3
+import com.community.huiju.model.TpActivity;
3
 import com.community.huiju.model.TpAnnouncement;
4
 import com.community.huiju.model.TpAnnouncement;
4
 import com.community.huiju.model.TpMessage;
5
 import com.community.huiju.model.TpMessage;
5
 
6
 
16
 	/**
17
 	/**
17
 	 * 分页获取公告列表
18
 	 * 分页获取公告列表
18
 	 * @param communityId
19
 	 * @param communityId
20
+	 * @param title
19
 	 * @param pageNum
21
 	 * @param pageNum
20
 	 * @param pageSize
22
 	 * @param pageSize
21
 	 * @return
23
 	 * @return
22
 	 */
24
 	 */
23
 	List<TpAnnouncement> getAnnouncements(Integer communityId, String title, Integer pageNum, Integer pageSize);
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 View File

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

+ 26
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java View File

1
 package com.community.huiju.service.impl;
1
 package com.community.huiju.service.impl;
2
 
2
 
3
+import com.community.huiju.dao.TpActivityMapper;
3
 import com.community.huiju.dao.TpAnnouncementMapper;
4
 import com.community.huiju.dao.TpAnnouncementMapper;
5
+import com.community.huiju.model.TpActivity;
4
 import com.community.huiju.model.TpAnnouncement;
6
 import com.community.huiju.model.TpAnnouncement;
5
 import com.community.huiju.model.TpMessage;
7
 import com.community.huiju.model.TpMessage;
6
 import com.community.huiju.service.SocialServiceI;
8
 import com.community.huiju.service.SocialServiceI;
20
 public class SocialServiceImpl implements SocialServiceI {
22
 public class SocialServiceImpl implements SocialServiceI {
21
     @Autowired
23
     @Autowired
22
     private TpAnnouncementMapper tpAnnouncementMapper;
24
     private TpAnnouncementMapper tpAnnouncementMapper;
25
+    
26
+    @Autowired
27
+    private TpActivityMapper tpActivityMapper;
28
+    
23
     @Override
29
     @Override
24
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId) {
30
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId) {
25
         return tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
31
         return tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
28
     /**
34
     /**
29
      * 分页获取公告列表
35
      * 分页获取公告列表
30
      * @param communityId
36
      * @param communityId
37
+     * @param title
31
      * @param pageNum
38
      * @param pageNum
32
      * @param pageSize
39
      * @param pageSize
33
      * @return
40
      * @return
42
         List<TpAnnouncement> announcementList = tpAnnouncementMapper.getAnnouncements(communityId,title);
49
         List<TpAnnouncement> announcementList = tpAnnouncementMapper.getAnnouncements(communityId,title);
43
         return announcementList;
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 View File

7
     <result column="activity_title" property="activityTitle" jdbcType="VARCHAR" />
7
     <result column="activity_title" property="activityTitle" jdbcType="VARCHAR" />
8
     <result column="activity_carousel_img" property="activityCarouselImg" jdbcType="VARCHAR" />
8
     <result column="activity_carousel_img" property="activityCarouselImg" jdbcType="VARCHAR" />
9
     <result column="activity_content" property="activityContent" jdbcType="VARCHAR" />
9
     <result column="activity_content" property="activityContent" jdbcType="VARCHAR" />
10
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
10
     <result column="sort" property="sort" jdbcType="INTEGER" />
11
     <result column="sort" property="sort" jdbcType="INTEGER" />
11
     <result column="sign_up_count" property="signUpCount" jdbcType="INTEGER" />
12
     <result column="sign_up_count" property="signUpCount" jdbcType="INTEGER" />
12
     <result column="sign_up_max" property="signUpMax" jdbcType="INTEGER" />
13
     <result column="sign_up_max" property="signUpMax" jdbcType="INTEGER" />
246
       update_date = #{updateDate,jdbcType=TIMESTAMP}
247
       update_date = #{updateDate,jdbcType=TIMESTAMP}
247
     where id = #{id,jdbcType=INTEGER}
248
     where id = #{id,jdbcType=INTEGER}
248
   </update>
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
 </mapper>
273
 </mapper>

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpAnnouncementMapper.xml View File

204
   WHERE
204
   WHERE
205
       a.community_id = #{communityId,jdbcType=INTEGER}
205
       a.community_id = #{communityId,jdbcType=INTEGER}
206
       AND ( a.STATUS = 1 OR a.STATUS = 3 )
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
   ORDER BY
208
   ORDER BY
209
       a.sort,
209
       a.sort,
210
       a.create_date DESC
210
       a.create_date DESC

BIN
文档/需求/app接口需求-第二版.xlsx View File