From c44f7ba4e41961c3c60e5f619f6a6dda042fadd9 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期五, 17 一月 2025 20:06:14 +0800
Subject: [PATCH] 12.18

---
 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AgentApplicationMapper.xml |   56 ++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 42 insertions(+), 14 deletions(-)

diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AgentApplicationMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AgentApplicationMapper.xml
index b0f8709..2e2081e 100644
--- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AgentApplicationMapper.xml
+++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AgentApplicationMapper.xml
@@ -24,31 +24,59 @@
         id, app_user_id, application_vip_id, application_time, status, shop_point, share_point, direct_vip_num, direct_agent_num, bind_shop_num, remark, del_flag, create_time
     </sql>
     <select id="pageList" resultType="com.ruoyi.account.api.model.AgentApplication">
-        select
+        SELECT
+        *
+        FROM
+        (
+        SELECT
         t1.*,
-        t1.id as idStr,
-        t2.name as userName,
-        t2.phone as userPhone
-        from t_agent_application t1
-        left join t_app_user t2 on t1.app_user_id = t2.id
+        t1.id AS idStr,
+        t2.NAME AS userName,
+        t2.phone AS userPhone,
+        1 AS sort_order
+        FROM
+        t_agent_application t1
+        LEFT JOIN t_app_user t2 ON t1.app_user_id = t2.id
+        WHERE
+        t1.`status` = 1 UNION ALL
+        SELECT
+        t1.*,
+        t1.id AS idStr,
+        t2.NAME AS userName,
+        t2.phone AS userPhone,
+        2 AS sort_order
+        FROM
+        t_agent_application t1
+        LEFT JOIN t_app_user t2 ON t1.app_user_id = t2.id
+        WHERE
+        t1.`status` != 1
+        ) AS combined_results
         <where>
             <if test="agentQuery.name !=null and agentQuery.name !=''">
-                and t2.name like concat('%',#{agentQuery.name},'%')
+                and userName like concat('%',#{agentQuery.name},'%')
             </if>
             <if test="agentQuery.phone !=null and agentQuery.phone !=''">
-                and t2.phone like concat('%',#{agentQuery.phone},'%')
+                and userPhone like concat('%',#{agentQuery.phone},'%')
             </if>
             <if test="agentQuery.vipId !=null">
-                and t2.vip_id = #{agentQuery.vipId}
+                and vip_id = #{agentQuery.vipId}
             </if>
             <if test="agentQuery.status !=null">
-                and t1.status = #{agentQuery.status}
+                and status = #{agentQuery.status}
             </if>
         </where>
-        order by
-        t1.STATUS ASC,
-        t1.application_time ASC,
-        t1.create_time desc
+        ORDER BY
+        sort_order,
+        CASE
+
+        WHEN sort_order = 1 THEN
+        application_time ELSE NULL
+        END ASC,
+        CASE
+
+        WHEN sort_order = 2 THEN
+        application_time ELSE NULL
+        END DESC
     </select>
 
 </mapper>

--
Gitblit v1.7.1