From 4a40448d0e7f92eb8b8579ac57c65d6359266b89 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Thu, 28 Mar 2024 10:23:10 +0800
Subject: [PATCH] 导出bug修复

---
 src/main/java/org/springblade/modules/discuss/mapper/UserTopicsMapper.xml |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/springblade/modules/discuss/mapper/UserTopicsMapper.xml b/src/main/java/org/springblade/modules/discuss/mapper/UserTopicsMapper.xml
index 73530a1..a14cf9a 100644
--- a/src/main/java/org/springblade/modules/discuss/mapper/UserTopicsMapper.xml
+++ b/src/main/java/org/springblade/modules/discuss/mapper/UserTopicsMapper.xml
@@ -5,7 +5,7 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="userTopicsResultMap" type="org.springblade.modules.discuss.vo.UserTopicsVO">
         <result property="id" column="id"/>
-        <result property="userId" column="user_id"/>
+        <result property="householdId" column="household_id"/>
         <result property="topicsId" column="topics_id"/>
         <result property="createTime" column="create_time"/>
         <result property="updateTime" column="update_time"/>
@@ -17,7 +17,7 @@
     <sql id="selectUserTopics">
         select
             id,
-            user_id,
+            household_id,
             topics_id,
             create_time,
             update_time,
@@ -99,23 +99,25 @@
 
 
     <select id="exportUser" resultType="org.springblade.modules.discuss.excel.UserTopicsExcel">
-        SELECT distinct
+        SELECT
         jut.article_id,
         jut.delete_flag,
         jut.signature_path,
         jut.create_time,
+        jut.household_id,
         bu.avatar,
-        bu.`name`,
-        bu.phone,
+        jh.name,
+        jh.phone_number phone,
         jda.address_name,
-        jda.aoi_name,
-        jt.option_content
+        jda.aoi_name
+        <if test="articleId != null ">,
+            group_concat(jt.option_content) optionContent  </if>
         FROM
         jczz_user_topics as jut
-        LEFT JOIN blade_user bu ON jut.user_id = bu.id AND bu.is_deleted = 0
-        LEFT JOIN jczz_household jh ON jh.associated_user_id = jut.user_id AND jh.is_deleted = 0
+        LEFT JOIN jczz_household jh ON jh.id = jut.household_id and jh.is_deleted = 0
         LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
         LEFT JOIN jczz_topics jt on jt.id = jut.topics_id
+        LEFT JOIN blade_user bu ON jh.associated_user_id = bu.id AND bu.is_deleted = 0
         <where>
             <if test="id != null ">and jut.id = #{id}</if>
             <if test="name != null and name != ''">
@@ -132,20 +134,20 @@
                 </foreach>
             </if>
 
-            <if test="userId != null ">and jut.user_id = #{userId}</if>
+            <if test="householdId != null ">and jut.household_id = #{householdId}</if>
             <if test="topicsId != null ">and jut.topics_id = #{topicsId}</if>
             <if test="createTime != null ">and jut.create_time = #{createTime}</if>
             <if test="updateTime != null ">and jut.update_time = #{updateTime}</if>
             <if test="deleteFlag != null ">and jut.delete_flag = #{deleteFlag}</if>
-            <if test="articleId != null ">and jut.article_id = #{articleId}
+            <if test="articleId != null ">
+                and jut.article_id = #{articleId}
                 and jut.delete_flag = 0
-                GROUP BY jut.article_id, jut.signature_path,jut.create_time,jut.delete_flag,
+                GROUP BY jut.article_id, jut.signature_path,jut.create_time,jut.household_id,jut.delete_flag,
                 bu.avatar,
-                bu.`name`,
-                bu.phone,
+                jh.name,
+                jh.phone_number,
                 jda.address_name,
-                jda.aoi_name,
-                jt.option_content
+                jda.aoi_name
             </if>
         </where>
 

--
Gitblit v1.9.3