lzy 3 weeks ago
parent
commit
4061470dab

+ 2 - 0
src/main/java/com/zhentao/intercepoter/Userinterceptor.java

@@ -18,6 +18,8 @@ public class Userinterceptor implements HandlerInterceptor {
     @Override
     @Override
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
         String token = request.getHeader("token");
         String token = request.getHeader("token");
+        String userIdFromToken1 = TokenUtils.getUserIdFromToken(token);
+        redisTemplate.opsForValue().set("uid",userIdFromToken1);
         HandlerMethod handlerMethod = (HandlerMethod) handler;
         HandlerMethod handlerMethod = (HandlerMethod) handler;
         NullLogin annotation = handlerMethod.getMethod().getAnnotation(NullLogin.class);
         NullLogin annotation = handlerMethod.getMethod().getAnnotation(NullLogin.class);
         System.err.println("自定义注解"+annotation);
         System.err.println("自定义注解"+annotation);

+ 106 - 0
src/main/java/com/zhentao/user/domain/UserShouye.java

@@ -0,0 +1,106 @@
+package com.zhentao.user.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+/**
+ * 用户首页表
+ * @TableName user_shouye
+ */
+@TableName(value ="user_shouye")
+@Data
+public class UserShouye implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId
+    @JsonFormat(shape = JsonFormat.Shape.STRING)
+    private Long id;
+
+    /**
+     * 用户1
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING)
+    private Long uid1;
+
+    /**
+     * 用户2
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING)
+    private Long uid2;
+
+    /**
+     * 群id
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING)
+    private Long gid;
+
+    /**
+     * 状态0 1
+     */
+    private Integer status;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        UserShouye other = (UserShouye) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getUid1() == null ? other.getUid1() == null : this.getUid1().equals(other.getUid1()))
+            && (this.getUid2() == null ? other.getUid2() == null : this.getUid2().equals(other.getUid2()))
+            && (this.getGid() == null ? other.getGid() == null : this.getGid().equals(other.getGid()))
+            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
+            && (this.getSort() == null ? other.getSort() == null : this.getSort().equals(other.getSort()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getUid1() == null) ? 0 : getUid1().hashCode());
+        result = prime * result + ((getUid2() == null) ? 0 : getUid2().hashCode());
+        result = prime * result + ((getGid() == null) ? 0 : getGid().hashCode());
+        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
+        result = prime * result + ((getSort() == null) ? 0 : getSort().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", uid1=").append(uid1);
+        sb.append(", uid2=").append(uid2);
+        sb.append(", gid=").append(gid);
+        sb.append(", status=").append(status);
+        sb.append(", sort=").append(sort);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 20 - 0
src/main/java/com/zhentao/user/mapper/UserShouyeMapper.java

@@ -0,0 +1,20 @@
+package com.zhentao.user.mapper;
+
+import com.zhentao.user.domain.UserShouye;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @author lzy
+* @description 针对表【user_shouye(用户首页表)】的数据库操作Mapper
+* @createDate 2025-06-05 19:11:47
+* @Entity com.zhentao.user.domain.UserShouye
+*/
+@Mapper
+public interface UserShouyeMapper extends BaseMapper<UserShouye> {
+
+}
+
+
+
+

+ 13 - 0
src/main/java/com/zhentao/user/service/UserShouyeService.java

@@ -0,0 +1,13 @@
+package com.zhentao.user.service;
+
+import com.zhentao.user.domain.UserShouye;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author lzy
+* @description 针对表【user_shouye(用户首页表)】的数据库操作Service
+* @createDate 2025-06-05 19:11:47
+*/
+public interface UserShouyeService extends IService<UserShouye> {
+
+}

+ 22 - 0
src/main/java/com/zhentao/user/service/impl/UserShouyeServiceImpl.java

@@ -0,0 +1,22 @@
+package com.zhentao.user.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zhentao.user.domain.UserShouye;
+import com.zhentao.user.service.UserShouyeService;
+import com.zhentao.user.mapper.UserShouyeMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author lzy
+* @description 针对表【user_shouye(用户首页表)】的数据库操作Service实现
+* @createDate 2025-06-05 19:11:47
+*/
+@Service
+public class UserShouyeServiceImpl extends ServiceImpl<UserShouyeMapper, UserShouye>
+    implements UserShouyeService{
+
+}
+
+
+
+

+ 2 - 2
src/main/resources/mapper/UserShouyeMapper.xml

@@ -2,9 +2,9 @@
 <!DOCTYPE mapper
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.zhentao.shouye.mapper.UserShouyeMapper">
+<mapper namespace="com.zhentao.user.mapper.UserShouyeMapper">
 
 
-    <resultMap id="BaseResultMap" type="com.zhentao.shouye.domain.UserShouye">
+    <resultMap id="BaseResultMap" type="com.zhentao.user.domain.UserShouye">
             <id property="id" column="id" jdbcType="BIGINT"/>
             <id property="id" column="id" jdbcType="BIGINT"/>
             <result property="uid1" column="uid1" jdbcType="BIGINT"/>
             <result property="uid1" column="uid1" jdbcType="BIGINT"/>
             <result property="uid2" column="uid2" jdbcType="BIGINT"/>
             <result property="uid2" column="uid2" jdbcType="BIGINT"/>