follow+sendMessage
Change-Id: I3e9bbcc89dfc53b9651fd8722da1b445a597629a
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 6bde80e..7f85f87 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,4 +1,4 @@
-spring.datasource.password=123456
+spring.datasource.password=12345678
spring.datasource.username=root
spring.datasource.url=jdbc:mysql://localhost:3306/g8backend
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
diff --git a/src/main/resources/mapper/PostMapper.xml b/src/main/resources/mapper/PostMapper.xml
index c1dbda7..d1cbcf4 100644
--- a/src/main/resources/mapper/PostMapper.xml
+++ b/src/main/resources/mapper/PostMapper.xml
@@ -1,8 +1,8 @@
-.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
<mapper namespace="com.example.g8backend.mapper.PostMapper">
<select id="getPostsByUserId" resultType="com.example.g8backend.entity.Post">
SELECT * FROM posts WHERE user_id = #{userId}
diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql
index 952313e..5e5dd43 100644
--- a/src/main/resources/schema.sql
+++ b/src/main/resources/schema.sql
@@ -63,3 +63,25 @@
FOREIGN KEY (post_id) REFERENCES posts(post_id),
PRIMARY KEY (user_id, post_id)
);
+
+-- 关注关系表
+CREATE TABLE IF NOT EXISTS `user_follows` (
+ follower_id INT NOT NULL,
+ followed_id INT NOT NULL,
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ FOREIGN KEY (follower_id) REFERENCES users(user_id),
+ FOREIGN KEY (followed_id) REFERENCES users(user_id),
+ PRIMARY KEY (follower_id, followed_id)
+);
+
+-- 私信表
+CREATE TABLE IF NOT EXISTS `private_messages` (
+ message_id INT AUTO_INCREMENT PRIMARY KEY,
+ sender_id INT NOT NULL,
+ receiver_id INT NOT NULL,
+ content TEXT NOT NULL,
+ sent_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ is_read BOOLEAN DEFAULT false,
+ FOREIGN KEY (sender_id) REFERENCES users(user_id),
+ FOREIGN KEY (receiver_id) REFERENCES users(user_id)
+);
\ No newline at end of file