oying-system/src/main/java/com/oying/modules/pc/store/domain/dto/StoreQueryCriteria.java
@@ -1,8 +1,7 @@ package com.oying.modules.pc.store.domain.dto; import com.oying.utils.StringUtils; import lombok.Data; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.util.DigestUtils; import java.io.Serializable; @@ -18,13 +17,13 @@ @ApiModelProperty(value = "商户ID", example = "1") private Long merchantId; private String storeName; private Integer status; private Long storeId; private Long platformCategoryId; private String storeName; private Integer status; private String blurry; @@ -44,19 +43,15 @@ public String buildConditionCacheKey() { StringJoiner baseKeyJoiner = new StringJoiner("|"); if (platformCategoryId != null) { baseKeyJoiner.add("merchantId=" + merchantId); baseKeyJoiner.add("storeId=" + storeId); baseKeyJoiner.add("platformCategoryId=" + platformCategoryId); } if (StringUtils.isNotEmpty(blurry)) { baseKeyJoiner.add("storeName=" + storeName); baseKeyJoiner.add("status=" + status); baseKeyJoiner.add("blurry=" + blurry); } if (longitude != null && latitude != null) { baseKeyJoiner.add("longitude=" + longitude); baseKeyJoiner.add("latitude=" + latitude); } if (StringUtils.isNotEmpty(blurry)) { baseKeyJoiner.add("radius=" + radius); } // 使用MD5或SHA缩短键长度 return "store:search:page:" + DigestUtils.md5DigestAsHex(baseKeyJoiner.toString().getBytes()); } oying-system/src/main/java/com/oying/modules/pc/store/mapper/StoreMapper.java
@@ -3,11 +3,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.oying.modules.pc.store.domain.Store; import com.oying.modules.pc.search.domain.dto.NearbyStoreQueryCriteria; import com.oying.modules.pc.store.domain.dto.StoreCustomerQueryCriteria; import com.oying.modules.pc.store.domain.dto.StoreQueryCriteria; import com.oying.modules.pc.search.domain.dto.StoreSearchDto; import com.oying.modules.pc.store.domain.Store; import com.oying.modules.pc.store.domain.dto.StoreQueryCriteria; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -22,7 +21,7 @@ @Mapper public interface StoreMapper extends BaseMapper<Store> { List<Store> selectStoreList(@Param("criteria") StoreQueryCriteria criteria, Page<Store> page); IPage<Store> selectStoreList(@Param("criteria") StoreQueryCriteria criteria, Page<Store> page); List<Store> selectStoreList(@Param("criteria") StoreQueryCriteria criteria); oying-system/src/main/java/com/oying/modules/pc/store/rest/StoreCustomerController.java
@@ -46,11 +46,9 @@ @GetMapping(value = "/page") @ApiOperation("查询店铺") public ResponseEntity<?> getStoresByPage(StoreQueryCriteria criteria) { criteria.setLimit(1000); PageResult<Store> pagedStores = storeQueryService.findPagedStores(criteria); List<Store> stores = pagedStores.getContent(); for (Store store : stores) { store.setProducts(this.getProductsByStoreId(store.getStoreId())); } pagedStores.getContent().forEach(store -> store.setProducts(this.getProductsByStoreId(store.getStoreId()))); return ResponseEntity.ok(R.success(pagedStores)); } oying-system/src/main/resources/mapper/pc/store/StoreMapper.xml
@@ -135,7 +135,9 @@ AND s.platform_category_id = #{criteria.platformCategoryId} </if> </where> LIMIT 1000 <if test="criteria.limit != null"> limit #{criteria.limit} </if> </select> <select id="queryUserStores" parameterType="java.lang.Long" resultMap="StoreResult">