新增user服务和gateway服务

This commit is contained in:
jiangh277
2025-08-12 19:01:26 +08:00
parent 957462b60b
commit aa42f35254
29 changed files with 1047 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
spring.application.name=timeline.user
server.port=30003
# ?????
spring.datasource.url=jdbc:mysql://8.137.148.196:33306/timeline?serverTimezone=UTC&allowPublicKeyRetrieval=true
spring.datasource.username=root
spring.datasource.password=your_password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
# MyBatis ??
mybatis.mapper-locations=classpath:mapper/*.xml
mybatis.type-aliases-package=com.timeline.user.entity
mybatis.configuration.mapUnderscoreToCamelCase=true
# JWT ??
jwt.secret=timelineSecretKey
jwt.expiration=86400
# ????
logging.level.com.timeline.user=DEBUG

View File

@@ -0,0 +1,37 @@
<?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.timeline.user.dao.UserMapper">
<insert id="insert" parameterType="com.timeline.user.entity.User">
INSERT INTO user (user_id, username, password, nickname, email, phone, status, is_deleted, create_time, update_time)
VALUES (#{userId}, #{username}, #{password}, #{nickname}, #{email}, #{phone}, #{status}, #{isDeleted}, #{createTime}, #{updateTime})
</insert>
<select id="selectById" resultType="com.timeline.user.entity.User">
SELECT * FROM user WHERE id = #{id} AND is_deleted = 0
</select>
<select id="selectByUserId" resultType="com.timeline.user.entity.User">
SELECT * FROM user WHERE user_id = #{userId} AND is_deleted = 0
</select>
<select id="selectByUsername" resultType="com.timeline.user.entity.User">
SELECT * FROM user WHERE username = #{username} AND is_deleted = 0
</select>
<update id="update" parameterType="com.timeline.user.entity.User">
UPDATE user
SET username = #{username},
email = #{email},
phone = #{phone},
status = #{status},
update_time = #{updateTime}
WHERE user_id = #{userId} AND is_deleted = 0
</update>
<update id="deleteByUserId">
UPDATE user SET is_deleted = 1, update_time = NOW() WHERE user_id = #{userId}
</update>
</mapper>