feat:getStoreListByMobile
This commit is contained in:
@@ -89,9 +89,9 @@
|
||||
|
||||
<select id="listByMobile" resultMap="BaseResultMap">
|
||||
select *
|
||||
from store_${enterpriseId}
|
||||
from store_${enterpriseId} a left join store_master_signer_info_5558ce7a3aa84e3590392fcaa8697ffb b on a.store_id = b.store_id
|
||||
<where>
|
||||
and is_delete = 'effective'
|
||||
and a.is_delete = 'effective'
|
||||
<if test="mobile!=null and mobile !=''">
|
||||
and `extend_field` like concat('%', #{mobile}, '%')
|
||||
</if>
|
||||
@@ -99,34 +99,57 @@
|
||||
</select>
|
||||
|
||||
<select id="getSubStoreByRegionIdsAndMobile" resultType="com.cool.store.response.MiniShopsResponse">
|
||||
select store_id as storeId, store_name as shopName, store_num as shopCode, store_address as detailAddress
|
||||
from store_${enterpriseId}
|
||||
where is_delete = 'effective'
|
||||
<if test="storeName!=null and storeName!=''">
|
||||
and store_name like concat('%', #{storeName}, '%')
|
||||
</if>
|
||||
<if test="storeNum!=null and storeNum!=''">
|
||||
and store_num = #{storeNum}
|
||||
</if>
|
||||
and (
|
||||
<if test="regionIdList != null and regionIdList.size >0 ">
|
||||
<foreach collection="regionIdList" item="regionId" separator=" or " open=" (" close=" )">
|
||||
region_path like concat('%/', #{regionId}, '/%')
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="mobile!=null and mobile !=''">
|
||||
<choose>
|
||||
<when test="regionIdList != null and regionIdList.size >0 ">
|
||||
or `extend_field` like concat('%', #{mobile}, '%')
|
||||
</when>
|
||||
<otherwise>
|
||||
`extend_field` like concat('%', #{mobile}, '%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
)
|
||||
<choose>
|
||||
<!-- 情况1:regionIdList不为空,使用UNION优化 -->
|
||||
<when test="regionIdList != null and regionIdList.size > 0">
|
||||
SELECT store_id as storeId, store_name as shopName, store_num as shopCode, store_address as detailAddress
|
||||
FROM store_${enterpriseId} a
|
||||
WHERE a.is_delete = 'effective'
|
||||
<if test="storeName!=null and storeName!=''">
|
||||
AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
|
||||
</if>
|
||||
<if test="storeNum!=null and storeNum!=''">
|
||||
AND a.store_num = #{storeNum}
|
||||
</if>
|
||||
AND (
|
||||
<foreach collection="regionIdList" item="regionId" separator=" OR ">
|
||||
a.region_path LIKE CONCAT('%/', #{regionId}, '/%')
|
||||
</foreach>
|
||||
)
|
||||
|
||||
UNION
|
||||
|
||||
SELECT a.store_id as storeId, a.store_name as shopName, a.store_num as shopCode, a.store_address as detailAddress
|
||||
FROM store_${enterpriseId} a
|
||||
INNER JOIN store_master_signer_info_${enterpriseId} b ON a.store_id = b.store_id
|
||||
WHERE a.is_delete = 'effective'
|
||||
<if test="storeName!=null and storeName!=''">
|
||||
AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
|
||||
</if>
|
||||
<if test="storeNum!=null and storeNum!=''">
|
||||
AND a.store_num = #{storeNum}
|
||||
</if>
|
||||
AND (b.signer1_mobile = #{mobile} OR b.signer2_mobile = #{mobile})
|
||||
</when>
|
||||
|
||||
<!-- 情况2:regionIdList为空,直接查询关联表 -->
|
||||
<otherwise>
|
||||
SELECT a.store_id as storeId, a.store_name as shopName, a.store_num as shopCode, a.store_address as detailAddress
|
||||
FROM store_${enterpriseId} a
|
||||
INNER JOIN store_master_signer_info_${enterpriseId} b ON a.store_id = b.store_id
|
||||
WHERE a.is_delete = 'effective'
|
||||
<if test="storeName!=null and storeName!=''">
|
||||
AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
|
||||
</if>
|
||||
<if test="storeNum!=null and storeNum!=''">
|
||||
AND a.store_num = #{storeNum}
|
||||
</if>
|
||||
AND (b.signer1_mobile = #{mobile} OR b.signer2_mobile = #{mobile})
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="list" resultMap="BaseResultMap">
|
||||
select *
|
||||
from store_${enterpriseId} where is_delete = 'effective' order by id asc
|
||||
|
||||
Reference in New Issue
Block a user