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 | 196 ++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 177 insertions(+), 19 deletions(-)
diff --git a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
index 15fa840..e37ea7e 100644
--- a/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
+++ b/cloud-server-management/src/main/resources/mapper/TStoreMapper.xml
@@ -34,8 +34,20 @@
delete from t_store_other_config where id =#{id}
</delete>
- <select id="listAll" 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
+ <!--
+ 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.*,
+ t1.phone as storePhone,
+ t3.name as yysName
+ from t_store t1
+ left join t_operator t3 on t1.operatorId = t3.id
where 1=1
<if test="provinceCode !=null and provinceCode !=''">
and t1.provinceCode = #{provinceCode}
@@ -44,10 +56,10 @@
and t1.cityCode = #{cityCode}
</if>
<if test="name !=null and name !=''">
- and t2.name like concat("%",#{name},"%")
+ and t1.managerName like concat("%",#{name},"%")
</if>
<if test="phone !=null and phone !=''">
- and t2.phone like concat("%",#{phone},"%")
+ and t1.phone like concat("%",#{phone},"%")
</if>
<if test="shopName !=null and shopName !=''">
and t1.name like concat("%",#{shopName},"%")
@@ -55,10 +67,11 @@
<if test="operatorId !=null and operatorId !=''">
and t1.operatorId = #{operatorId}
</if>
+ order by t1.id desc
</select>
<select id="queryProvince" resultType="map">
select * from (
- select provinceCode as code, province as name from t_store where state = 1
+ select provinceCode as code, MIN(province) as name from t_store where state = 1
<if test="null != cityCode and '' != cityCode">
and cityCode = #{cityCode}
</if>
@@ -69,16 +82,34 @@
<select id="queryCity" resultType="map">
select * from (
- select cityCode as code, city as name from t_store where state = 1 and provinceCode = #{provinceCode}
+ select cityCode as code, MIN(city) as name from t_store where state = 1 and provinceCode = #{provinceCode}
<if test="null != cityCode and '' != cityCode">
and cityCode = #{cityCode}
</if>
group by cityCode
) as aa order by aa.code
</select>
+ <select id="queryCity2" resultType="map">
+
+ select * from (
+ select cityCode as code, MIN(city) as name
+ from t_store where state = 1 and provinceCode = #{provinceCode}
+ <if test="null != cityCode and '' != cityCode">
+ and cityCode = #{cityCode}
+ </if>
+ <if test="null != type">
+ and `type` = #{type}
+ </if>
+ <if test="null != operatorId">
+ and operatorId = #{operatorId}
+ </if>
+ group by cityCode
+ ) as aa order by aa.code
+ </select>
+
<select id="queryCity1" resultType="map">
select * from (
- select cityCode as code, city as name from t_store where state = 1
+ select cityCode as code, MIN(city) as name from t_store where state = 1
group by cityCode
) as aa order by aa.code
</select>
@@ -98,21 +129,22 @@
<if test="storeName != null and storeName != ''">
and `name` like CONCAT('%',#{storeName},'%')
</if>
+ order by id desc
</select>
<select id="listOne" resultType="java.util.Map">
- select id,name,sort,state from t_store_other where storeId=#{id}
+ select id,name,sort,state from t_store_other where storeId=#{id} order by id desc
</select>
<select id="typeChange" resultType="java.util.Map">
- select t1.id,t1.name from t_turn t1 left join t_turn t2 on t1.pid = t2.id where t2.name =#{name}
+ select t1.id,t1.name from t_turn t1 left join t_turn t2 on t1.pid = t2.id where t2.name =#{name} order by t1.id desc
</select>
<select id="typeChangeOne" resultType="java.util.Map">
- select id,name from t_turn where pid =#{id}
+ select id,name from t_turn where pid =#{id} order by id desc
</select>
<select id="getConfig" resultType="java.lang.String">
select name from t_turn where id =#{page}
</select>
<select id="listTwo" resultType="java.util.Map">
- select id,url,name , page,sort from t_store_other_config
+ select id,url,name , page,sort from t_store_other_config order by id desc
</select>
<select id="getPage" resultType="com.dsh.guns.modular.system.model.TTurn">
@@ -125,9 +157,10 @@
</foreach>
</if>
</where>
+ order by t_turn.id desc
</select>
<select id="pageList" resultType="com.dsh.guns.modular.system.model.TTurn">
- select * from t_turn where pid = 0
+ select * from t_turn where pid = 0 order by id desc
</select>
<select id="get" resultType="com.dsh.course.dto.JsDto">
select * from t_js where id = #{id}
@@ -136,7 +169,7 @@
<select id="getConfig1" resultType="com.dsh.guns.modular.system.model.TImgConfig">
- select * from t_img_config
+ select * from t_img_config order by id desc
</select>
@@ -146,14 +179,19 @@
SELECT op.id , CONCAT(us.name,'-',us.`phone`) as value
FROM t_operator op
LEFT JOIN sys_user us on op.userId = us.id
+ order by op.id desc
</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
- where t1.id =#{operatorId}
+ <select id="listAllStore" resultMap="storeListResultMap">
+ select t1.*,
+ t1.phone as storePhone,
+ t3.name as yysName
+ from t_store t1
+ left join t_operator t3 on t1.operatorId = t3.id
+ where t1.id =#{id}
<if test="provinceCode !=null and provinceCode !=''">
and t1.provinceCode = #{provinceCode}
</if>
@@ -161,13 +199,133 @@
and t1.cityCode = #{cityCode}
</if>
<if test="name !=null and name !=''">
- and t2.name like concat("%",#{name},"%")
+ and t1.managerName like concat("%",#{name},"%")
</if>
<if test="phone !=null and phone !=''">
- and t2.phone like concat("%",#{phone},"%")
+ and t1.phone like concat("%",#{phone},"%")
</if>
<if test="shopName !=null and shopName !=''">
and t1.name like concat("%",#{shopName},"%")
</if>
+ order by t1.id desc
</select>
-</mapper>
\ No newline at end of file
+ <select id="listAllStoresByIds" resultMap="storeListResultMap">
+ select t1.*,
+ t1.phone as storePhone,
+ t3.name as yysName
+ from t_store t1
+ left join t_operator t3 on t1.operatorId = t3.id
+ where t1.id in
+ <foreach collection="ids" item="id" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ <if test="provinceCode !=null and provinceCode !=''">
+ and t1.provinceCode = #{provinceCode}
+ </if>
+ <if test="cityCode !=null and cityCode !=''">
+ and t1.cityCode = #{cityCode}
+ </if>
+ <if test="name !=null and name !=''">
+ and t1.managerName like concat("%",#{name},"%")
+ </if>
+ <if test="phone !=null and phone !=''">
+ and t1.phone like concat("%",#{phone},"%")
+ </if>
+ <if test="shopName !=null and shopName !=''">
+ and t1.name like concat("%",#{shopName},"%")
+ </if>
+ order by t1.id desc
+ </select>
+ <select id="querySiteListOfpage" resultType="java.util.Map">
+ SELECT t1.id, t2.operatorId, t1.province, t1.city, t2.name,t1.ids,t1.name as siteName
+ ,t2.type as `type`
+ from t_site t1
+ left join t_store t2 on t1.storeId =t2.id
+ where t1.state=1 and t2.state=1 and t1.isCanBeBooked = 0 and t1.reservation=0
+ <if test="provinceCode != null and provinceCode!=''">
+ and t1.provinceCode = #{provinceCode}
+ </if>
+ <if test="cityCode != null and cityCode!=''">
+ and t1.cityCode = #{cityCode}
+ </if>
+ <if test="operatorId != null and operatorId!=''">
+ and t1.operatorId = #{operatorId}
+ </if>
+ <if test="storeName != null and storeName != ''">
+ and t2.name like CONCAT('%',#{storeName},'%')
+ </if>
+ <if test="storeId != null">
+ and t1.storeId = #{storeId}
+ </if>
+ order by t1.id desc
+ </select>
+ <select id="querySiteListOfpageOperator" resultType="java.util.Map">
+ SELECT t1.id, t2.operatorId, t1.province, t1.city, t2.name,t1.ids,t1.name as siteName
+ ,t2.type as `type`
+ from t_site t1
+ left join t_store t2 on t1.storeId =t2.id
+ where t1.state=1 and t2.state=1
+ <if test="provinceCode != null and provinceCode!=''">
+ and t1.provinceCode = #{provinceCode}
+ </if>
+ <if test="cityCode != null and cityCode!=''">
+ and t1.cityCode = #{cityCode}
+ </if>
+
+ <if test="storeName != null and storeName != ''">
+ and t2.name like CONCAT('%',#{storeName},'%')
+ </if>
+ <if test="storeIds != null and storeIds.size()>0">
+ AND t1.storeId IN
+ <foreach collection="storeIds" separator="," item="id" open="(" close=")">
+ #{id}
+ </foreach>
+ </if>
+ order by t1.id desc
+ </select>
+
+ <select id="listStoreAll" resultType="map">
+ select
+ a.id,
+ CONCAT(a.province, a.city) as province,
+ b.name as operator,
+ a.name,
+ c.gate
+ from t_store a
+ left join t_operator b on (a.operatorId = b.id)
+ left join (select GROUP_CONCAT(id) as gate, storeId from t_gate group by storeId) c on (a.id = c.storeId)
+ where a.state = 1
+ <if test="null != name and '' != name">
+ and a.name like CONCAT('%', #{name}, '%')
+ </if>
+ <if test="null != operator">
+ and a.operatorId = #{operator}
+ </if>
+ <if test="null != provinceCode and '' != provinceCode">
+ and a.provinceCode = #{provinceCode}
+ </if>
+ <if test="null != cityCode and '' != cityCode">
+ and a.cityCode = #{cityCode}
+ </if>
+ order by a.id desc
+ </select>
+
+
+
+ <select id="listStoreAllByIds" resultType="map">
+ select
+ a.id,
+ CONCAT(a.province, a.city) as province,
+ b.name as operator,
+ a.name,
+ c.gate
+ from t_store a
+ left join t_operator b on (a.operatorId = b.id)
+ left join (select GROUP_CONCAT(id) as gate, storeId from t_gate group by storeId) c on (a.id = c.storeId)
+ where a.id in
+ <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
+ #{item}
+ </foreach>
+ order by a.id desc
+ </select>
+</mapper>
--
Gitblit v1.7.1