Просмотр исходного кода

微信会话内容存储获取优化,下载暂时关闭

anderx месяцев назад: 6
Родитель
Сommit
e6700873ee

+ 2 - 1
src/main/java/com/kede/common/dao/ChatMsgMapper.java

@@ -10,7 +10,7 @@ import java.util.List;
  * 微信会话存储(ChatMsg)表数据库访问层
  * 微信会话存储(ChatMsg)表数据库访问层
  *
  *
  * @author makejava
  * @author makejava
- * @since 2025-06-17 15:24:54
+ * @since 2025-06-19 13:41:48
  */
  */
 public interface ChatMsgMapper {
 public interface ChatMsgMapper {
 
 
@@ -27,6 +27,7 @@ public interface ChatMsgMapper {
      * 查询指定行数据
      * 查询指定行数据
      *
      *
      * @param chatMsg  查询条件
      * @param chatMsg  查询条件
+     * @param pageable 分页对象
      * @return 对象列表
      * @return 对象列表
      */
      */
     List<ChatMsg> findChatMsgList(ChatMsg chatMsg);
     List<ChatMsg> findChatMsgList(ChatMsg chatMsg);

+ 18 - 7
src/main/java/com/kede/common/mapper/ChatMsgMapper.xml

@@ -15,12 +15,13 @@
         <result property="roomName" column="room_name" jdbcType="VARCHAR"/>
         <result property="roomName" column="room_name" jdbcType="VARCHAR"/>
         <result property="msgtime" column="msgtime" jdbcType="TIMESTAMP"/>
         <result property="msgtime" column="msgtime" jdbcType="TIMESTAMP"/>
         <result property="msgtype" column="msgtype" jdbcType="VARCHAR"/>
         <result property="msgtype" column="msgtype" jdbcType="VARCHAR"/>
+        <result property="msgurl" column="msgurl" jdbcType="VARCHAR"/>
         <result property="content" column="content" jdbcType="VARCHAR"/>
         <result property="content" column="content" jdbcType="VARCHAR"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
         <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
     </resultMap>
     </resultMap>
 
 
     <sql id="ChatMsgAllSql">
     <sql id="ChatMsgAllSql">
-        id, msgid, action_type, from_id, from_name, tolist, tolist_name, roomid, type, room_name, msgtime, msgtype, content, create_time
+        id, msgid, action_type, from_id, from_name, tolist, tolist_name, roomid, type, room_name, msgtime, msgtype, msgurl, content, create_time
     </sql>
     </sql>
 
 
     <!--查询单个-->
     <!--查询单个-->
@@ -34,30 +35,30 @@
     <!--新增所有列-->
     <!--新增所有列-->
     <insert id="insert" keyProperty="id" useGeneratedKeys="true">
     <insert id="insert" keyProperty="id" useGeneratedKeys="true">
         insert into chat_msg(msgid, action_type, from_id, from_name, tolist, tolist_name, roomid, type, room_name,
         insert into chat_msg(msgid, action_type, from_id, from_name, tolist, tolist_name, roomid, type, room_name,
-                             msgtime, msgtype, content, create_time)
+                             msgtime, msgtype, msgurl, content, create_time)
         values (#{msgid}, #{actionType}, #{fromId}, #{fromName}, #{tolist}, #{tolistName}, #{roomid}, #{type},
         values (#{msgid}, #{actionType}, #{fromId}, #{fromName}, #{tolist}, #{tolistName}, #{roomid}, #{type},
-                #{roomName}, #{msgtime}, #{msgtype}, #{content}, #{createTime})
+                #{roomName}, #{msgtime}, #{msgtype}, #{msgurl}, #{content}, #{createTime})
     </insert>
     </insert>
 
 
     <insert id="insertBatch">
     <insert id="insertBatch">
         insert into chat_msg(msgid, action_type, from_id, from_name, tolist, tolist_name, roomid, type, room_name,
         insert into chat_msg(msgid, action_type, from_id, from_name, tolist, tolist_name, roomid, type, room_name,
-        msgtime, msgtype, content, create_time)
+        msgtime, msgtype, msgurl, content, create_time)
         values
         values
         <foreach collection="entities" item="entity" separator=",">
         <foreach collection="entities" item="entity" separator=",">
             (#{entity.msgid}, #{entity.actionType}, #{entity.fromId}, #{entity.fromName}, #{entity.tolist},
             (#{entity.msgid}, #{entity.actionType}, #{entity.fromId}, #{entity.fromName}, #{entity.tolist},
             #{entity.tolistName}, #{entity.roomid}, #{entity.type}, #{entity.roomName}, #{entity.msgtime},
             #{entity.tolistName}, #{entity.roomid}, #{entity.type}, #{entity.roomName}, #{entity.msgtime},
-            #{entity.msgtype}, #{entity.content}, #{entity.createTime})
+            #{entity.msgtype}, #{entity.msgurl}, #{entity.content}, #{entity.createTime})
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 
     <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
     <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
         insert into chat_msg(msgid, action_type, from_id, from_name, tolist, tolist_name, roomid, type, room_name,
         insert into chat_msg(msgid, action_type, from_id, from_name, tolist, tolist_name, roomid, type, room_name,
-        msgtime, msgtype, content, create_time)
+        msgtime, msgtype, msgurl, content, create_time)
         values
         values
         <foreach collection="entities" item="entity" separator=",">
         <foreach collection="entities" item="entity" separator=",">
             (#{entity.msgid}, #{entity.actionType}, #{entity.fromId}, #{entity.fromName}, #{entity.tolist},
             (#{entity.msgid}, #{entity.actionType}, #{entity.fromId}, #{entity.fromName}, #{entity.tolist},
             #{entity.tolistName}, #{entity.roomid}, #{entity.type}, #{entity.roomName}, #{entity.msgtime},
             #{entity.tolistName}, #{entity.roomid}, #{entity.type}, #{entity.roomName}, #{entity.msgtime},
-            #{entity.msgtype}, #{entity.content}, #{entity.createTime})
+            #{entity.msgtype}, #{entity.msgurl}, #{entity.content}, #{entity.createTime})
         </foreach>
         </foreach>
         on duplicate key update
         on duplicate key update
         msgid = values(msgid),
         msgid = values(msgid),
@@ -71,6 +72,7 @@
         room_name = values(room_name),
         room_name = values(room_name),
         msgtime = values(msgtime),
         msgtime = values(msgtime),
         msgtype = values(msgtype),
         msgtype = values(msgtype),
+        msgurl = values(msgurl),
         content = values(content),
         content = values(content),
         create_time = values(create_time)
         create_time = values(create_time)
     </insert>
     </insert>
@@ -112,6 +114,9 @@
             <if test="msgtype != null and msgtype != ''">
             <if test="msgtype != null and msgtype != ''">
                 msgtype = #{msgtype},
                 msgtype = #{msgtype},
             </if>
             </if>
+            <if test="msgurl != null and msgurl != ''">
+                msgurl = #{msgurl},
+            </if>
             <if test="content != null and content != ''">
             <if test="content != null and content != ''">
                 content = #{content},
                 content = #{content},
             </if>
             </if>
@@ -165,6 +170,9 @@
             <if test="msgtype != null and msgtype != ''">
             <if test="msgtype != null and msgtype != ''">
                 and msgtype = #{msgtype}
                 and msgtype = #{msgtype}
             </if>
             </if>
+            <if test="msgurl != null and msgurl != ''">
+                and msgurl = #{msgurl}
+            </if>
             <if test="content != null and content != ''">
             <if test="content != null and content != ''">
                 and content = #{content}
                 and content = #{content}
             </if>
             </if>
@@ -218,6 +226,9 @@
             <if test="msgtype != null and msgtype != ''">
             <if test="msgtype != null and msgtype != ''">
                 and msgtype = #{msgtype}
                 and msgtype = #{msgtype}
             </if>
             </if>
+            <if test="msgurl != null and msgurl != ''">
+                and msgurl = #{msgurl}
+            </if>
             <if test="content != null and content != ''">
             <if test="content != null and content != ''">
                 and content = #{content}
                 and content = #{content}
             </if>
             </if>

+ 14 - 2
src/main/java/com/kede/common/model/ChatMsg.java

@@ -8,10 +8,10 @@ import java.io.Serializable;
  * 微信会话存储(ChatMsg)实体类
  * 微信会话存储(ChatMsg)实体类
  *
  *
  * @author makejava
  * @author makejava
- * @since 2025-06-17 15:24:54
+ * @since 2025-06-19 13:41:48
  */
  */
 public class ChatMsg implements Serializable {
 public class ChatMsg implements Serializable {
-    private static final long serialVersionUID = -17396877038535264L;
+    private static final long serialVersionUID = -10467475213285200L;
 
 
     private Integer id;
     private Integer id;
     /**
     /**
@@ -59,6 +59,10 @@ public class ChatMsg implements Serializable {
      */
      */
     private String msgtype;
     private String msgtype;
     /**
     /**
+     * 文件消息地址
+     */
+    private String msgurl;
+    /**
      * 消息内容
      * 消息内容
      */
      */
     private String content;
     private String content;
@@ -164,6 +168,14 @@ public class ChatMsg implements Serializable {
         this.msgtype = msgtype;
         this.msgtype = msgtype;
     }
     }
 
 
+    public String getMsgurl() {
+        return msgurl;
+    }
+
+    public void setMsgurl(String msgurl) {
+        this.msgurl = msgurl;
+    }
+
     public String getContent() {
     public String getContent() {
         return content;
         return content;
     }
     }