傅行帆 vor 6 Jahren
Ursprung
Commit
e019ee69ab

+ 24
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MessageController.java Datei anzeigen

@@ -1,10 +1,22 @@
1 1
 package com.community.huiju.controller;
2 2
 
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.model.ToCommunities;
5
+import com.community.huiju.service.MessageServiceI;
3 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;
4 11
 import org.springframework.cloud.context.config.annotation.RefreshScope;
5 12
 import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RequestParam;
6 15
 import org.springframework.web.bind.annotation.RestController;
7 16
 
17
+import java.util.List;
18
+import java.util.Map;
19
+
8 20
 /**
9 21
  * @author FXF
10 22
  * @date 2018-10-22
@@ -14,5 +26,16 @@ import org.springframework.web.bind.annotation.RestController;
14 26
 @RequestMapping("/")
15 27
 @Api("app端消息相关的API")
16 28
 public class MessageController {
17
-
29
+	
30
+	@Autowired
31
+	private MessageServiceI messageService;
32
+	
33
+	@ApiOperation(value = "根据小区名获取小区列表", notes = "根据小区名获取小区列表")
34
+	@RequestMapping(value = "/message/total",method = RequestMethod.GET)
35
+	public ResponseBean getMessageTotal(){
36
+		ResponseBean responseBean = new ResponseBean();
37
+		Map<String,Object> totalMap = messageService.getMessageTotal();
38
+		responseBean.addSuccess(totalMap);
39
+		return responseBean;
40
+	}
18 41
 }

+ 24
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpMessageMapper.java Datei anzeigen

@@ -0,0 +1,24 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TpMessage;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.Map;
8
+
9
+@Mapper
10
+public interface TpMessageMapper {
11
+    int deleteByPrimaryKey(Integer id);
12
+
13
+    int insert(TpMessage record);
14
+
15
+    int insertSelective(TpMessage record);
16
+
17
+    TpMessage selectByPrimaryKey(Integer id);
18
+
19
+    int updateByPrimaryKeySelective(TpMessage record);
20
+
21
+    int updateByPrimaryKey(TpMessage record);
22
+    
23
+    Map<String, Object> getMessageTotal(@Param(value="userId") Integer userId);
24
+}

+ 175
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpMessage.java Datei anzeigen

@@ -0,0 +1,175 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TpMessage {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private String messageType;
11
+
12
+    private String adviceType;
13
+
14
+    private String modelType;
15
+
16
+    private Integer uuid;
17
+
18
+    private String uuidType;
19
+
20
+    private String source;
21
+
22
+    private String messageContent;
23
+
24
+    private String status;
25
+
26
+    private String result;
27
+
28
+    private String meaasgeTypeId;
29
+
30
+    private String readStatus;
31
+
32
+    private Integer createUser;
33
+
34
+    private Date createDate;
35
+
36
+    private Integer updateUser;
37
+
38
+    private Date updateDate;
39
+
40
+    public Integer getId() {
41
+        return id;
42
+    }
43
+
44
+    public void setId(Integer id) {
45
+        this.id = id;
46
+    }
47
+
48
+    public Integer getCommunityId() {
49
+        return communityId;
50
+    }
51
+
52
+    public void setCommunityId(Integer communityId) {
53
+        this.communityId = communityId;
54
+    }
55
+
56
+    public String getMessageType() {
57
+        return messageType;
58
+    }
59
+
60
+    public void setMessageType(String messageType) {
61
+        this.messageType = messageType == null ? null : messageType.trim();
62
+    }
63
+
64
+    public String getAdviceType() {
65
+        return adviceType;
66
+    }
67
+
68
+    public void setAdviceType(String adviceType) {
69
+        this.adviceType = adviceType == null ? null : adviceType.trim();
70
+    }
71
+
72
+    public String getModelType() {
73
+        return modelType;
74
+    }
75
+
76
+    public void setModelType(String modelType) {
77
+        this.modelType = modelType == null ? null : modelType.trim();
78
+    }
79
+
80
+    public Integer getUuid() {
81
+        return uuid;
82
+    }
83
+
84
+    public void setUuid(Integer uuid) {
85
+        this.uuid = uuid;
86
+    }
87
+
88
+    public String getUuidType() {
89
+        return uuidType;
90
+    }
91
+
92
+    public void setUuidType(String uuidType) {
93
+        this.uuidType = uuidType == null ? null : uuidType.trim();
94
+    }
95
+
96
+    public String getSource() {
97
+        return source;
98
+    }
99
+
100
+    public void setSource(String source) {
101
+        this.source = source == null ? null : source.trim();
102
+    }
103
+
104
+    public String getMessageContent() {
105
+        return messageContent;
106
+    }
107
+
108
+    public void setMessageContent(String messageContent) {
109
+        this.messageContent = messageContent == null ? null : messageContent.trim();
110
+    }
111
+
112
+    public String getStatus() {
113
+        return status;
114
+    }
115
+
116
+    public void setStatus(String status) {
117
+        this.status = status == null ? null : status.trim();
118
+    }
119
+
120
+    public String getResult() {
121
+        return result;
122
+    }
123
+
124
+    public void setResult(String result) {
125
+        this.result = result == null ? null : result.trim();
126
+    }
127
+
128
+    public String getMeaasgeTypeId() {
129
+        return meaasgeTypeId;
130
+    }
131
+
132
+    public void setMeaasgeTypeId(String meaasgeTypeId) {
133
+        this.meaasgeTypeId = meaasgeTypeId == null ? null : meaasgeTypeId.trim();
134
+    }
135
+
136
+    public String getReadStatus() {
137
+        return readStatus;
138
+    }
139
+
140
+    public void setReadStatus(String readStatus) {
141
+        this.readStatus = readStatus == null ? null : readStatus.trim();
142
+    }
143
+
144
+    public Integer getCreateUser() {
145
+        return createUser;
146
+    }
147
+
148
+    public void setCreateUser(Integer createUser) {
149
+        this.createUser = createUser;
150
+    }
151
+
152
+    public Date getCreateDate() {
153
+        return createDate;
154
+    }
155
+
156
+    public void setCreateDate(Date createDate) {
157
+        this.createDate = createDate;
158
+    }
159
+
160
+    public Integer getUpdateUser() {
161
+        return updateUser;
162
+    }
163
+
164
+    public void setUpdateUser(Integer updateUser) {
165
+        this.updateUser = updateUser;
166
+    }
167
+
168
+    public Date getUpdateDate() {
169
+        return updateDate;
170
+    }
171
+
172
+    public void setUpdateDate(Date updateDate) {
173
+        this.updateDate = updateDate;
174
+    }
175
+}

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MessageServiceI.java Datei anzeigen

@@ -0,0 +1,7 @@
1
+package com.community.huiju.service;
2
+
3
+import java.util.Map;
4
+
5
+public interface MessageServiceI {
6
+	Map<String, Object> getMessageTotal();
7
+}

+ 25
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MessageServiceImpl.java Datei anzeigen

@@ -0,0 +1,25 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.huiju.dao.TpMessageMapper;
4
+import com.community.huiju.service.MessageServiceI;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.stereotype.Service;
7
+
8
+import java.util.Map;
9
+
10
+/**
11
+ * @author FXF
12
+ * @date 2018-10-22
13
+ */
14
+@Service("messageService")
15
+public class MessageServiceImpl implements MessageServiceI {
16
+	
17
+	@Autowired
18
+	private TpMessageMapper tpMessageMapper;
19
+	
20
+	@Override
21
+	public Map<String, Object> getMessageTotal() {
22
+		Integer userId = 1;
23
+		return tpMessageMapper.getMessageTotal(userId);
24
+	}
25
+}

+ 248
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml Datei anzeigen

@@ -0,0 +1,248 @@
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.TpMessageMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpMessage" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="message_type" property="messageType" jdbcType="CHAR" />
8
+    <result column="advice_type" property="adviceType" jdbcType="CHAR" />
9
+    <result column="model_type" property="modelType" jdbcType="CHAR" />
10
+    <result column="uuid" property="uuid" jdbcType="INTEGER" />
11
+    <result column="uuid_type" property="uuidType" jdbcType="CHAR" />
12
+    <result column="source" property="source" jdbcType="CHAR" />
13
+    <result column="message_content" property="messageContent" jdbcType="VARCHAR" />
14
+    <result column="status" property="status" jdbcType="CHAR" />
15
+    <result column="result" property="result" jdbcType="VARCHAR" />
16
+    <result column="meaasge_type_id" property="meaasgeTypeId" jdbcType="VARCHAR" />
17
+    <result column="read_status" property="readStatus" jdbcType="CHAR" />
18
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
19
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
20
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
21
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
22
+  </resultMap>
23
+  <sql id="Base_Column_List" >
24
+    id, community_id, message_type, advice_type, model_type, uuid, uuid_type, source, 
25
+    message_content, status, result, meaasge_type_id, read_status, create_user, create_date, 
26
+    update_user, update_date
27
+  </sql>
28
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
29
+    select 
30
+    <include refid="Base_Column_List" />
31
+    from tp_message
32
+    where id = #{id,jdbcType=INTEGER}
33
+  </select>
34
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
35
+    delete from tp_message
36
+    where id = #{id,jdbcType=INTEGER}
37
+  </delete>
38
+  <insert id="insert" parameterType="com.community.huiju.model.TpMessage" >
39
+    insert into tp_message (id, community_id, message_type, 
40
+      advice_type, model_type, uuid, 
41
+      uuid_type, source, message_content, 
42
+      status, result, meaasge_type_id, 
43
+      read_status, create_user, create_date, 
44
+      update_user, update_date)
45
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{messageType,jdbcType=CHAR}, 
46
+      #{adviceType,jdbcType=CHAR}, #{modelType,jdbcType=CHAR}, #{uuid,jdbcType=INTEGER}, 
47
+      #{uuidType,jdbcType=CHAR}, #{source,jdbcType=CHAR}, #{messageContent,jdbcType=VARCHAR}, 
48
+      #{status,jdbcType=CHAR}, #{result,jdbcType=VARCHAR}, #{meaasgeTypeId,jdbcType=VARCHAR}, 
49
+      #{readStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
50
+      #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
51
+  </insert>
52
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpMessage" >
53
+    insert into tp_message
54
+    <trim prefix="(" suffix=")" suffixOverrides="," >
55
+      <if test="id != null" >
56
+        id,
57
+      </if>
58
+      <if test="communityId != null" >
59
+        community_id,
60
+      </if>
61
+      <if test="messageType != null" >
62
+        message_type,
63
+      </if>
64
+      <if test="adviceType != null" >
65
+        advice_type,
66
+      </if>
67
+      <if test="modelType != null" >
68
+        model_type,
69
+      </if>
70
+      <if test="uuid != null" >
71
+        uuid,
72
+      </if>
73
+      <if test="uuidType != null" >
74
+        uuid_type,
75
+      </if>
76
+      <if test="source != null" >
77
+        source,
78
+      </if>
79
+      <if test="messageContent != null" >
80
+        message_content,
81
+      </if>
82
+      <if test="status != null" >
83
+        status,
84
+      </if>
85
+      <if test="result != null" >
86
+        result,
87
+      </if>
88
+      <if test="meaasgeTypeId != null" >
89
+        meaasge_type_id,
90
+      </if>
91
+      <if test="readStatus != null" >
92
+        read_status,
93
+      </if>
94
+      <if test="createUser != null" >
95
+        create_user,
96
+      </if>
97
+      <if test="createDate != null" >
98
+        create_date,
99
+      </if>
100
+      <if test="updateUser != null" >
101
+        update_user,
102
+      </if>
103
+      <if test="updateDate != null" >
104
+        update_date,
105
+      </if>
106
+    </trim>
107
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
108
+      <if test="id != null" >
109
+        #{id,jdbcType=INTEGER},
110
+      </if>
111
+      <if test="communityId != null" >
112
+        #{communityId,jdbcType=INTEGER},
113
+      </if>
114
+      <if test="messageType != null" >
115
+        #{messageType,jdbcType=CHAR},
116
+      </if>
117
+      <if test="adviceType != null" >
118
+        #{adviceType,jdbcType=CHAR},
119
+      </if>
120
+      <if test="modelType != null" >
121
+        #{modelType,jdbcType=CHAR},
122
+      </if>
123
+      <if test="uuid != null" >
124
+        #{uuid,jdbcType=INTEGER},
125
+      </if>
126
+      <if test="uuidType != null" >
127
+        #{uuidType,jdbcType=CHAR},
128
+      </if>
129
+      <if test="source != null" >
130
+        #{source,jdbcType=CHAR},
131
+      </if>
132
+      <if test="messageContent != null" >
133
+        #{messageContent,jdbcType=VARCHAR},
134
+      </if>
135
+      <if test="status != null" >
136
+        #{status,jdbcType=CHAR},
137
+      </if>
138
+      <if test="result != null" >
139
+        #{result,jdbcType=VARCHAR},
140
+      </if>
141
+      <if test="meaasgeTypeId != null" >
142
+        #{meaasgeTypeId,jdbcType=VARCHAR},
143
+      </if>
144
+      <if test="readStatus != null" >
145
+        #{readStatus,jdbcType=CHAR},
146
+      </if>
147
+      <if test="createUser != null" >
148
+        #{createUser,jdbcType=INTEGER},
149
+      </if>
150
+      <if test="createDate != null" >
151
+        #{createDate,jdbcType=TIMESTAMP},
152
+      </if>
153
+      <if test="updateUser != null" >
154
+        #{updateUser,jdbcType=INTEGER},
155
+      </if>
156
+      <if test="updateDate != null" >
157
+        #{updateDate,jdbcType=TIMESTAMP},
158
+      </if>
159
+    </trim>
160
+  </insert>
161
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpMessage" >
162
+    update tp_message
163
+    <set >
164
+      <if test="communityId != null" >
165
+        community_id = #{communityId,jdbcType=INTEGER},
166
+      </if>
167
+      <if test="messageType != null" >
168
+        message_type = #{messageType,jdbcType=CHAR},
169
+      </if>
170
+      <if test="adviceType != null" >
171
+        advice_type = #{adviceType,jdbcType=CHAR},
172
+      </if>
173
+      <if test="modelType != null" >
174
+        model_type = #{modelType,jdbcType=CHAR},
175
+      </if>
176
+      <if test="uuid != null" >
177
+        uuid = #{uuid,jdbcType=INTEGER},
178
+      </if>
179
+      <if test="uuidType != null" >
180
+        uuid_type = #{uuidType,jdbcType=CHAR},
181
+      </if>
182
+      <if test="source != null" >
183
+        source = #{source,jdbcType=CHAR},
184
+      </if>
185
+      <if test="messageContent != null" >
186
+        message_content = #{messageContent,jdbcType=VARCHAR},
187
+      </if>
188
+      <if test="status != null" >
189
+        status = #{status,jdbcType=CHAR},
190
+      </if>
191
+      <if test="result != null" >
192
+        result = #{result,jdbcType=VARCHAR},
193
+      </if>
194
+      <if test="meaasgeTypeId != null" >
195
+        meaasge_type_id = #{meaasgeTypeId,jdbcType=VARCHAR},
196
+      </if>
197
+      <if test="readStatus != null" >
198
+        read_status = #{readStatus,jdbcType=CHAR},
199
+      </if>
200
+      <if test="createUser != null" >
201
+        create_user = #{createUser,jdbcType=INTEGER},
202
+      </if>
203
+      <if test="createDate != null" >
204
+        create_date = #{createDate,jdbcType=TIMESTAMP},
205
+      </if>
206
+      <if test="updateUser != null" >
207
+        update_user = #{updateUser,jdbcType=INTEGER},
208
+      </if>
209
+      <if test="updateDate != null" >
210
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
211
+      </if>
212
+    </set>
213
+    where id = #{id,jdbcType=INTEGER}
214
+  </update>
215
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpMessage" >
216
+    update tp_message
217
+    set community_id = #{communityId,jdbcType=INTEGER},
218
+      message_type = #{messageType,jdbcType=CHAR},
219
+      advice_type = #{adviceType,jdbcType=CHAR},
220
+      model_type = #{modelType,jdbcType=CHAR},
221
+      uuid = #{uuid,jdbcType=INTEGER},
222
+      uuid_type = #{uuidType,jdbcType=CHAR},
223
+      source = #{source,jdbcType=CHAR},
224
+      message_content = #{messageContent,jdbcType=VARCHAR},
225
+      status = #{status,jdbcType=CHAR},
226
+      result = #{result,jdbcType=VARCHAR},
227
+      meaasge_type_id = #{meaasgeTypeId,jdbcType=VARCHAR},
228
+      read_status = #{readStatus,jdbcType=CHAR},
229
+      create_user = #{createUser,jdbcType=INTEGER},
230
+      create_date = #{createDate,jdbcType=TIMESTAMP},
231
+      update_user = #{updateUser,jdbcType=INTEGER},
232
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
233
+    where id = #{id,jdbcType=INTEGER}
234
+  </update>
235
+
236
+  <select id="getMessageTotal" resultType="map" parameterType="java.lang.Integer" >
237
+    SELECT
238
+        count( CASE WHEN model_type = 1 AND read_status = 0 THEN 1 ELSE NULL END ) AS messageTotal,
239
+        count( CASE WHEN model_type = 2 THEN 1 ELSE NULL END ) AS toDoTotal
240
+    FROM
241
+        tp_message
242
+    WHERE
243
+        uuid_type = 1
244
+        AND uuid = #{userId,jdbcType=INTEGER}
245
+        AND STATUS = 1
246
+        AND advice_type = 1
247
+  </select>
248
+</mapper>

+ 380
- 392
文档/MYSQL/smartCommunity.pdb
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


+ 380
- 392
文档/MYSQL/smartCommunity.pdm
Datei-Diff unterdrückt, da er zu groß ist
Datei anzeigen


BIN
文档/需求/app接口需求-第二版.xlsx Datei anzeigen