优化店铺分类查询

This commit is contained in:
liyj 2025-09-04 08:47:38 +08:00
parent 02020d31a5
commit da97c93e9f
2 changed files with 20 additions and 1 deletions

View File

@ -3007,7 +3007,20 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
params.put("countyId", countyId);
params.put("userLng", userLng);
params.put("userLat", userLat);
params.put("storeCategoryId", storeCategoryId);
List<Integer> storeCategoryIds=new ArrayList<>();
QueryWrapper<ShopBaseStoreCategory> storeCategoryQueryWrapper = new QueryWrapper<>();
storeCategoryQueryWrapper.eq("store_category_parent_id",storeCategoryId);
List<ShopBaseStoreCategory> shopBaseStoreCategories= shopBaseStoreCategoryService.list(storeCategoryQueryWrapper);
if(!shopBaseStoreCategories.isEmpty()){
storeCategoryIds.add(storeCategoryId);
shopBaseStoreCategories.forEach(shopBaseStoreCategory -> {
storeCategoryIds.add(shopBaseStoreCategory.getStore_category_id());
});
params.put("storeCategoryIds", storeCategoryIds);
}else {
params.put("storeCategoryId", storeCategoryId);
}
params.put("subSiteId", subSiteId);
params.put("storeName", storeName);

View File

@ -131,6 +131,12 @@
<if test="params.storeCategoryId!=null">
and b.store_category_id=#{params.storeCategoryId}
</if>
<if test="params.storeCategoryIds!=null">
and b.store_category_id in
<foreach collection="params.storeCategoryIds" item="storeCategoryId" separator="," open="(" close=")">
#{storeCategoryId}
</foreach>
</if>
<if test="params.subSiteId!=null">
and b.subsite_id=#{params.subSiteId}