minio
This commit is contained in:
24
community-8073/src/main/resources/application-dep.properties
Normal file
24
community-8073/src/main/resources/application-dep.properties
Normal file
@@ -0,0 +1,24 @@
|
||||
wx.miniapp.configs[0].appid=wx0d4fdb5c7bf3b12b
|
||||
wx.miniapp.configs[0].secret=989f155fcc3aee616568473faf1b1d3b
|
||||
|
||||
spring.data.redis.host=127.0.0.1
|
||||
spring.data.redis.port=6379
|
||||
spring.data.redis.database=0
|
||||
|
||||
spring.application.name=community
|
||||
|
||||
server.port=8073
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=123456
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tutorial?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
|
||||
spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848
|
||||
spring.cloud.nacos.discovery.enabled=true
|
||||
|
||||
management.zipkin.tracing.endpoint=http://127.0.0.1:9411/api/v2/spans
|
||||
management.tracing.sampling.probability=1.0
|
||||
|
||||
|
||||
|
||||
26
community-8073/src/main/resources/application-dev.properties
Normal file
26
community-8073/src/main/resources/application-dev.properties
Normal file
@@ -0,0 +1,26 @@
|
||||
wx.miniapp.configs[0].appid=wx0d4fdb5c7bf3b12b
|
||||
wx.miniapp.configs[0].secret=989f155fcc3aee616568473faf1b1d3b
|
||||
|
||||
spring.data.redis.host=localhost
|
||||
spring.data.redis.port=6379
|
||||
spring.data.redis.database=0
|
||||
|
||||
spring.application.name=community
|
||||
|
||||
server.port=8073
|
||||
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=123456
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tutorial?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
|
||||
dubbo.application.qos-enable=false
|
||||
|
||||
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
minio.endpoint=120.26.243.81
|
||||
minio.port=9000
|
||||
minio.accessKey=minio_root
|
||||
minio.secretKey=minio_123456
|
||||
minio.bucketName=haixia
|
||||
|
||||
1
community-8073/src/main/resources/application.properties
Normal file
1
community-8073/src/main/resources/application.properties
Normal file
@@ -0,0 +1 @@
|
||||
spring.profiles.active=dev
|
||||
77
community-8073/src/main/resources/mapper/CommentMapper.xml
Normal file
77
community-8073/src/main/resources/mapper/CommentMapper.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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.ivmiku.tutorial.mapper.CommentMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ivmiku.tutorial.entity.Comment">
|
||||
<id property="commentId" column="comment_id" jdbcType="BIGINT"/>
|
||||
<result property="userOpenid" column="user_openid" jdbcType="VARCHAR"/>
|
||||
<result property="postId" column="post_id" jdbcType="BIGINT"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="parentCommentId" column="parent_comment_id" jdbcType="BIGINT"/>
|
||||
<result property="isDeleted" column="is_deleted" jdbcType="TINYINT"/>
|
||||
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
||||
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
||||
<result property="mentionedUserId" column="mentioned_user_id" jdbcType="VARCHAR"/> <!-- 新增字段 -->
|
||||
<result column="image_urls" property="imageUrls" />
|
||||
<result column="video_url" property="videoUrl" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
comment_id, user_openid, post_id, content,
|
||||
parent_comment_id, is_deleted, created_at, updated_at,
|
||||
mentioned_user_id, image_urls, video_url
|
||||
</sql>
|
||||
|
||||
<!-- 查询指定帖子的所有评论 -->
|
||||
<select id="selectCommentsByPostId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM comment
|
||||
WHERE post_id = #{postId} AND is_deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 查询指定评论的所有回复 -->
|
||||
<select id="selectRepliesByCommentId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM comment
|
||||
WHERE parent_comment_id = #{commentId} AND is_deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 插入新的评论 -->
|
||||
<insert id="insertComment" parameterType="com.ivmiku.tutorial.entity.Comment">
|
||||
INSERT INTO comment (
|
||||
user_openid, post_id, content, parent_comment_id,
|
||||
is_deleted, created_at, updated_at, mentioned_user_id
|
||||
) VALUES (
|
||||
#{userOpenid}, #{postId}, #{content}, #{parentCommentId},
|
||||
#{isDeleted}, #{createdAt}, #{updatedAt}, #{mentionedUserId}, #{imageUrls}, #{videoUrl}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新评论 -->
|
||||
<update id="updateComment" parameterType="com.ivmiku.tutorial.entity.Comment">
|
||||
UPDATE comment
|
||||
SET
|
||||
user_openid = #{userOpenid},
|
||||
post_id = #{postId},
|
||||
content = #{content},
|
||||
parent_comment_id = #{parentCommentId},
|
||||
is_deleted = #{isDeleted},
|
||||
created_at = #{createdAt},
|
||||
updated_at = #{updatedAt},
|
||||
mentioned_user_id = #{mentionedUserId},
|
||||
image_urls = #{imageUrls},
|
||||
video_url = #{videoUrl}
|
||||
WHERE comment_id = #{commentId}
|
||||
</update>
|
||||
|
||||
<!-- 删除评论,实际上是将is_deleted字段设置为1 -->
|
||||
<update id="deleteComment">
|
||||
UPDATE comment
|
||||
SET is_deleted = 1, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE comment_id = #{commentId}
|
||||
</update>
|
||||
</mapper>
|
||||
16
community-8073/src/main/resources/mapper/CommunityMapper.xml
Normal file
16
community-8073/src/main/resources/mapper/CommunityMapper.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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.ivmiku.tutorial.mapper.CommunityMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ivmiku.tutorial.entity.Community">
|
||||
<id property="communityId" column="community_id" jdbcType="BIGINT"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="description" column="description" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
community_id,name,description
|
||||
</sql>
|
||||
</mapper>
|
||||
18
community-8073/src/main/resources/mapper/FavoriteMapper.xml
Normal file
18
community-8073/src/main/resources/mapper/FavoriteMapper.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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.ivmiku.tutorial.mapper.FavoriteMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ivmiku.tutorial.entity.Favorite">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="userOpenid" column="user_openid" jdbcType="VARCHAR"/>
|
||||
<result property="postId" column="post_id" jdbcType="BIGINT"/>
|
||||
<result property="isDeleted" column="is_deleted" jdbcType="TINYINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_openid,post_id,
|
||||
is_deleted
|
||||
</sql>
|
||||
</mapper>
|
||||
19
community-8073/src/main/resources/mapper/LikeMapper.xml
Normal file
19
community-8073/src/main/resources/mapper/LikeMapper.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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.ivmiku.tutorial.mapper.LikeMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ivmiku.tutorial.entity.Likee">
|
||||
<id property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="userOpenid" column="user_openid" jdbcType="VARCHAR"/>
|
||||
<result property="postId" column="post_id" jdbcType="BIGINT"/>
|
||||
<result property="commentId" column="comment_id" jdbcType="BIGINT"/>
|
||||
<result property="isDeleted" column="is_deleted" jdbcType="TINYINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_openid,post_id,
|
||||
comment_id,is_deleted
|
||||
</sql>
|
||||
</mapper>
|
||||
80
community-8073/src/main/resources/mapper/PostMapper.xml
Normal file
80
community-8073/src/main/resources/mapper/PostMapper.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<?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.ivmiku.tutorial.mapper.PostMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ivmiku.tutorial.entity.Post">
|
||||
<id property="postId" column="post_id" jdbcType="BIGINT"/>
|
||||
<result property="userOpenid" column="user_openid" jdbcType="VARCHAR"/>
|
||||
<result property="communityId" column="community_id" jdbcType="BIGINT"/>
|
||||
<result property="title" column="title" jdbcType="VARCHAR"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="videoUrl" column="video_url" jdbcType="VARCHAR"/> <!-- 新增字段 -->
|
||||
<result property="imageUrls" column="image_urls" jdbcType="VARCHAR"/> <!-- 新增字段 -->
|
||||
<result property="isDeleted" column="is_deleted" jdbcType="TINYINT"/>
|
||||
<result property="isOfficial" column="is_official" jdbcType="TINYINT"/> <!-- 新增字段 -->
|
||||
<result property="createdAt" column="created_at" jdbcType="TIMESTAMP"/>
|
||||
<result property="updatedAt" column="updated_at" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
post_id, user_openid, community_id, title, content,
|
||||
video_url, image_urls, <!-- 新增字段 -->
|
||||
is_deleted, is_official, created_at, updated_at
|
||||
</sql>
|
||||
|
||||
<!-- 查询指定帖子的所有评论 -->
|
||||
<select id="selectCommentsByPostId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM post
|
||||
WHERE post_id = #{postId} AND is_deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 插入新的帖子 -->
|
||||
<insert id="insertPost" parameterType="com.ivmiku.tutorial.entity.Post">
|
||||
INSERT INTO post (
|
||||
post_id, user_openid, community_id, title, content,
|
||||
video_url, image_urls, <!-- 新增字段 -->
|
||||
is_deleted, is_official, created_at, updated_at
|
||||
) VALUES (
|
||||
#{postId}, #{userOpenid}, #{communityId}, #{title}, #{content},
|
||||
#{videoUrl}, #{imageUrls}, <!-- 新增字段 -->
|
||||
#{isDeleted}, #{isOfficial}, #{createdAt}, #{updatedAt}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新帖子 -->
|
||||
<update id="updatePost" parameterType="com.ivmiku.tutorial.entity.Post">
|
||||
UPDATE post
|
||||
SET
|
||||
user_openid = #{userOpenid},
|
||||
community_id = #{communityId},
|
||||
title = #{title},
|
||||
content = #{content},
|
||||
video_url = #{videoUrl}, <!-- 新增字段 -->
|
||||
image_urls = #{imageUrls}, <!-- 新增字段 -->
|
||||
is_deleted = #{isDeleted},
|
||||
is_official = #{isOfficial},
|
||||
created_at = #{createdAt},
|
||||
updated_at = #{updatedAt}
|
||||
WHERE post_id = #{postId}
|
||||
</update>
|
||||
|
||||
<!-- 删除帖子,实际上是将is_deleted字段设置为1 -->
|
||||
<update id="deletePost">
|
||||
UPDATE post
|
||||
SET is_deleted = 1, updated_at = CURRENT_TIMESTAMP
|
||||
WHERE post_id = #{postId}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getTagPostList" resultType="com.ivmiku.tutorial.entity.Post">
|
||||
SELECT p.post_id, p.user_openid, p.community_id, p.title, p.content,
|
||||
p.is_deleted, p.is_official, p.created_at, p.updated_at
|
||||
FROM post p, posttag pt, tag t
|
||||
WHERE p.post_id = pt.post_id AND pt.tag_id = t.tag_id AND t.tag_id = #{tagId} AND p.is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
17
community-8073/src/main/resources/mapper/PostTagMapper.xml
Normal file
17
community-8073/src/main/resources/mapper/PostTagMapper.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?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.ivmiku.tutorial.mapper.PostTagMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ivmiku.tutorial.entity.PostTag">
|
||||
<id property="postTagId" column="post_tag_id" jdbcType="BIGINT"/>
|
||||
<result property="postId" column="post_id" jdbcType="BIGINT"/>
|
||||
<result property="tagId" column="tag_id" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
post_tag_id,post_id,tag_id
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
22
community-8073/src/main/resources/mapper/TagMapper.xml
Normal file
22
community-8073/src/main/resources/mapper/TagMapper.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?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.ivmiku.tutorial.mapper.TagMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ivmiku.tutorial.entity.Tag">
|
||||
<id property="tagId" column="tag_id" jdbcType="BIGINT"/>
|
||||
<result property="name" column="name" jdbcType="VARCHAR"/>
|
||||
<result property="isOfficial" column="is_official" jdbcType="TINYINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
tag_id,name
|
||||
</sql>
|
||||
<select id="getPostTagList" resultType="com.ivmiku.tutorial.entity.Tag">
|
||||
SELECT t.`name`, t.tag_id, t.is_official
|
||||
FROM `tag` t, `posttag` pt, `post` p
|
||||
WHERE t.tag_id = pt.tag_id AND p.post_id = pt.post_id AND pt.post_id = #{postId} AND p.is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?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.ivmiku.tutorial.mapper.UsercommunityMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ivmiku.tutorial.entity.Usercommunity">
|
||||
<id property="userCommunityId" column="user_community_id" jdbcType="BIGINT"/>
|
||||
<result property="userOpenid" column="user_openid" jdbcType="VARCHAR"/>
|
||||
<result property="communityId" column="community_id" jdbcType="BIGINT"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
user_community_id,user_openid,community_id
|
||||
</sql>
|
||||
<select id="getCommunityList" resultType="com.ivmiku.tutorial.entity.Community">
|
||||
SELECT c.community_id, c.description, c.name
|
||||
FROM `community` c, `usercommunity` uc
|
||||
WHERE uc.community_id = c.community_id AND user_openid = #{user_openid}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user