魏超 6 jaren geleden
bovenliggende
commit
a1cd666744

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpAnnouncementMapper.java Bestand weergeven

@@ -15,7 +15,7 @@ public interface TpAnnouncementMapper {
15 15
 
16 16
     TpAnnouncement selectByPrimaryKey(@Param("id") Integer id, @Param("communityId") Integer communityId);
17 17
 
18
-    int updateByPrimaryKeySelective(TpAnnouncement record);
18
+    int updateByPrimaryKeySelective(@Param("id")Integer id, @Param("viewCount")Integer viewCount);
19 19
 
20 20
     int updateByPrimaryKey(TpAnnouncement record);
21 21
 }

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

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

+ 75
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpSocialView.java Bestand weergeven

@@ -0,0 +1,75 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TpSocialView {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private Integer uuid;
11
+
12
+    private String socialType;
13
+
14
+    private Integer taUserId;
15
+
16
+    private String remark;
17
+
18
+    private Date createDate;
19
+
20
+    public Integer getId() {
21
+        return id;
22
+    }
23
+
24
+    public void setId(Integer id) {
25
+        this.id = id;
26
+    }
27
+
28
+    public Integer getCommunityId() {
29
+        return communityId;
30
+    }
31
+
32
+    public void setCommunityId(Integer communityId) {
33
+        this.communityId = communityId;
34
+    }
35
+
36
+    public Integer getUuid() {
37
+        return uuid;
38
+    }
39
+
40
+    public void setUuid(Integer uuid) {
41
+        this.uuid = uuid;
42
+    }
43
+
44
+    public String getSocialType() {
45
+        return socialType;
46
+    }
47
+
48
+    public void setSocialType(String socialType) {
49
+        this.socialType = socialType == null ? null : socialType.trim();
50
+    }
51
+
52
+    public Integer getTaUserId() {
53
+        return taUserId;
54
+    }
55
+
56
+    public void setTaUserId(Integer taUserId) {
57
+        this.taUserId = taUserId;
58
+    }
59
+
60
+    public String getRemark() {
61
+        return remark;
62
+    }
63
+
64
+    public void setRemark(String remark) {
65
+        this.remark = remark == null ? null : remark.trim();
66
+    }
67
+
68
+    public Date getCreateDate() {
69
+        return createDate;
70
+    }
71
+
72
+    public void setCreateDate(Date createDate) {
73
+        this.createDate = createDate;
74
+    }
75
+}

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

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.service;
2 2
 
3 3
 import com.community.huiju.model.TpAnnouncement;
4
+import com.community.huiju.model.TpSocialView;
4 5
 
5 6
 /**
6 7
  * @author weichaochao
@@ -9,4 +10,5 @@ import com.community.huiju.model.TpAnnouncement;
9 10
  */
10 11
 public interface SocialServiceI {
11 12
     TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId);
13
+    void insertSocialView(TpSocialView tpSocialView);
12 14
 }

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

@@ -1,23 +1,54 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.community.commom.constant.Constant;
3 4
 import com.community.huiju.dao.TpAnnouncementMapper;
5
+import com.community.huiju.dao.TpSocialViewMapper;
4 6
 import com.community.huiju.model.TpAnnouncement;
7
+import com.community.huiju.model.TpSocialView;
5 8
 import com.community.huiju.service.SocialServiceI;
9
+import io.swagger.models.auth.In;
6 10
 import org.springframework.beans.factory.annotation.Autowired;
7 11
 import org.springframework.stereotype.Service;
12
+import org.springframework.transaction.annotation.Transactional;
13
+
14
+import java.util.Date;
8 15
 
9 16
 /**
10
- * @author admin
17
+ * @author weichaochao
11 18
  * @Title: SocialServiceImpl
12
- * @Description: TODO
13 19
  * @date 2018/10/23
14 20
  */
15 21
 @Service("SocialService")
16 22
 public class SocialServiceImpl implements SocialServiceI {
23
+
17 24
     @Autowired
18 25
     private TpAnnouncementMapper tpAnnouncementMapper;
26
+    @Autowired
27
+    private TpSocialViewMapper tpSocialViewMapper;
28
+
19 29
     @Override
30
+    @Transactional
20 31
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId) {
32
+        TpSocialView tpSocialView = new TpSocialView();
33
+        //TODO
34
+        tpSocialView.setTaUserId(1);
35
+        tpSocialView.setSocialType(Constant.ANNOUNCEMENT);
36
+        tpSocialView.setCommunityId(communityId);
37
+        tpSocialView.setUuid(id);
38
+        Integer viewNum = tpSocialViewMapper.selectViewNum(tpSocialView);
39
+
40
+        if (viewNum == 0){
41
+            tpSocialView.setCreateDate(new Date());
42
+            tpSocialViewMapper.insertSelective(tpSocialView);
43
+            tpSocialView.setTaUserId(null);
44
+            Integer allViewNum = tpSocialViewMapper.selectViewNum(tpSocialView);
45
+            tpAnnouncementMapper.updateByPrimaryKeySelective(id, allViewNum);
46
+        }
21 47
         return tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
22 48
     }
49
+
50
+    @Override
51
+    public void insertSocialView(TpSocialView tpSocialView) {
52
+
53
+    }
23 54
 }

+ 1
- 34
CODE/smart-community/app-api/src/main/resources/mapper/TpAnnouncementMapper.xml Bestand weergeven

@@ -128,45 +128,12 @@
128 128
       </if>
129 129
     </trim>
130 130
   </insert>
131
-  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpAnnouncement" >
131
+  <update id="updateByPrimaryKeySelective" >
132 132
     update tp_announcement
133 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 134
       <if test="viewCount != null" >
150 135
         view_count = #{viewCount,jdbcType=INTEGER},
151 136
       </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 137
     </set>
171 138
     where id = #{id,jdbcType=INTEGER}
172 139
   </update>

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

@@ -0,0 +1,128 @@
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="com.community.huiju.dao.TpSocialViewMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpSocialView" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="uuid" property="uuid" jdbcType="INTEGER" />
8
+    <result column="social_type" property="socialType" jdbcType="VARCHAR" />
9
+    <result column="ta_user_id" property="taUserId" jdbcType="INTEGER" />
10
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
11
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
12
+  </resultMap>
13
+  <sql id="Base_Column_List" >
14
+    id, community_id, uuid, social_type, ta_user_id, remark, create_date
15
+  </sql>
16
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
17
+    select 
18
+    <include refid="Base_Column_List" />
19
+    from tp_social_view
20
+    where id = #{id,jdbcType=INTEGER}
21
+  </select>
22
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
23
+    delete from tp_social_view
24
+    where id = #{id,jdbcType=INTEGER}
25
+  </delete>
26
+  <insert id="insert" parameterType="com.community.huiju.model.TpSocialView" >
27
+    insert into tp_social_view (id, community_id, uuid, 
28
+      social_type, ta_user_id, remark, 
29
+      create_date)
30
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{uuid,jdbcType=INTEGER}, 
31
+      #{socialType,jdbcType=VARCHAR}, #{taUserId,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, 
32
+      #{createDate,jdbcType=TIMESTAMP})
33
+  </insert>
34
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpSocialView" >
35
+    insert into tp_social_view
36
+    <trim prefix="(" suffix=")" suffixOverrides="," >
37
+      <if test="id != null" >
38
+        id,
39
+      </if>
40
+      <if test="communityId != null" >
41
+        community_id,
42
+      </if>
43
+      <if test="uuid != null" >
44
+        uuid,
45
+      </if>
46
+      <if test="socialType != null" >
47
+        social_type,
48
+      </if>
49
+      <if test="taUserId != null" >
50
+        ta_user_id,
51
+      </if>
52
+      <if test="remark != null" >
53
+        remark,
54
+      </if>
55
+      <if test="createDate != null" >
56
+        create_date,
57
+      </if>
58
+    </trim>
59
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
60
+      <if test="id != null" >
61
+        #{id,jdbcType=INTEGER},
62
+      </if>
63
+      <if test="communityId != null" >
64
+        #{communityId,jdbcType=INTEGER},
65
+      </if>
66
+      <if test="uuid != null" >
67
+        #{uuid,jdbcType=INTEGER},
68
+      </if>
69
+      <if test="socialType != null" >
70
+        #{socialType,jdbcType=VARCHAR},
71
+      </if>
72
+      <if test="taUserId != null" >
73
+        #{taUserId,jdbcType=INTEGER},
74
+      </if>
75
+      <if test="remark != null" >
76
+        #{remark,jdbcType=VARCHAR},
77
+      </if>
78
+      <if test="createDate != null" >
79
+        #{createDate,jdbcType=TIMESTAMP},
80
+      </if>
81
+    </trim>
82
+  </insert>
83
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpSocialView" >
84
+    update tp_social_view
85
+    <set >
86
+      <if test="communityId != null" >
87
+        community_id = #{communityId,jdbcType=INTEGER},
88
+      </if>
89
+      <if test="uuid != null" >
90
+        uuid = #{uuid,jdbcType=INTEGER},
91
+      </if>
92
+      <if test="socialType != null" >
93
+        social_type = #{socialType,jdbcType=VARCHAR},
94
+      </if>
95
+      <if test="taUserId != null" >
96
+        ta_user_id = #{taUserId,jdbcType=INTEGER},
97
+      </if>
98
+      <if test="remark != null" >
99
+        remark = #{remark,jdbcType=VARCHAR},
100
+      </if>
101
+      <if test="createDate != null" >
102
+        create_date = #{createDate,jdbcType=TIMESTAMP},
103
+      </if>
104
+    </set>
105
+    where id = #{id,jdbcType=INTEGER}
106
+  </update>
107
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpSocialView" >
108
+    update tp_social_view
109
+    set community_id = #{communityId,jdbcType=INTEGER},
110
+      uuid = #{uuid,jdbcType=INTEGER},
111
+      social_type = #{socialType,jdbcType=VARCHAR},
112
+      ta_user_id = #{taUserId,jdbcType=INTEGER},
113
+      remark = #{remark,jdbcType=VARCHAR},
114
+      create_date = #{createDate,jdbcType=TIMESTAMP}
115
+    where id = #{id,jdbcType=INTEGER}
116
+  </update>
117
+
118
+  <select id="selectViewNum" resultType="java.lang.Integer" parameterType="com.community.huiju.model.TpSocialView">
119
+    select count(*) from tp_social_view
120
+    where
121
+    <if test="taUserId != null" >
122
+      ta_user_id = #{taUserId} and
123
+    </if>
124
+    uuid = #{uuid}
125
+    and community_id = #{communityId}
126
+    and social_type = #{socialType}
127
+  </select>
128
+</mapper>

+ 9
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Bestand weergeven

@@ -29,4 +29,13 @@ public class Constant {
29 29
     
30 30
     /** 住户APP端待办 **/
31 31
     public static final Integer MODEL_TYPE_UPCOMING = 2;
32
+
33
+    /** 社交公告类型**/
34
+    public static final String ANNOUNCEMENT = "announcement";
35
+
36
+    /** 社交活动类型**/
37
+    public static final String ACTIVITY = "activity";
38
+
39
+    /** 社交二手租赁类型**/
40
+    public static final String LEASE = "lease";
32 41
 }

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class Bestand weergeven


BIN
文档/需求/app接口需求-第二版.xlsx Bestand weergeven