From 9bcbf4398202139b31de1df6599e362915f15682 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期二, 22 九月 2026 10:05:21 +0800
Subject: [PATCH] bug:数据返回问题
---
cloud-server-management/src/main/resources/mapper/TStoreMapper.xml | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
index 423ef7d..7ebf93d 100644
--- a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
+++ b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
@@ -35,7 +35,11 @@
</delete>
<select id="listAll" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
- select t1.*,t2.name userName,t2.phone userPhone,t3.name yysName
+ select t1.*,
+ t2.name as userName,
+ coalesce(nullif(t1.phone, ''), nullif(t2.phone, '')) as phone,
+ coalesce(nullif(t2.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 t_operator t3 on t1.operatorId = t3.id
@@ -50,7 +54,7 @@
and t2.name like concat("%",#{name},"%")
</if>
<if test="phone !=null and phone !=''">
- and t2.phone like concat("%",#{phone},"%")
+ and coalesce(nullif(t2.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
</if>
<if test="shopName !=null and shopName !=''">
and t1.name like concat("%",#{shopName},"%")
@@ -177,7 +181,14 @@
</select>
<select id="listAllStore" resultType="com.dsh.guns.modular.system.model.TStoreListVo">
- select t1.*,t2.name userName,t2.phone userPhone,t3.name yysName from t_store t1 left join sys_user t2 on t1.storeStaffId = t2.id left join t_operator t3 on t1.operatorId = t3.id
+ select t1.*,
+ t2.name as userName,
+ coalesce(nullif(t1.phone, ''), nullif(t2.phone, '')) as phone,
+ coalesce(nullif(t2.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 t_operator t3 on t1.operatorId = t3.id
where t1.id =#{id}
<if test="provinceCode !=null and provinceCode !=''">
and t1.provinceCode = #{provinceCode}
@@ -189,7 +200,7 @@
and t2.name like concat("%",#{name},"%")
</if>
<if test="phone !=null and phone !=''">
- and t2.phone like concat("%",#{phone},"%")
+ and coalesce(nullif(t2.phone, ''), nullif(t1.phone, '')) like concat("%",#{phone},"%")
</if>
<if test="shopName !=null and shopName !=''">
and t1.name like concat("%",#{shopName},"%")
--
Gitblit v1.7.1