成功开店代码改造
This commit is contained in:
@@ -2,6 +2,7 @@ package com.cool.store.dao;
|
||||
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.mapper.StoreMapper;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -63,11 +64,11 @@ public class StoreDao {
|
||||
return storeMapper.listByMobile(mobile);
|
||||
}
|
||||
|
||||
public List<StoreDO> getSubStoreByRegionIds(List<String> regionIdList) {
|
||||
if(CollectionUtils.isEmpty(regionIdList)) {
|
||||
public List<MiniShopsResponse> getSubStoreByRegionIdsAndMobile(List<String> regionIdList, String mobile) {
|
||||
if(CollectionUtils.isEmpty(regionIdList)&&StringUtils.isBlank(mobile)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return storeMapper.getSubStoreByRegionIds(regionIdList);
|
||||
return storeMapper.getSubStoreByRegionIdsAndMobile(regionIdList,mobile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,11 @@ public class SysRoleDao {
|
||||
if(CollectionUtils.isEmpty(roleIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return sysRoleMapper.getRoleByRoleIds( roleIds);
|
||||
List<SysRoleDO> roleByRoleIds = sysRoleMapper.getRoleByRoleIds(roleIds);
|
||||
if(CollectionUtils.isEmpty(roleByRoleIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
return roleByRoleIds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.StoreDO;
|
||||
import com.cool.store.response.MiniShopsResponse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -31,7 +32,7 @@ public interface StoreMapper {
|
||||
*/
|
||||
List<StoreDO> listByMobile(@Param("mobile") String mobile);
|
||||
|
||||
List<StoreDO> getSubStoreByRegionIds(@Param("regionIdList") List<String> regionIdList);
|
||||
List<MiniShopsResponse> getSubStoreByRegionIdsAndMobile(@Param("regionIdList") List<String> regionIdList, @Param("mobile") String mobile);
|
||||
/**
|
||||
* 分页查询门店数据
|
||||
* @return
|
||||
|
||||
@@ -90,15 +90,27 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getSubStoreByRegionIds" resultMap="BaseResultMap">
|
||||
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'
|
||||
and (
|
||||
<if test="regionIdList != null and regionIdList.size >0 ">
|
||||
<foreach collection="regionIdList" item="regionId" separator=" or " open="and (" close=" )">
|
||||
<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>
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="list" resultMap="BaseResultMap">
|
||||
|
||||
Reference in New Issue
Block a user