From 70a29ae28b85643e00a4b7fbf111a95646a24dc2 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Wed, 20 Mar 2024 17:20:38 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/springblade/modules/discuss/mapper/UserTopicsMapper.xml |   72 ++++++++++++++++++++++++++++++++++-
 1 files changed, 69 insertions(+), 3 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 a1510be..b31641d 100644
--- a/src/main/java/org/springblade/modules/discuss/mapper/UserTopicsMapper.xml
+++ b/src/main/java/org/springblade/modules/discuss/mapper/UserTopicsMapper.xml
@@ -39,12 +39,15 @@
         bu.`name`,
         bu.phone,
         jda.address_name,
-        jda.aoi_name
+        jda.aoi_name,
+        jt.option_content
         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.house_code = jut.house_code
+        AND jh.is_deleted = 0 and jut.user_id =jh.associated_user_id
         LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
+        LEFT JOIN jczz_topics jt on jt.id = jut.topics_id
         <where>
             <if test="userTopics.id != null ">and jut.id = #{userTopics.id}</if>
             <if test="userTopics.name != null and userTopics.name != ''">
@@ -53,6 +56,14 @@
             <if test="userTopics.phone != null and userTopics.phone != ''">
                 and bu.phone like concat('%',#{userTopics.phone},'%')
             </if>
+
+            <if test="userTopics.aoiCodeList != null and userTopics.aoiCodeList.size() > 0">
+                and jda.aoi_code in
+                <foreach collection="userTopics.aoiCodeList" item="code" open="(" close=")" separator=",">
+                    #{code}
+                </foreach>
+            </if>
+
             <if test="userTopics.userId != null ">and jut.user_id = #{userTopics.userId}</if>
             <if test="userTopics.topicsId != null ">and jut.topics_id = #{userTopics.topicsId}</if>
             <if test="userTopics.createTime != null ">and jut.create_time = #{userTopics.createTime}</if>
@@ -65,7 +76,8 @@
                 bu.`name`,
                 bu.phone,
                 jda.address_name,
-                jda.aoi_name
+                jda.aoi_name,
+                jt.option_content
             </if>
         </where>
     </select>
@@ -85,4 +97,58 @@
     </select>
 
 
+    <select id="exportUser" resultType="org.springblade.modules.discuss.excel.UserTopicsExcel">
+        SELECT distinct
+        jut.article_id,
+        jut.delete_flag,
+        jut.signature_path,
+        jut.create_time,
+        bu.avatar,
+        bu.`name`,
+        bu.phone,
+        jda.address_name,
+        jda.aoi_name,
+        jt.option_content
+        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_doorplate_address jda ON jda.address_code = jh.house_code
+        LEFT JOIN jczz_topics jt on jt.id = jut.topics_id
+        <where>
+            <if test="id != null ">and jut.id = #{id}</if>
+            <if test="name != null and name != ''">
+                and bu.name like concat('%',#{name},'%')
+            </if>
+            <if test="phone != null and phone != ''">
+                and bu.phone like concat('%',#{phone},'%')
+            </if>
+
+            <if test="aoiCodeList != null and aoiCodeList.size() > 0">
+                and jda.aoi_code in
+                <foreach collection="aoiCodeList" item="code" open="(" close=")" separator=",">
+                    #{code}
+                </foreach>
+            </if>
+
+            <if test="userId != null ">and jut.user_id = #{userId}</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}
+                and jut.delete_flag = 0
+                GROUP BY jut.article_id, jut.signature_path,jut.create_time,jut.delete_flag,
+                bu.avatar,
+                bu.`name`,
+                bu.phone,
+                jda.address_name,
+                jda.aoi_name,
+                jt.option_content
+            </if>
+        </where>
+
+    </select>
+
+
 </mapper>

--
Gitblit v1.9.3