From 9a6551aebd6b523439beda5c642371998c5289f6 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期三, 30 九月 2026 09:57:53 +0800
Subject: [PATCH] 门店手机号展示问题
---
cloud-server-management/src/main/resources/mapper/TStoreMapper.xml | 36 +++++++++++++++++++++---------------
1 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
index b307188..8a865a8 100644
--- a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
+++ b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
@@ -36,12 +36,14 @@
<select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
select t1.*,
- t2.name as userName,
- coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone,
- coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone,
+ coalesce(t2.name, t4.name) as userName,
+ coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as phone,
+ coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as userPhone,
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 !=''">
@@ -51,10 +53,10 @@
and t1.cityCode = #{cityCode}
</if>
<if test="name !=null and name !=''">
- and t2.name like concat("%",#{name},"%")
+ and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
</if>
<if test="phone !=null and phone !=''">
- and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
+ and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
</if>
<if test="shopName !=null and shopName !=''">
and t1.name like concat("%",#{shopName},"%")
@@ -182,12 +184,14 @@
</select>
<select id="listAllStore" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
select t1.*,
- t2.name as userName,
- coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone,
- coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone,
+ coalesce(t2.name, t4.name) as userName,
+ coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as phone,
+ coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as userPhone,
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 !=''">
@@ -197,10 +201,10 @@
and t1.cityCode = #{cityCode}
</if>
<if test="name !=null and name !=''">
- and t2.name like concat("%",#{name},"%")
+ and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
</if>
<if test="phone !=null and phone !=''">
- and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
+ and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
</if>
<if test="shopName !=null and shopName !=''">
and t1.name like concat("%",#{shopName},"%")
@@ -209,12 +213,14 @@
</select>
<select id="listAllStoresByIds" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
select t1.*,
- t2.name as userName,
- coalesce(nullif(t1.phone, ''), nullif(t2.phone, ''), nullif(t2.account, ''), '') as phone,
- coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, ''), '') as userPhone,
+ coalesce(t2.name, t4.name) as userName,
+ coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as phone,
+ coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, ''), '') as userPhone,
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=")">
@@ -227,10 +233,10 @@
and t1.cityCode = #{cityCode}
</if>
<if test="name !=null and name !=''">
- and t2.name like concat("%",#{name},"%")
+ and coalesce(t2.name, t4.name) like concat("%",#{name},"%")
</if>
<if test="phone !=null and phone !=''">
- and coalesce(nullif(t2.phone, ''), nullif(t2.account, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
+ and coalesce(nullif(t2.phone, ''), nullif(t4.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
</if>
<if test="shopName !=null and shopName !=''">
and t1.name like concat("%",#{shopName},"%")
--
Gitblit v1.7.1