From 57c673aa3e83677bcf5d30b4b45d06bae6609db8 Mon Sep 17 00:00:00 2001
From: liusuyi <1951119284@qq.com>
Date: 星期四, 08 八月 2024 16:14:40 +0800
Subject: [PATCH] 优化:获取会话

---
 ard-work/src/main/resources/mapper/call/ArdCallSessionUserMapper.xml |   30 ++++++++++++++++++++++++++----
 1 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/ard-work/src/main/resources/mapper/call/ArdCallSessionUserMapper.xml b/ard-work/src/main/resources/mapper/call/ArdCallSessionUserMapper.xml
index 01cde9a..4e995c9 100644
--- a/ard-work/src/main/resources/mapper/call/ArdCallSessionUserMapper.xml
+++ b/ard-work/src/main/resources/mapper/call/ArdCallSessionUserMapper.xml
@@ -9,29 +9,51 @@
         <result property="sessionId" column="session_id"/>
         <result property="type" column="type"/>
         <result property="userId" column="user_id"/>
+        <result property="nickName" column="nick_name"/>
+        <result property="avatar" column="avatar"/>
         <result property="targetId" column="target_id"/>
+        <result property="targetNickName" column="target_nick_name"/>
+        <result property="targetAvatar" column="target_avatar"/>
     </resultMap>
 
     <sql id="selectArdCallSessionUserVo">
         select id, session_id, type, user_id,target_id
         from ard_call_session_user
     </sql>
-
+    <sql id="selectArdCallSessionUserVo1">
+        SELECT
+            acsu.ID,
+            acsu.session_id,
+            acsu.TYPE,
+            acsu.user_id,
+            acsu.target_id,
+            u.nick_name,
+            u.avatar,
+            u1.nick_name AS target_nick_name,
+            u1.avatar AS target_avatar
+        FROM
+            ard_call_session_user acsu
+                LEFT JOIN sys_user u ON u.user_id = acsu.user_id
+                LEFT JOIN sys_user u1 ON u1.user_id = acsu.target_id
+    </sql>
     <select id="selectArdCallSessionUserList" parameterType="ArdCallSessionUser" resultMap="ArdCallSessionUserResult">
-        <include refid="selectArdCallSessionUserVo"/>
+        <include refid="selectArdCallSessionUserVo1"/>
         <where>
             <if test="sessionId != null  and sessionId != ''">and session_id = #{sessionId}</if>
             <if test="type != null  and type != ''">and type = #{type}</if>
-            <if test="userId != null  and userId != ''">and user_id = #{userId}</if>
+            <if test="userId != null  and userId != ''">and acsu.user_id = #{userId}</if>
             <if test="targetId != null  and targetId != ''">and target_id = #{targetId}</if>
         </where>
     </select>
 
+    <select id="selectArdCallSessionUserBySesionId" parameterType="String" resultMap="ArdCallSessionUserResult">
+        <include refid="selectArdCallSessionUserVo1"/>
+        where session_id = #{sessionId} and acsu.user_id = #{userId}
+    </select>
     <select id="selectArdCallSessionUserById" parameterType="String" resultMap="ArdCallSessionUserResult">
         <include refid="selectArdCallSessionUserVo"/>
         where id = #{id}
     </select>
-
     <insert id="insertArdCallSessionUser" parameterType="ArdCallSessionUser">
         insert into ard_call_session_user
         <trim prefix="(" suffix=")" suffixOverrides=",">

--
Gitblit v1.9.3