feat:getStoreListByMobile

This commit is contained in:
苏竹红
2025-09-05 15:51:21 +08:00
parent 8465432264
commit 910efd055d
2 changed files with 66 additions and 37 deletions

View File

@@ -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>
<!-- 情况1regionIdList不为空使用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>
<!-- 情况2regionIdList为空直接查询关联表 -->
<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

View File

@@ -1,6 +1,7 @@
package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*;
import com.cool.store.entity.*;
@@ -20,7 +21,7 @@ import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.RedisConstantUtil;
import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.poi.StringUtils;
import io.lettuce.core.ZAddArgs;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,6 +39,7 @@ import java.util.stream.Stream;
* @createDate 2024-10-09 14:05:52
*/
@Service
@Slf4j
public class BuildInformationServiceImpl implements BuildInformationService {
@Resource
private PlatformBuildDAO platformBuildDAO;
@@ -195,6 +197,7 @@ public class BuildInformationServiceImpl implements BuildInformationService {
@Override
@Transactional(rollbackFor = Exception.class)
public Integer submitOrUpdate(BuildInformationRequest request) {
log.info("提交/修改建店资料开始,shopId:{}", JSONObject.toJSONString(request));
String lockKey = redisConstantUtil.submitBuildKey(request.getShopId());
String lockValue = UUID.randomUUID().toString();
boolean acquired = false;
@@ -202,14 +205,17 @@ public class BuildInformationServiceImpl implements BuildInformationService {
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) {
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId());
// if (JoinModeEnum.FLAGSHIP_STORE.getCode()!=shopInfoDO.getJoinMode()){
// //校验结算人非空
// if (StringUtils.isAnyBlank(request.getSettlerName(),request.getSettlerIdCardFront(),
// request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(),
// request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName())) {
// throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
// }
// }
if (JoinModeEnum.FLAGSHIP_STORE.getCode()!=shopInfoDO.getJoinMode()){
log.info("FLAGSHIP_STORE{}{}{}{}{}{}{}",request.getSettlerName(),request.getSettlerIdCardFront(),
request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(),
request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName());
//校验结算人非空
if (StringUtils.isAnyBlank(request.getSettlerName(),request.getSettlerIdCardFront(),
request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(),
request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName())) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
}
BuildInformationDO informationDO = buildInformationDAO.selectOneByShopId(request.getShopId());
BuildInformationDO buildInformationDO = request.toDO();