diff --git a/communityservice/pom.xml b/communityservice/pom.xml
index 6e7539512751c1ab5b895ccc7ec508a08c75f646..2fb8b72b714e518890918324ec50e1d6fe8da9f2 100644
--- a/communityservice/pom.xml
+++ b/communityservice/pom.xml
@@ -88,6 +88,13 @@
1.3.3
+
+
+ com.alibaba
+ fastjson
+ 1.2.62
+
+
@@ -108,6 +115,21 @@
org.springframework.boot
spring-boot-maven-plugin
+
+ org.mybatis.generator
+ mybatis-generator-maven-plugin
+ 1.3.7
+
+ ${basedir}/src/main/resources/generatorConfig.xml
+
+
+
+ mysql
+ mysql-connector-java
+ 5.1.47
+
+
+
diff --git a/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java b/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java
index fa8936337517df620e950ae66240eb6986ea9a2c..6c5880e62ad90a36fde3d49a99dd5d3723ec11bd 100644
--- a/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java
+++ b/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java
@@ -1,10 +1,12 @@
package com.woniu;
+import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
+@MapperScan(value = "com.woniu.dao")
@EnableEurekaClient //开启eureka客户端
public class CommunityserviceApplication {
diff --git a/communityservice/src/main/java/com/woniu/controller/ActivityController.java b/communityservice/src/main/java/com/woniu/controller/ActivityController.java
new file mode 100644
index 0000000000000000000000000000000000000000..323b9796d3638777d9eead78921cc67b042a5dc9
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/controller/ActivityController.java
@@ -0,0 +1,71 @@
+package com.woniu.controller;
+
+import com.alibaba.fastjson.JSONArray;
+import com.woniu.result.CommonResult;
+import com.woniu.service.ActivityService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Map;
+
+@Controller
+@RequestMapping("/activity")
+public class ActivityController {
+
+ @Autowired
+ private ActivityService activityService;
+
+ /**
+ * 投诉活动
+ * @param complaint 投诉信息
+ * @return
+ */
+ @RequestMapping("/complaintSave")
+ @ResponseBody
+ public CommonResult ComplaintSave(@RequestBody String complaint){
+ try {
+ //转化成真实的值
+ String act = URLDecoder.decode(complaint,"UTF-8");
+ //没有上传图片时参数多了一个 = ,不知道为啥
+ act = act.replace("=","");
+ //将数据转为map
+ Map map = JSONArray.parseObject(act);
+ //保存动态到数据库
+ activityService.save(map);
+ return CommonResult.success("发布成功");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ return CommonResult.failed("操作失败");
+ }
+ }
+
+ /**
+ * 发布活动
+ * @param activity 活动信息
+ * @return
+ */
+ @RequestMapping("/activitySave")
+ @ResponseBody
+ public CommonResult ActivitySave(@RequestBody String activity){
+ try {
+ //转化成真实的值
+ String act = URLDecoder.decode(activity,"UTF-8");
+ //没有上传图片时参数多了一个 = ,不知道为啥
+ act = act.replace("=","");
+ //将数据转为map
+ Map map = JSONArray.parseObject(act);
+ //保存动态到数据库
+ activityService.ActivitySave(map);
+ return CommonResult.success("发布成功");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ return CommonResult.failed("操作失败");
+ }
+ }
+
+}
diff --git a/communityservice/src/main/java/com/woniu/controller/DynamicController.java b/communityservice/src/main/java/com/woniu/controller/DynamicController.java
index c8d0d53615f735e2468fdb30c7de3ca6d8353a41..7c14e9e6069845f649cfd452df8845175be96df1 100644
--- a/communityservice/src/main/java/com/woniu/controller/DynamicController.java
+++ b/communityservice/src/main/java/com/woniu/controller/DynamicController.java
@@ -1,30 +1,38 @@
package com.woniu.controller;
+import com.alibaba.fastjson.JSONArray;
import com.woniu.result.CommonResult;
+import com.woniu.service.DynamicService;
import com.woniu.util.QiniuUploadUtil;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Map;
import java.util.UUID;
@Controller
@RequestMapping("/dynamic")
public class DynamicController {
+ @Autowired
+ private DynamicService dynamicService;
/**
* 文件上传
- * @param file 文件数组
+ * @param file 文件
* @return
*/
@PostMapping("/upload")
@ResponseBody
public CommonResult upload(MultipartFile file){
- System.out.println("_________________");
if(file==null){
return CommonResult.failed("请选择上传图片");
}
@@ -34,9 +42,7 @@ public class DynamicController {
//UUID获取文件名(自己编写)
String fileName = UUID.randomUUID().toString();
String imgurl = new QiniuUploadUtil().upload(fileName, file.getBytes());
-// System.out.println(imgurl);
-// Map map=new HashMap();
-// map.put("src",imgurl);
+ //返回图片路径
return CommonResult.success(imgurl);
} catch (IOException e) {
e.printStackTrace();
@@ -44,11 +50,23 @@ public class DynamicController {
}
}
- @RequestMapping("/test")
+ @PostMapping("/save")
@ResponseBody
- public String test(Integer aa){
- System.out.println(aa);
- System.out.println("*******");
- return "tttt";
+ public CommonResult save(@RequestBody String dynamic){
+ try {
+ //转化成真实的值
+ String act = URLDecoder.decode(dynamic,"UTF-8");
+ //没有上传图片时参数多了一个 = ,不知道为啥
+ act = act.replace("=","");
+ //将数据转为map
+ Map map = JSONArray.parseObject(act);
+ //保存动态到数据库
+ dynamicService.save(map);
+ return CommonResult.success("发布成功");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ return CommonResult.failed("操作失败");
+ }
}
+
}
diff --git a/communityservice/src/main/java/com/woniu/dao/ActivityComplaintMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityComplaintMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..4015df1e29f434583d77483ddf287b381b19a423
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/dao/ActivityComplaintMapper.java
@@ -0,0 +1,19 @@
+package com.woniu.dao;
+
+import com.woniu.pojo.ActivityComplaint;
+
+public interface ActivityComplaintMapper {
+ int deleteByPrimaryKey(Integer id);
+
+ int insert(ActivityComplaint record);
+
+ int insertSelective(ActivityComplaint record);
+
+ ActivityComplaint selectByPrimaryKey(Integer id);
+
+ int updateByPrimaryKeySelective(ActivityComplaint record);
+
+ int updateByPrimaryKeyWithBLOBs(ActivityComplaint record);
+
+ int updateByPrimaryKey(ActivityComplaint record);
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..b53eea0e3c5fe47e5c657972a2ee18b512dfdebe
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java
@@ -0,0 +1,19 @@
+package com.woniu.dao;
+
+import com.woniu.pojo.Activity;
+
+public interface ActivityMapper {
+ int deleteByPrimaryKey(Integer id);
+
+ int insert(Activity record);
+
+ int insertSelective(Activity record);
+
+ Activity selectByPrimaryKey(Integer id);
+
+ int updateByPrimaryKeySelective(Activity record);
+
+ int updateByPrimaryKeyWithBLOBs(Activity record);
+
+ int updateByPrimaryKey(Activity record);
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..11a0ec3dbefdcfb7b38cbac7633dc4546dddaf19
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java
@@ -0,0 +1,17 @@
+package com.woniu.dao;
+
+import com.woniu.pojo.ActivityUser;
+
+public interface ActivityUserMapper {
+ int deleteByPrimaryKey(Integer id);
+
+ int insert(ActivityUser record);
+
+ int insertSelective(ActivityUser record);
+
+ ActivityUser selectByPrimaryKey(Integer id);
+
+ int updateByPrimaryKeySelective(ActivityUser record);
+
+ int updateByPrimaryKey(ActivityUser record);
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/dao/DynamicCommentMapper.java b/communityservice/src/main/java/com/woniu/dao/DynamicCommentMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..8e7797444334604bffac43491770554a3d30e7d9
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/dao/DynamicCommentMapper.java
@@ -0,0 +1,17 @@
+package com.woniu.dao;
+
+import com.woniu.pojo.DynamicComment;
+
+public interface DynamicCommentMapper {
+ int deleteByPrimaryKey(Integer id);
+
+ int insert(DynamicComment record);
+
+ int insertSelective(DynamicComment record);
+
+ DynamicComment selectByPrimaryKey(Integer id);
+
+ int updateByPrimaryKeySelective(DynamicComment record);
+
+ int updateByPrimaryKey(DynamicComment record);
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java b/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java
new file mode 100644
index 0000000000000000000000000000000000000000..66cac53eeb7ad3fa048d105d44c99780c256c252
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java
@@ -0,0 +1,19 @@
+package com.woniu.dao;
+
+import com.woniu.pojo.Dynamic;
+
+public interface DynamicMapper {
+ int deleteByPrimaryKey(Integer id);
+
+ int insert(Dynamic record);
+
+ int insertSelective(Dynamic record);
+
+ Dynamic selectByPrimaryKey(Integer id);
+
+ int updateByPrimaryKeySelective(Dynamic record);
+
+ int updateByPrimaryKeyWithBLOBs(Dynamic record);
+
+ int updateByPrimaryKey(Dynamic record);
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/pojo/Activity.java b/communityservice/src/main/java/com/woniu/pojo/Activity.java
new file mode 100644
index 0000000000000000000000000000000000000000..183056fd827d295b31f448184d495b32f398dae5
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/pojo/Activity.java
@@ -0,0 +1,53 @@
+package com.woniu.pojo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class Activity {
+ private Integer id;
+
+ private Integer caUserId;
+
+ private String caPicPath;
+
+ private Integer caType;
+
+ private String caTitle;
+
+ private Date caStartTime;
+
+ private Date caEndTime;
+
+ private Integer caStatus;
+
+ private Double caMoney;
+
+ private Integer caPeopelCount;
+
+ private Integer caMaxPeopleCount;
+
+ private Date caCreateTime;
+
+ private String caContent;
+
+ public Activity() {
+ }
+
+ public Activity(Integer caUserId, String caPicPath, Integer caType, String caTitle, Date caStartTime, Date caEndTime, Integer caStatus, Double caMoney, Integer caPeopelCount, Integer caMaxPeopleCount, Date caCreateTime, String caContent) {
+ this.caUserId = caUserId;
+ this.caPicPath = caPicPath;
+ this.caType = caType;
+ this.caTitle = caTitle;
+ this.caStartTime = caStartTime;
+ this.caEndTime = caEndTime;
+ this.caStatus = caStatus;
+ this.caMoney = caMoney;
+ this.caPeopelCount = caPeopelCount;
+ this.caMaxPeopleCount = caMaxPeopleCount;
+ this.caCreateTime = caCreateTime;
+ this.caContent = caContent;
+ }
+
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/pojo/ActivityComplaint.java b/communityservice/src/main/java/com/woniu/pojo/ActivityComplaint.java
new file mode 100644
index 0000000000000000000000000000000000000000..ee7f8027b557be184c7ccf18975213e95af88bdf
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/pojo/ActivityComplaint.java
@@ -0,0 +1,31 @@
+package com.woniu.pojo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ActivityComplaint {
+ private Integer id;
+
+ private Integer cacUserId;
+
+ private Integer cacActivityId;
+
+ private String cacPic;
+
+ private Date ccTime;
+
+ private String cacReason;
+
+ public ActivityComplaint() {
+ }
+
+ public ActivityComplaint(Integer cacUserId, Integer cacActivityId, String cacPic, Date ccTime, String cacReason) {
+ this.cacUserId = cacUserId;
+ this.cacActivityId = cacActivityId;
+ this.cacPic = cacPic;
+ this.ccTime = ccTime;
+ this.cacReason = cacReason;
+ }
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/pojo/ActivityUser.java b/communityservice/src/main/java/com/woniu/pojo/ActivityUser.java
new file mode 100644
index 0000000000000000000000000000000000000000..4c1ddd80fd3c07240ed1b2bc88c9176f31321572
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/pojo/ActivityUser.java
@@ -0,0 +1,20 @@
+package com.woniu.pojo;
+
+import lombok.Data;
+
+@Data
+public class ActivityUser {
+ private Integer id;
+
+ private Integer cauActivityId;
+
+ private Integer cauUserId;
+
+ public ActivityUser() {
+ }
+
+ public ActivityUser(Integer cauActivityId, Integer cauUserId) {
+ this.cauActivityId = cauActivityId;
+ this.cauUserId = cauUserId;
+ }
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/pojo/Dynamic.java b/communityservice/src/main/java/com/woniu/pojo/Dynamic.java
new file mode 100644
index 0000000000000000000000000000000000000000..38b5f00498d20369e0a4ae675efb4ebb123e4b91
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/pojo/Dynamic.java
@@ -0,0 +1,35 @@
+package com.woniu.pojo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class Dynamic {
+ private Integer id;
+
+ private Integer cdUserId;
+
+ private String cdPicPath;
+
+ private Integer cdType;
+
+ private Integer cdFavor;
+
+ private Date cdTime;
+
+ private String cdContent;
+
+ public Dynamic() {
+ }
+
+ public Dynamic(Integer cdUserId, String cdPicPath, Integer cdType, Integer cdFavor, Date cdTime, String cdContent) {
+ this.cdUserId = cdUserId;
+ this.cdPicPath = cdPicPath;
+ this.cdType = cdType;
+ this.cdFavor = cdFavor;
+ this.cdTime = cdTime;
+ this.cdContent = cdContent;
+ }
+
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/pojo/DynamicComment.java b/communityservice/src/main/java/com/woniu/pojo/DynamicComment.java
new file mode 100644
index 0000000000000000000000000000000000000000..6baad41cfc6a9e3d076c4b3650a3191600fe9d08
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/pojo/DynamicComment.java
@@ -0,0 +1,65 @@
+package com.woniu.pojo;
+
+import java.util.Date;
+
+public class DynamicComment {
+ private Integer id;
+
+ private Integer cdcDynamicId;
+
+ private Integer cdcUserId;
+
+ private Integer cdcOtherUserId;
+
+ private String cdcContent;
+
+ private Date cdcTime;
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public Integer getCdcDynamicId() {
+ return cdcDynamicId;
+ }
+
+ public void setCdcDynamicId(Integer cdcDynamicId) {
+ this.cdcDynamicId = cdcDynamicId;
+ }
+
+ public Integer getCdcUserId() {
+ return cdcUserId;
+ }
+
+ public void setCdcUserId(Integer cdcUserId) {
+ this.cdcUserId = cdcUserId;
+ }
+
+ public Integer getCdcOtherUserId() {
+ return cdcOtherUserId;
+ }
+
+ public void setCdcOtherUserId(Integer cdcOtherUserId) {
+ this.cdcOtherUserId = cdcOtherUserId;
+ }
+
+ public String getCdcContent() {
+ return cdcContent;
+ }
+
+ public void setCdcContent(String cdcContent) {
+ this.cdcContent = cdcContent;
+ }
+
+ public Date getCdcTime() {
+ return cdcTime;
+ }
+
+ public void setCdcTime(Date cdcTime) {
+ this.cdcTime = cdcTime;
+ }
+}
\ No newline at end of file
diff --git a/communityservice/src/main/java/com/woniu/service/ActivityService.java b/communityservice/src/main/java/com/woniu/service/ActivityService.java
new file mode 100644
index 0000000000000000000000000000000000000000..59e0c8b78345e9925df527cdbfc734a9fe12863f
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/service/ActivityService.java
@@ -0,0 +1,17 @@
+package com.woniu.service;
+
+import java.util.Map;
+
+public interface ActivityService {
+ /**
+ * 投诉活动
+ * @param map
+ */
+ void save(Map map);
+
+ /**
+ * 发布活动
+ * @param map
+ */
+ void ActivitySave(Map map);
+}
diff --git a/communityservice/src/main/java/com/woniu/service/DynamicService.java b/communityservice/src/main/java/com/woniu/service/DynamicService.java
new file mode 100644
index 0000000000000000000000000000000000000000..9c73e375472e480201c213944fa49dffd8354519
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/service/DynamicService.java
@@ -0,0 +1,12 @@
+package com.woniu.service;
+
+import java.util.Map;
+
+public interface DynamicService {
+
+ /**
+ * 保存动态
+ * @param map 动态数据
+ */
+ void save(Map map);
+}
diff --git a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..2df00e2d4830d37b6ac166901ac451dedb8d4422
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java
@@ -0,0 +1,75 @@
+package com.woniu.service.impl;
+
+import com.woniu.dao.ActivityComplaintMapper;
+import com.woniu.dao.ActivityMapper;
+import com.woniu.dao.ActivityUserMapper;
+import com.woniu.pojo.Activity;
+import com.woniu.pojo.ActivityComplaint;
+import com.woniu.pojo.ActivityUser;
+import com.woniu.service.ActivityService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+
+@Service
+public class ActivityServiceImpl implements ActivityService {
+
+ @Autowired
+ private ActivityComplaintMapper activityComplaintMapper;
+ @Autowired
+ private ActivityMapper activityMapper;
+ @Autowired
+ private ActivityUserMapper activityUserMapper;
+ /**
+ * 投诉活动
+ * @param map 投诉数据
+ */
+ @Override
+ public void save(Map map) {
+ //构造一个新的投诉实体
+ Integer userId = Integer.valueOf(map.get("userId").toString());
+ String picPath = String.valueOf(map.get("picPath"));
+ Integer activityId = Integer.valueOf(map.get("activityId").toString());
+ String content = String.valueOf(map.get("content"));
+ ActivityComplaint activityComplaint = new ActivityComplaint(userId,activityId,picPath,new Date(),content);
+ activityComplaintMapper.insertSelective(activityComplaint);
+ }
+
+ /**
+ * 发布活动
+ * @param map 活动数据
+ */
+ @Override
+ public void ActivitySave(Map map) {
+ //构造一个活动实体,从前端获取数据
+ Integer userId = Integer.valueOf(map.get("userId").toString());
+ String picPath = String.valueOf(map.get("picPath"));
+ Integer type = Integer.valueOf(map.get("type").toString());
+ String title = String.valueOf(map.get("activityName"));
+ Date startTime=null,endTime=null;
+ try {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ startTime = sdf.parse(map.get("startTime").toString());
+ endTime = sdf.parse(map.get("endTime").toString());
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ Integer statue = 0;
+ Double money = Double.valueOf(map.get("money").toString());
+ Integer peopelCount = 1;
+ Integer maxCount = Integer.valueOf(map.get("maxCount").toString());
+ Date createTime = new Date();
+ String content = String.valueOf(map.get("content"));
+ Activity activity = new Activity(userId,picPath,type,title,startTime,endTime,statue,money,peopelCount,maxCount,createTime,content);
+ //保存活动到数据库
+ Integer activityId = activityMapper.insertSelective(activity);
+ System.out.println(activity.getId());
+ //保存当前发布人到活动用户中间表中,即报名表
+ ActivityUser activityUser = new ActivityUser(activity.getId(),userId);
+ activityUserMapper.insertSelective(activityUser);
+ }
+}
diff --git a/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..9d0b022125b4ad4ea1abd3cd41ac226c06be55ed
--- /dev/null
+++ b/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java
@@ -0,0 +1,33 @@
+package com.woniu.service.impl;
+
+import com.woniu.dao.DynamicMapper;
+import com.woniu.pojo.Dynamic;
+import com.woniu.service.DynamicService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.Map;
+
+@Service
+public class DynamicServiceImpl implements DynamicService {
+
+ @Autowired
+ private DynamicMapper dynamicMapper;
+
+ /**
+ * 保存动态
+ * @param map
+ */
+ @Override
+ public void save(Map map) {
+ //构造一个新的动态实体
+ Integer userId = Integer.valueOf(map.get("userId").toString());
+ String picPath = String.valueOf(map.get("picPath"));
+ Integer type = Integer.valueOf(map.get("type").toString());
+ Integer favor = Integer.valueOf(map.get("favor").toString());
+ String content = String.valueOf(map.get("content"));
+ Dynamic dynamic = new Dynamic(userId,picPath,type,favor,new Date(),content);
+ dynamicMapper.insertSelective(dynamic);
+ }
+}
diff --git a/communityservice/src/main/resources/application.yml b/communityservice/src/main/resources/application.yml
index f5f570008c71c321dd93a86ba5ab4147367fc01e..208eab98f11031007ab54f65438478ccc8553d2e 100644
--- a/communityservice/src/main/resources/application.yml
+++ b/communityservice/src/main/resources/application.yml
@@ -2,7 +2,7 @@ spring:
datasource:
password: 20200322
username: develop
- url: jdbc:mysql://106.12.148.100:3307/happycommunity
+ url: jdbc:mysql://106.12.148.100:3307/happycommunity?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
driver-class-name: com.mysql.jdbc.Driver
jackson:
time-zone: GMT+8
diff --git a/communityservice/src/main/resources/generatorConfig.xml b/communityservice/src/main/resources/generatorConfig.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a1b409b51448c65f1f077a38d0794e300fc2dddf
--- /dev/null
+++ b/communityservice/src/main/resources/generatorConfig.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/communityservice/src/main/resources/mapper/ActivityComplaintMapper.xml b/communityservice/src/main/resources/mapper/ActivityComplaintMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1b317905250f23efdaca439c241e956da1ca572f
--- /dev/null
+++ b/communityservice/src/main/resources/mapper/ActivityComplaintMapper.xml
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, cac_user_id, cac_activity_id, cac_pic, cc_time
+
+
+ cac_reason
+
+
+
+ delete from community_activity_complaint
+ where id = #{id,jdbcType=INTEGER}
+
+
+ insert into community_activity_complaint (id, cac_user_id, cac_activity_id,
+ cac_pic, cc_time, cac_reason
+ )
+ values (#{id,jdbcType=INTEGER}, #{cacUserId,jdbcType=INTEGER}, #{cacActivityId,jdbcType=INTEGER},
+ #{cacPic,jdbcType=VARCHAR}, #{ccTime,jdbcType=TIMESTAMP}, #{cacReason,jdbcType=LONGVARCHAR}
+ )
+
+
+ insert into community_activity_complaint
+
+
+ id,
+
+
+ cac_user_id,
+
+
+ cac_activity_id,
+
+
+ cac_pic,
+
+
+ cc_time,
+
+
+ cac_reason,
+
+
+
+
+ #{id,jdbcType=INTEGER},
+
+
+ #{cacUserId,jdbcType=INTEGER},
+
+
+ #{cacActivityId,jdbcType=INTEGER},
+
+
+ #{cacPic,jdbcType=VARCHAR},
+
+
+ #{ccTime,jdbcType=TIMESTAMP},
+
+
+ #{cacReason,jdbcType=LONGVARCHAR},
+
+
+
+
+ update community_activity_complaint
+
+
+ cac_user_id = #{cacUserId,jdbcType=INTEGER},
+
+
+ cac_activity_id = #{cacActivityId,jdbcType=INTEGER},
+
+
+ cac_pic = #{cacPic,jdbcType=VARCHAR},
+
+
+ cc_time = #{ccTime,jdbcType=TIMESTAMP},
+
+
+ cac_reason = #{cacReason,jdbcType=LONGVARCHAR},
+
+
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update community_activity_complaint
+ set cac_user_id = #{cacUserId,jdbcType=INTEGER},
+ cac_activity_id = #{cacActivityId,jdbcType=INTEGER},
+ cac_pic = #{cacPic,jdbcType=VARCHAR},
+ cc_time = #{ccTime,jdbcType=TIMESTAMP},
+ cac_reason = #{cacReason,jdbcType=LONGVARCHAR}
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update community_activity_complaint
+ set cac_user_id = #{cacUserId,jdbcType=INTEGER},
+ cac_activity_id = #{cacActivityId,jdbcType=INTEGER},
+ cac_pic = #{cacPic,jdbcType=VARCHAR},
+ cc_time = #{ccTime,jdbcType=TIMESTAMP}
+ where id = #{id,jdbcType=INTEGER}
+
+
\ No newline at end of file
diff --git a/communityservice/src/main/resources/mapper/ActivityMapper.xml b/communityservice/src/main/resources/mapper/ActivityMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e5642acc44037d0cb70e5f9baea60436de4203a8
--- /dev/null
+++ b/communityservice/src/main/resources/mapper/ActivityMapper.xml
@@ -0,0 +1,210 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, ca_user_id, ca_pic_path, ca_type, ca_title, ca_start_time, ca_end_time, ca_status,
+ ca_money, ca_peopel_count, ca_max_people_count, ca_create_time
+
+
+ ca_content
+
+
+
+ delete from community_activity
+ where id = #{id,jdbcType=INTEGER}
+
+
+ insert into community_activity (id, ca_user_id, ca_pic_path,
+ ca_type, ca_title, ca_start_time,
+ ca_end_time, ca_status, ca_money,
+ ca_peopel_count, ca_max_people_count, ca_create_time,
+ ca_content)
+ values (#{id,jdbcType=INTEGER}, #{caUserId,jdbcType=INTEGER}, #{caPicPath,jdbcType=VARCHAR},
+ #{caType,jdbcType=INTEGER}, #{caTitle,jdbcType=VARCHAR}, #{caStartTime,jdbcType=TIMESTAMP},
+ #{caEndTime,jdbcType=TIMESTAMP}, #{caStatus,jdbcType=INTEGER}, #{caMoney,jdbcType=DOUBLE},
+ #{caPeopelCount,jdbcType=INTEGER}, #{caMaxPeopleCount,jdbcType=INTEGER}, #{caCreateTime,jdbcType=TIMESTAMP},
+ #{caContent,jdbcType=LONGVARCHAR})
+
+
+ insert into community_activity
+
+
+ id,
+
+
+ ca_user_id,
+
+
+ ca_pic_path,
+
+
+ ca_type,
+
+
+ ca_title,
+
+
+ ca_start_time,
+
+
+ ca_end_time,
+
+
+ ca_status,
+
+
+ ca_money,
+
+
+ ca_peopel_count,
+
+
+ ca_max_people_count,
+
+
+ ca_create_time,
+
+
+ ca_content,
+
+
+
+
+ #{id,jdbcType=INTEGER},
+
+
+ #{caUserId,jdbcType=INTEGER},
+
+
+ #{caPicPath,jdbcType=VARCHAR},
+
+
+ #{caType,jdbcType=INTEGER},
+
+
+ #{caTitle,jdbcType=VARCHAR},
+
+
+ #{caStartTime,jdbcType=TIMESTAMP},
+
+
+ #{caEndTime,jdbcType=TIMESTAMP},
+
+
+ #{caStatus,jdbcType=INTEGER},
+
+
+ #{caMoney,jdbcType=DOUBLE},
+
+
+ #{caPeopelCount,jdbcType=INTEGER},
+
+
+ #{caMaxPeopleCount,jdbcType=INTEGER},
+
+
+ #{caCreateTime,jdbcType=TIMESTAMP},
+
+
+ #{caContent,jdbcType=LONGVARCHAR},
+
+
+
+
+ update community_activity
+
+
+ ca_user_id = #{caUserId,jdbcType=INTEGER},
+
+
+ ca_pic_path = #{caPicPath,jdbcType=VARCHAR},
+
+
+ ca_type = #{caType,jdbcType=INTEGER},
+
+
+ ca_title = #{caTitle,jdbcType=VARCHAR},
+
+
+ ca_start_time = #{caStartTime,jdbcType=TIMESTAMP},
+
+
+ ca_end_time = #{caEndTime,jdbcType=TIMESTAMP},
+
+
+ ca_status = #{caStatus,jdbcType=INTEGER},
+
+
+ ca_money = #{caMoney,jdbcType=DOUBLE},
+
+
+ ca_peopel_count = #{caPeopelCount,jdbcType=INTEGER},
+
+
+ ca_max_people_count = #{caMaxPeopleCount,jdbcType=INTEGER},
+
+
+ ca_create_time = #{caCreateTime,jdbcType=TIMESTAMP},
+
+
+ ca_content = #{caContent,jdbcType=LONGVARCHAR},
+
+
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update community_activity
+ set ca_user_id = #{caUserId,jdbcType=INTEGER},
+ ca_pic_path = #{caPicPath,jdbcType=VARCHAR},
+ ca_type = #{caType,jdbcType=INTEGER},
+ ca_title = #{caTitle,jdbcType=VARCHAR},
+ ca_start_time = #{caStartTime,jdbcType=TIMESTAMP},
+ ca_end_time = #{caEndTime,jdbcType=TIMESTAMP},
+ ca_status = #{caStatus,jdbcType=INTEGER},
+ ca_money = #{caMoney,jdbcType=DOUBLE},
+ ca_peopel_count = #{caPeopelCount,jdbcType=INTEGER},
+ ca_max_people_count = #{caMaxPeopleCount,jdbcType=INTEGER},
+ ca_create_time = #{caCreateTime,jdbcType=TIMESTAMP},
+ ca_content = #{caContent,jdbcType=LONGVARCHAR}
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update community_activity
+ set ca_user_id = #{caUserId,jdbcType=INTEGER},
+ ca_pic_path = #{caPicPath,jdbcType=VARCHAR},
+ ca_type = #{caType,jdbcType=INTEGER},
+ ca_title = #{caTitle,jdbcType=VARCHAR},
+ ca_start_time = #{caStartTime,jdbcType=TIMESTAMP},
+ ca_end_time = #{caEndTime,jdbcType=TIMESTAMP},
+ ca_status = #{caStatus,jdbcType=INTEGER},
+ ca_money = #{caMoney,jdbcType=DOUBLE},
+ ca_peopel_count = #{caPeopelCount,jdbcType=INTEGER},
+ ca_max_people_count = #{caMaxPeopleCount,jdbcType=INTEGER},
+ ca_create_time = #{caCreateTime,jdbcType=TIMESTAMP}
+ where id = #{id,jdbcType=INTEGER}
+
+
\ No newline at end of file
diff --git a/communityservice/src/main/resources/mapper/ActivityUserMapper.xml b/communityservice/src/main/resources/mapper/ActivityUserMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e718364a7b6cb617c2f9f67bf4b5d75a2d1b9d15
--- /dev/null
+++ b/communityservice/src/main/resources/mapper/ActivityUserMapper.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+ id, cau_activity_id, cau_user_id
+
+
+
+ delete from community_activity_user
+ where id = #{id,jdbcType=INTEGER}
+
+
+ insert into community_activity_user (id, cau_activity_id, cau_user_id
+ )
+ values (#{id,jdbcType=INTEGER}, #{cauActivityId,jdbcType=INTEGER}, #{cauUserId,jdbcType=INTEGER}
+ )
+
+
+ insert into community_activity_user
+
+
+ id,
+
+
+ cau_activity_id,
+
+
+ cau_user_id,
+
+
+
+
+ #{id,jdbcType=INTEGER},
+
+
+ #{cauActivityId,jdbcType=INTEGER},
+
+
+ #{cauUserId,jdbcType=INTEGER},
+
+
+
+
+ update community_activity_user
+
+
+ cau_activity_id = #{cauActivityId,jdbcType=INTEGER},
+
+
+ cau_user_id = #{cauUserId,jdbcType=INTEGER},
+
+
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update community_activity_user
+ set cau_activity_id = #{cauActivityId,jdbcType=INTEGER},
+ cau_user_id = #{cauUserId,jdbcType=INTEGER}
+ where id = #{id,jdbcType=INTEGER}
+
+
\ No newline at end of file
diff --git a/communityservice/src/main/resources/mapper/DynamicCommentMapper.xml b/communityservice/src/main/resources/mapper/DynamicCommentMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1e875be62e98a4238f85b5efed658d74ebe9cb64
--- /dev/null
+++ b/communityservice/src/main/resources/mapper/DynamicCommentMapper.xml
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ id, cdc_dynamic_id, cdc_user_id, cdc_other_user_id, cdc_content, cdc_time
+
+
+
+ delete from community_dynamic_comment
+ where id = #{id,jdbcType=INTEGER}
+
+
+ insert into community_dynamic_comment (id, cdc_dynamic_id, cdc_user_id,
+ cdc_other_user_id, cdc_content, cdc_time
+ )
+ values (#{id,jdbcType=INTEGER}, #{cdcDynamicId,jdbcType=INTEGER}, #{cdcUserId,jdbcType=INTEGER},
+ #{cdcOtherUserId,jdbcType=INTEGER}, #{cdcContent,jdbcType=VARCHAR}, #{cdcTime,jdbcType=TIMESTAMP}
+ )
+
+
+ insert into community_dynamic_comment
+
+
+ id,
+
+
+ cdc_dynamic_id,
+
+
+ cdc_user_id,
+
+
+ cdc_other_user_id,
+
+
+ cdc_content,
+
+
+ cdc_time,
+
+
+
+
+ #{id,jdbcType=INTEGER},
+
+
+ #{cdcDynamicId,jdbcType=INTEGER},
+
+
+ #{cdcUserId,jdbcType=INTEGER},
+
+
+ #{cdcOtherUserId,jdbcType=INTEGER},
+
+
+ #{cdcContent,jdbcType=VARCHAR},
+
+
+ #{cdcTime,jdbcType=TIMESTAMP},
+
+
+
+
+ update community_dynamic_comment
+
+
+ cdc_dynamic_id = #{cdcDynamicId,jdbcType=INTEGER},
+
+
+ cdc_user_id = #{cdcUserId,jdbcType=INTEGER},
+
+
+ cdc_other_user_id = #{cdcOtherUserId,jdbcType=INTEGER},
+
+
+ cdc_content = #{cdcContent,jdbcType=VARCHAR},
+
+
+ cdc_time = #{cdcTime,jdbcType=TIMESTAMP},
+
+
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update community_dynamic_comment
+ set cdc_dynamic_id = #{cdcDynamicId,jdbcType=INTEGER},
+ cdc_user_id = #{cdcUserId,jdbcType=INTEGER},
+ cdc_other_user_id = #{cdcOtherUserId,jdbcType=INTEGER},
+ cdc_content = #{cdcContent,jdbcType=VARCHAR},
+ cdc_time = #{cdcTime,jdbcType=TIMESTAMP}
+ where id = #{id,jdbcType=INTEGER}
+
+
\ No newline at end of file
diff --git a/communityservice/src/main/resources/mapper/DynamicMapper.xml b/communityservice/src/main/resources/mapper/DynamicMapper.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c4b51daddfc595d222b6f09d46f5fc8b8f0fd60f
--- /dev/null
+++ b/communityservice/src/main/resources/mapper/DynamicMapper.xml
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, cd_user_id, cd_pic_path, cd_type, cd_favor, cd_time
+
+
+ cd_content
+
+
+
+ delete from community_dynamic
+ where id = #{id,jdbcType=INTEGER}
+
+
+ insert into community_dynamic (id, cd_user_id, cd_pic_path,
+ cd_type, cd_favor, cd_time,
+ cd_content)
+ values (#{id,jdbcType=INTEGER}, #{cdUserId,jdbcType=INTEGER}, #{cdPicPath,jdbcType=VARCHAR},
+ #{cdType,jdbcType=INTEGER}, #{cdFavor,jdbcType=INTEGER}, #{cdTime,jdbcType=TIMESTAMP},
+ #{cdContent,jdbcType=LONGVARCHAR})
+
+
+ insert into community_dynamic
+
+
+ id,
+
+
+ cd_user_id,
+
+
+ cd_pic_path,
+
+
+ cd_type,
+
+
+ cd_favor,
+
+
+ cd_time,
+
+
+ cd_content,
+
+
+
+
+ #{id,jdbcType=INTEGER},
+
+
+ #{cdUserId,jdbcType=INTEGER},
+
+
+ #{cdPicPath,jdbcType=VARCHAR},
+
+
+ #{cdType,jdbcType=INTEGER},
+
+
+ #{cdFavor,jdbcType=INTEGER},
+
+
+ #{cdTime,jdbcType=TIMESTAMP},
+
+
+ #{cdContent,jdbcType=LONGVARCHAR},
+
+
+
+
+ update community_dynamic
+
+
+ cd_user_id = #{cdUserId,jdbcType=INTEGER},
+
+
+ cd_pic_path = #{cdPicPath,jdbcType=VARCHAR},
+
+
+ cd_type = #{cdType,jdbcType=INTEGER},
+
+
+ cd_favor = #{cdFavor,jdbcType=INTEGER},
+
+
+ cd_time = #{cdTime,jdbcType=TIMESTAMP},
+
+
+ cd_content = #{cdContent,jdbcType=LONGVARCHAR},
+
+
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update community_dynamic
+ set cd_user_id = #{cdUserId,jdbcType=INTEGER},
+ cd_pic_path = #{cdPicPath,jdbcType=VARCHAR},
+ cd_type = #{cdType,jdbcType=INTEGER},
+ cd_favor = #{cdFavor,jdbcType=INTEGER},
+ cd_time = #{cdTime,jdbcType=TIMESTAMP},
+ cd_content = #{cdContent,jdbcType=LONGVARCHAR}
+ where id = #{id,jdbcType=INTEGER}
+
+
+ update community_dynamic
+ set cd_user_id = #{cdUserId,jdbcType=INTEGER},
+ cd_pic_path = #{cdPicPath,jdbcType=VARCHAR},
+ cd_type = #{cdType,jdbcType=INTEGER},
+ cd_favor = #{cdFavor,jdbcType=INTEGER},
+ cd_time = #{cdTime,jdbcType=TIMESTAMP}
+ where id = #{id,jdbcType=INTEGER}
+
+
\ No newline at end of file