Procházet zdrojové kódy

weichao 社交相关api

魏超 před 6 roky
rodič
revize
c3f235a1e9

+ 7
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BannerController.java Zobrazit soubor

@@ -4,10 +4,13 @@ import com.community.commom.mode.ResponseBean;
4 4
 import com.community.huiju.model.ToBanner;
5 5
 import com.community.huiju.service.BannerServiceI;
6 6
 import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
7 9
 import io.swagger.annotations.ApiOperation;
8 10
 import org.springframework.beans.factory.annotation.Autowired;
9 11
 import org.springframework.cloud.context.config.annotation.RefreshScope;
10 12
 import org.springframework.util.CollectionUtils;
13
+import org.springframework.web.bind.annotation.PathVariable;
11 14
 import org.springframework.web.bind.annotation.RequestMapping;
12 15
 import org.springframework.web.bind.annotation.RequestMethod;
13 16
 import org.springframework.web.bind.annotation.RestController;
@@ -30,10 +33,11 @@ public class BannerController {
30 33
     private BannerServiceI bannerService;
31 34
 
32 35
     @ApiOperation(value = "首页运营banner接口", notes = "获取首页运营banner")
33
-    @RequestMapping(value = "/banners", method = RequestMethod.GET)
34
-    public ResponseBean selectToBannerImg(){
36
+    @RequestMapping(value = "/banner/{bannerId}", method = RequestMethod.GET)
37
+    @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "Long", name = "bannerId", value = "运营banner图Id") })
38
+    public ResponseBean selectToBannerImg(@PathVariable("bannerId")Integer bannerId){
35 39
         ResponseBean responseBean = new ResponseBean();
36
-        List<ToBanner> toBannerList = bannerService.viewBannerImg();
40
+        ToBanner toBannerList = bannerService.viewBannerImg(bannerId);
37 41
         responseBean.addSuccess(toBannerList);
38 42
         return responseBean;
39 43
     }

+ 37
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Zobrazit soubor

@@ -0,0 +1,37 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.model.TpAnnouncement;
5
+import com.community.huiju.service.SocialServiceI;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiImplicitParam;
8
+import io.swagger.annotations.ApiImplicitParams;
9
+import io.swagger.annotations.ApiOperation;
10
+import org.springframework.beans.factory.annotation.Autowired;
11
+import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.*;
13
+
14
+/**
15
+ * @author weichaochao
16
+ * @Title: SocialController
17
+ * @date 2018/10/23
18
+ */
19
+@RestController
20
+@RefreshScope
21
+@RequestMapping("/")
22
+@Api("app端论坛相关的API")
23
+public class SocialController {
24
+
25
+    @Autowired
26
+    private SocialServiceI socialServiceI;
27
+
28
+    @RequestMapping(value = "/announcement/{communityId}", method = RequestMethod.GET)
29
+    @ApiOperation(value = "论坛公告帖子详情", notes = "获取论坛公告帖子详情")
30
+    @ApiImplicitParams({ @ApiImplicitParam(paramType = "query", dataType = "Long", name = "communityId", value = "小区Id") })
31
+    public ResponseBean findAnnouncementDetail(@PathVariable(value = "communityId")Integer communityId, @RequestParam("id") Integer id){
32
+        ResponseBean responseBean = new ResponseBean();
33
+        TpAnnouncement tpAnnouncement = socialServiceI.findAnnouncementDetail(id, communityId);
34
+        responseBean.addSuccess(tpAnnouncement);
35
+        return responseBean;
36
+    }
37
+}

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/ToBannerMapper.java Zobrazit soubor

@@ -2,12 +2,13 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.ToBanner;
4 4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
5 6
 
6 7
 import java.util.List;
7 8
 
8 9
 @Mapper
9 10
 public interface ToBannerMapper {
10 11
 
11
-    List<ToBanner> selectByCommunityId(String nowTime);
12
+    ToBanner selectByCommunityId(@Param("bannerId") Integer bannerId, @Param("nowTime") String nowTime);
12 13
 
13 14
 }

+ 20
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpAnnouncementMapper.java Zobrazit soubor

@@ -0,0 +1,20 @@
1
+package com.community.huiju.dao;
2
+
3
+
4
+import com.community.huiju.model.TpAnnouncement;
5
+import org.apache.ibatis.annotations.Mapper;
6
+
7
+@Mapper
8
+public interface TpAnnouncementMapper {
9
+    int deleteByPrimaryKey(Integer id);
10
+
11
+    int insert(TpAnnouncement record);
12
+
13
+    int insertSelective(TpAnnouncement record);
14
+
15
+    TpAnnouncement selectByPrimaryKey(Integer id, Integer communityId);
16
+
17
+    int updateByPrimaryKeySelective(TpAnnouncement record);
18
+
19
+    int updateByPrimaryKey(TpAnnouncement record);
20
+}

+ 135
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpAnnouncement.java Zobrazit soubor

@@ -0,0 +1,135 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TpAnnouncement {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private String announcementTitle;
11
+
12
+    private String announcementCarouselImg;
13
+
14
+    private String announcementContent;
15
+
16
+    private Integer sort;
17
+
18
+    private Integer viewCount;
19
+
20
+    private String setUpCarousel;
21
+
22
+    private String status;
23
+
24
+    private Integer createUser;
25
+
26
+    private Date createDate;
27
+
28
+    private Integer updateUser;
29
+
30
+    private Date updateDate;
31
+
32
+    public Integer getId() {
33
+        return id;
34
+    }
35
+
36
+    public void setId(Integer id) {
37
+        this.id = id;
38
+    }
39
+
40
+    public Integer getCommunityId() {
41
+        return communityId;
42
+    }
43
+
44
+    public void setCommunityId(Integer communityId) {
45
+        this.communityId = communityId;
46
+    }
47
+
48
+    public String getAnnouncementTitle() {
49
+        return announcementTitle;
50
+    }
51
+
52
+    public void setAnnouncementTitle(String announcementTitle) {
53
+        this.announcementTitle = announcementTitle == null ? null : announcementTitle.trim();
54
+    }
55
+
56
+    public String getAnnouncementCarouselImg() {
57
+        return announcementCarouselImg;
58
+    }
59
+
60
+    public void setAnnouncementCarouselImg(String announcementCarouselImg) {
61
+        this.announcementCarouselImg = announcementCarouselImg == null ? null : announcementCarouselImg.trim();
62
+    }
63
+
64
+    public String getAnnouncementContent() {
65
+        return announcementContent;
66
+    }
67
+
68
+    public void setAnnouncementContent(String announcementContent) {
69
+        this.announcementContent = announcementContent == null ? null : announcementContent.trim();
70
+    }
71
+
72
+    public Integer getSort() {
73
+        return sort;
74
+    }
75
+
76
+    public void setSort(Integer sort) {
77
+        this.sort = sort;
78
+    }
79
+
80
+    public Integer getViewCount() {
81
+        return viewCount;
82
+    }
83
+
84
+    public void setViewCount(Integer viewCount) {
85
+        this.viewCount = viewCount;
86
+    }
87
+
88
+    public String getSetUpCarousel() {
89
+        return setUpCarousel;
90
+    }
91
+
92
+    public void setSetUpCarousel(String setUpCarousel) {
93
+        this.setUpCarousel = setUpCarousel == null ? null : setUpCarousel.trim();
94
+    }
95
+
96
+    public String getStatus() {
97
+        return status;
98
+    }
99
+
100
+    public void setStatus(String status) {
101
+        this.status = status == null ? null : status.trim();
102
+    }
103
+
104
+    public Integer getCreateUser() {
105
+        return createUser;
106
+    }
107
+
108
+    public void setCreateUser(Integer createUser) {
109
+        this.createUser = createUser;
110
+    }
111
+
112
+    public Date getCreateDate() {
113
+        return createDate;
114
+    }
115
+
116
+    public void setCreateDate(Date createDate) {
117
+        this.createDate = createDate;
118
+    }
119
+
120
+    public Integer getUpdateUser() {
121
+        return updateUser;
122
+    }
123
+
124
+    public void setUpdateUser(Integer updateUser) {
125
+        this.updateUser = updateUser;
126
+    }
127
+
128
+    public Date getUpdateDate() {
129
+        return updateDate;
130
+    }
131
+
132
+    public void setUpdateDate(Date updateDate) {
133
+        this.updateDate = updateDate;
134
+    }
135
+}

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/BannerServiceI.java Zobrazit soubor

@@ -11,6 +11,6 @@ import java.util.List;
11 11
  */
12 12
 public interface BannerServiceI {
13 13
 
14
-    List<ToBanner> viewBannerImg();
14
+    ToBanner viewBannerImg(Integer bannerId);
15 15
 
16 16
 }

+ 12
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Zobrazit soubor

@@ -0,0 +1,12 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.huiju.model.TpAnnouncement;
4
+
5
+/**
6
+ * @author weichaochao
7
+ * @Title: SocialServiceI
8
+ * @date 2018/10/23
9
+ */
10
+public interface SocialServiceI {
11
+    TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId);
12
+}

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BannerServiceImpl.java Zobrazit soubor

@@ -21,8 +21,8 @@ public class BannerServiceImpl implements BannerServiceI {
21 21
     private ToBannerMapper toBannerMapper;
22 22
 
23 23
     @Override
24
-    public List<ToBanner> viewBannerImg() {
24
+    public ToBanner viewBannerImg(Integer bannerId) {
25 25
         String nowTime = DateUtils.getDate("yyyy-MM-dd");
26
-        return toBannerMapper.selectByCommunityId(nowTime);
26
+        return toBannerMapper.selectByCommunityId(bannerId, nowTime);
27 27
     }
28 28
 }

+ 23
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Zobrazit soubor

@@ -0,0 +1,23 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.huiju.dao.TpAnnouncementMapper;
4
+import com.community.huiju.model.TpAnnouncement;
5
+import com.community.huiju.service.SocialServiceI;
6
+import org.springframework.beans.factory.annotation.Autowired;
7
+import org.springframework.stereotype.Service;
8
+
9
+/**
10
+ * @author admin
11
+ * @Title: SocialServiceImpl
12
+ * @Description: TODO
13
+ * @date 2018/10/23
14
+ */
15
+@Service("SocialService")
16
+public class SocialServiceImpl implements SocialServiceI {
17
+    @Autowired
18
+    private TpAnnouncementMapper tpAnnouncementMapper;
19
+    @Override
20
+    public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId) {
21
+        return tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
22
+    }
23
+}

+ 2
- 2
CODE/smart-community/app-api/src/main/resources/mapper/ToBannerMapper.xml Zobrazit soubor

@@ -21,9 +21,9 @@
21 21
     id, community_id, banner_description, sort, banner_cover, banner_position, eff_time, 
22 22
     exp_time, banner_type, external_link, banner_title, banner_content, create_user, create_date
23 23
   </sql>
24
-  <select id="selectByCommunityId" resultMap="BaseResultMap" parameterType="java.lang.String">
24
+  <select id="selectByCommunityId" resultMap="BaseResultMap">
25 25
     select
26 26
     <include refid="Base_Column_List"></include>
27
-    from to_banner t where t.eff_time &lt; #{nowTime} and t.exp_time &gt; #{nowTime} order by t.sort, t.eff_time
27
+    from to_banner t where id = #{bannerId} and t.eff_time &lt; #{nowTime} and t.exp_time &gt; #{nowTime} order by t.sort, t.eff_time
28 28
   </select>
29 29
 </mapper>

+ 189
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpAnnouncementMapper.xml Zobrazit soubor

@@ -0,0 +1,189 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="dao.TpAnnouncementMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpAnnouncement" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="announcement_title" property="announcementTitle" jdbcType="VARCHAR" />
8
+    <result column="announcement_carousel_img" property="announcementCarouselImg" jdbcType="VARCHAR" />
9
+    <result column="announcement_content" property="announcementContent" jdbcType="VARCHAR" />
10
+    <result column="sort" property="sort" jdbcType="INTEGER" />
11
+    <result column="view_count" property="viewCount" jdbcType="INTEGER" />
12
+    <result column="set_up_carousel" property="setUpCarousel" jdbcType="CHAR" />
13
+    <result column="status" property="status" jdbcType="CHAR" />
14
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
15
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
16
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
17
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
18
+  </resultMap>
19
+  <sql id="Base_Column_List" >
20
+    id, community_id, announcement_title, announcement_carousel_img, announcement_content, 
21
+    sort, view_count, set_up_carousel, status, create_user, create_date, update_user, 
22
+    update_date
23
+  </sql>
24
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
25
+    select 
26
+    <include refid="Base_Column_List" />
27
+    from tp_announcement
28
+    where id = #{id,jdbcType=INTEGER} and community_id = #{communityId,jdbcType=INTEGER}
29
+  </select>
30
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
31
+    delete from tp_announcement
32
+    where id = #{id,jdbcType=INTEGER}
33
+  </delete>
34
+  <insert id="insert" parameterType="com.community.huiju.model.TpAnnouncement" >
35
+    insert into tp_announcement (id, community_id, announcement_title, 
36
+      announcement_carousel_img, announcement_content, 
37
+      sort, view_count, set_up_carousel, 
38
+      status, create_user, create_date, 
39
+      update_user, update_date)
40
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{announcementTitle,jdbcType=VARCHAR}, 
41
+      #{announcementCarouselImg,jdbcType=VARCHAR}, #{announcementContent,jdbcType=VARCHAR}, 
42
+      #{sort,jdbcType=INTEGER}, #{viewCount,jdbcType=INTEGER}, #{setUpCarousel,jdbcType=CHAR}, 
43
+      #{status,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
44
+      #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
45
+  </insert>
46
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpAnnouncement" >
47
+    insert into tp_announcement
48
+    <trim prefix="(" suffix=")" suffixOverrides="," >
49
+      <if test="id != null" >
50
+        id,
51
+      </if>
52
+      <if test="communityId != null" >
53
+        community_id,
54
+      </if>
55
+      <if test="announcementTitle != null" >
56
+        announcement_title,
57
+      </if>
58
+      <if test="announcementCarouselImg != null" >
59
+        announcement_carousel_img,
60
+      </if>
61
+      <if test="announcementContent != null" >
62
+        announcement_content,
63
+      </if>
64
+      <if test="sort != null" >
65
+        sort,
66
+      </if>
67
+      <if test="viewCount != null" >
68
+        view_count,
69
+      </if>
70
+      <if test="setUpCarousel != null" >
71
+        set_up_carousel,
72
+      </if>
73
+      <if test="status != null" >
74
+        status,
75
+      </if>
76
+      <if test="createUser != null" >
77
+        create_user,
78
+      </if>
79
+      <if test="createDate != null" >
80
+        create_date,
81
+      </if>
82
+      <if test="updateUser != null" >
83
+        update_user,
84
+      </if>
85
+      <if test="updateDate != null" >
86
+        update_date,
87
+      </if>
88
+    </trim>
89
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
90
+      <if test="id != null" >
91
+        #{id,jdbcType=INTEGER},
92
+      </if>
93
+      <if test="communityId != null" >
94
+        #{communityId,jdbcType=INTEGER},
95
+      </if>
96
+      <if test="announcementTitle != null" >
97
+        #{announcementTitle,jdbcType=VARCHAR},
98
+      </if>
99
+      <if test="announcementCarouselImg != null" >
100
+        #{announcementCarouselImg,jdbcType=VARCHAR},
101
+      </if>
102
+      <if test="announcementContent != null" >
103
+        #{announcementContent,jdbcType=VARCHAR},
104
+      </if>
105
+      <if test="sort != null" >
106
+        #{sort,jdbcType=INTEGER},
107
+      </if>
108
+      <if test="viewCount != null" >
109
+        #{viewCount,jdbcType=INTEGER},
110
+      </if>
111
+      <if test="setUpCarousel != null" >
112
+        #{setUpCarousel,jdbcType=CHAR},
113
+      </if>
114
+      <if test="status != null" >
115
+        #{status,jdbcType=CHAR},
116
+      </if>
117
+      <if test="createUser != null" >
118
+        #{createUser,jdbcType=INTEGER},
119
+      </if>
120
+      <if test="createDate != null" >
121
+        #{createDate,jdbcType=TIMESTAMP},
122
+      </if>
123
+      <if test="updateUser != null" >
124
+        #{updateUser,jdbcType=INTEGER},
125
+      </if>
126
+      <if test="updateDate != null" >
127
+        #{updateDate,jdbcType=TIMESTAMP},
128
+      </if>
129
+    </trim>
130
+  </insert>
131
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpAnnouncement" >
132
+    update tp_announcement
133
+    <set >
134
+      <if test="communityId != null" >
135
+        community_id = #{communityId,jdbcType=INTEGER},
136
+      </if>
137
+      <if test="announcementTitle != null" >
138
+        announcement_title = #{announcementTitle,jdbcType=VARCHAR},
139
+      </if>
140
+      <if test="announcementCarouselImg != null" >
141
+        announcement_carousel_img = #{announcementCarouselImg,jdbcType=VARCHAR},
142
+      </if>
143
+      <if test="announcementContent != null" >
144
+        announcement_content = #{announcementContent,jdbcType=VARCHAR},
145
+      </if>
146
+      <if test="sort != null" >
147
+        sort = #{sort,jdbcType=INTEGER},
148
+      </if>
149
+      <if test="viewCount != null" >
150
+        view_count = #{viewCount,jdbcType=INTEGER},
151
+      </if>
152
+      <if test="setUpCarousel != null" >
153
+        set_up_carousel = #{setUpCarousel,jdbcType=CHAR},
154
+      </if>
155
+      <if test="status != null" >
156
+        status = #{status,jdbcType=CHAR},
157
+      </if>
158
+      <if test="createUser != null" >
159
+        create_user = #{createUser,jdbcType=INTEGER},
160
+      </if>
161
+      <if test="createDate != null" >
162
+        create_date = #{createDate,jdbcType=TIMESTAMP},
163
+      </if>
164
+      <if test="updateUser != null" >
165
+        update_user = #{updateUser,jdbcType=INTEGER},
166
+      </if>
167
+      <if test="updateDate != null" >
168
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
169
+      </if>
170
+    </set>
171
+    where id = #{id,jdbcType=INTEGER}
172
+  </update>
173
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpAnnouncement" >
174
+    update tp_announcement
175
+    set community_id = #{communityId,jdbcType=INTEGER},
176
+      announcement_title = #{announcementTitle,jdbcType=VARCHAR},
177
+      announcement_carousel_img = #{announcementCarouselImg,jdbcType=VARCHAR},
178
+      announcement_content = #{announcementContent,jdbcType=VARCHAR},
179
+      sort = #{sort,jdbcType=INTEGER},
180
+      view_count = #{viewCount,jdbcType=INTEGER},
181
+      set_up_carousel = #{setUpCarousel,jdbcType=CHAR},
182
+      status = #{status,jdbcType=CHAR},
183
+      create_user = #{createUser,jdbcType=INTEGER},
184
+      create_date = #{createDate,jdbcType=TIMESTAMP},
185
+      update_user = #{updateUser,jdbcType=INTEGER},
186
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
187
+    where id = #{id,jdbcType=INTEGER}
188
+  </update>
189
+</mapper>