商品搜索

附近一千米
This commit is contained in:
2024-05-30 10:50:24 +08:00
parent a5c416e3e6
commit 58ed73e6e0
4 changed files with 14 additions and 4 deletions

View File

@@ -23,12 +23,12 @@ public interface TbProductMapper {
Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId); Integer selectByQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId);
Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list); Integer selectByNewQcode(@Param("code") String code,@Param("productId") Integer productId,@Param("shopId") String shopId,@Param("list") List<String> list);
List<ShopGroupInfoVo> selGroups(@Param("type") String type, List<ShopGroupInfoVo> selGroups(@Param("proName") String proName,@Param("type") String type,
@Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat, @Param("rightTopLng") Double rightTopLng, @Param("rightTopLat") Double rightTopLat,
@Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat, @Param("leftBottomLng") Double leftBottomLng, @Param("leftBottomLat") Double leftBottomLat,
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat); @Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);
List<ShopGroupInfoVo> selHotGroups(@Param("type") String type, List<ShopGroupInfoVo> selHotGroups(@Param("proName") String proName,@Param("type") String type,
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat); @Param("cities") String cities, @Param("orderBy") String orderBy, @Param("lng") String lng, @Param("lat") String lat);

View File

@@ -7,6 +7,7 @@ import lombok.Data;
*/ */
@Data @Data
public class HomeDto extends HomeBaseDto { public class HomeDto extends HomeBaseDto {
private String proName;
/** /**
* 品类 * 品类
*/ */

View File

@@ -186,6 +186,9 @@ public class ProductService {
homeDto.setPage(1); homeDto.setPage(1);
homeDto.setSize(4); homeDto.setSize(4);
} }
if (homeDto.getType().equals("near")) {
homeDto.setDistanceInKm("1");
}
PageHelper.startPage(homeDto.getPage(), homeDto.getSize()); PageHelper.startPage(homeDto.getPage(), homeDto.getSize());
//经纬度(附近一km) //经纬度(附近一km)
Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint( Map<String, double[]> topAndBottomMap = LocationUtils.returnLLSquarePoint(
@@ -202,12 +205,12 @@ public class ProductService {
stTime = enTime - 3600000L * 2; stTime = enTime - 3600000L * 2;
} }
shopGroupInfoVos = tbProductMapper.selHotGroups( shopGroupInfoVos = tbProductMapper.selHotGroups(
homeDto.getType(), homeDto.getProName(),homeDto.getType(),
DateUtils.getStrTime(new Date(stTime)), DateUtils.getStrTime(new Date(enTime)), DateUtils.getStrTime(new Date(stTime)), DateUtils.getStrTime(new Date(enTime)),
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat()); homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());
} else { } else {
shopGroupInfoVos = tbProductMapper.selGroups( shopGroupInfoVos = tbProductMapper.selGroups(
homeDto.getType(), homeDto.getProName(),homeDto.getType(),
topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0], topAndBottomMap.get("rightTopPoint")[1], topAndBottomMap.get("rightTopPoint")[0],
topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0], topAndBottomMap.get("leftBottomPoint")[1], topAndBottomMap.get("leftBottomPoint")[0],
homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat()); homeDto.getAddress(), homeDto.getOrderBy().toString(), homeDto.getLng(), homeDto.getLat());

View File

@@ -961,6 +961,9 @@
info.`status`='1' info.`status`='1'
AND pro.is_combo = '1' AND pro.is_combo = '1'
AND info.cities = #{cities} AND info.cities = #{cities}
<if test="proName != null and proName != ''">
AND pro.`name` LIKE concat('%',#{proName,jdbcType=VARCHAR},'%')
</if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%') AND group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
</if> </if>
@@ -1005,6 +1008,9 @@
<where> <where>
info.`status`='1' info.`status`='1'
AND info.cities = #{cities} AND info.cities = #{cities}
<if test="proName != null and proName != ''">
AND pro.`name` LIKE concat('%',#{proName,jdbcType=VARCHAR},'%')
</if>
<if test="type != null and type != ''"> <if test="type != null and type != ''">
AND pro.group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%') AND pro.group_category_id LIKE concat('%',#{type,jdbcType=VARCHAR},'%')
</if> </if>