From 4e8cadb13ebd6f01b8cf6d5cc89757cf8e960792 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期三, 30 九月 2026 12:22:24 +0800
Subject: [PATCH] 门店管理修改

---
 cloud-server-management/src/main/resources/mapper/TStoreMapper.xml |   38 +++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
index b8560ff..e37ea7e 100644
--- a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
+++ b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
@@ -34,15 +34,19 @@
         delete from t_store_other_config where id =#{id}
     </delete>
 
-    <select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
+    <!--
+        phone 明确映射为 t_store.phone。不要同时返回两个名为 phone 的列,
+        否则 MyBatis 自动映射可能按 JDBC 列顺序覆盖该字段。
+    -->
+    <resultMap id="storeListResultMap" type="com.dsh.guns.modular.system.model.TStoreListVo" autoMapping="true">
+        <result property="phone" column="storePhone"/>
+    </resultMap>
+
+    <select id="listAll" resultMap="storeListResultMap">
         select t1.*,
-               coalesce(t2.name, t4.name) as userName,
-               coalesce(t1.phone, '') as phone,
+               t1.phone as storePhone,
                t3.name as yysName
         from t_store t1
-        left join sys_user t2 on t1.storeStaffId = t2.id
-        left join (select objectId, max(id) as id from sys_user where objectType = 3 and status != 3 group by objectId) t4_ref on t4_ref.objectId = t1.id
-        left join sys_user t4 on t4_ref.id = t4.id
         left  join t_operator t3 on t1.operatorId = t3.id
         where 1=1
         <if test="provinceCode !=null and provinceCode !=''">
@@ -52,7 +56,7 @@
             and t1.cityCode = #{cityCode}
         </if>
         <if test="name !=null and name !=''">
-            and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
+            and t1.managerName like concat("%",#{name},"%")
         </if>
         <if test="phone !=null and phone !=''">
             and t1.phone like concat("%",#{phone},"%")
@@ -181,15 +185,11 @@
 
 
     </select>
-    <select id="listAllStore" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
+    <select id="listAllStore" resultMap="storeListResultMap">
         select t1.*,
-               coalesce(t2.name, t4.name) as userName,
-               coalesce(t1.phone, '') as phone,
+               t1.phone as storePhone,
                t3.name as yysName
         from t_store t1
-        left join sys_user t2 on t1.storeStaffId = t2.id
-        left join (select objectId, max(id) as id from sys_user where objectType = 3 and status != 3 group by objectId) t4_ref on t4_ref.objectId = t1.id
-        left join sys_user t4 on t4_ref.id = t4.id
         left join t_operator t3 on t1.operatorId = t3.id
         where t1.id =#{id}
         <if test="provinceCode !=null and provinceCode !=''">
@@ -199,7 +199,7 @@
             and t1.cityCode = #{cityCode}
         </if>
         <if test="name !=null and name !=''">
-            and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
+            and t1.managerName like concat("%",#{name},"%")
         </if>
         <if test="phone !=null and phone !=''">
             and t1.phone like concat("%",#{phone},"%")
@@ -209,15 +209,11 @@
         </if>
         order by t1.id desc
     </select>
-    <select id="listAllStoresByIds" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
+    <select id="listAllStoresByIds" resultMap="storeListResultMap">
         select t1.*,
-               coalesce(t2.name, t4.name) as userName,
-               coalesce(t1.phone, '') as phone,
+               t1.phone as storePhone,
                t3.name as yysName
         from t_store t1
-        left join sys_user t2 on t1.storeStaffId = t2.id
-        left join (select objectId, max(id) as id from sys_user where objectType = 3 and status != 3 group by objectId) t4_ref on t4_ref.objectId = t1.id
-        left join sys_user t4 on t4_ref.id = t4.id
         left join t_operator t3 on t1.operatorId = t3.id
         where t1.id in
         <foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -230,7 +226,7 @@
             and t1.cityCode = #{cityCode}
         </if>
         <if test="name !=null and name !=''">
-            and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
+            and t1.managerName like concat("%",#{name},"%")
         </if>
         <if test="phone !=null and phone !=''">
             and t1.phone like concat("%",#{phone},"%")

--
Gitblit v1.7.1