| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.dtos.community.rentingHouses.NearbyDTO; |
| | | import com.panzhihua.common.model.dtos.community.rentingHouses.PageRentingHouseRegisterDTO; |
| | | import com.panzhihua.common.model.vos.community.rentingHouses.RentingHouseRegisterVO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | |
| | | * @param maxX |
| | | * @param minY |
| | | * @param maxY |
| | | * @param keyword |
| | | * @param communityId |
| | | * @param nearbyDTO |
| | | * @return |
| | | */ |
| | | List<RentingHouseRegisterVO> nearby(@Param("minX") Double minX, @Param("maxX") Double maxX, @Param("minY") Double minY, |
| | | @Param("maxY") Double maxY, @Param("keyword") String keyword, @Param("communityId") Long communityId); |
| | | @Param("maxY") Double maxY, @Param("nearbyDTO") NearbyDTO nearbyDTO); |
| | | |
| | | /** |
| | | * 分页获取房源信息 |
| | |
| | | public R nearby(NearbyDTO nearbyDTO) { |
| | | Rectangle rectangle =new NearbyUtil().getRectangle(nearbyDTO.getDistance(), Double.parseDouble(nearbyDTO.getLongitude()), Double.parseDouble(nearbyDTO.getLatitude())); |
| | | return R.ok(this.baseMapper.nearby(rectangle.getMinX(),rectangle.getMaxX(), |
| | | rectangle.getMinY(),rectangle.getMaxY(),nearbyDTO.getKeyword(), nearbyDTO.getCommunityId())); |
| | | rectangle.getMinY(),rectangle.getMaxY(), nearbyDTO)); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | <select id="nearby" resultType="com.panzhihua.common.model.vos.community.rentingHouses.RentingHouseRegisterVO"> |
| | | select t.id,title, brn, construct_area, floor, orientation, decoration, label, address, monthly_rent_money, |
| | | `status`, detail_status, auth_status,t1.url |
| | | `status`, detail_status, auth_status,t1.url, |
| | | (POWER(MOD(ABS(longitude - #{nearbyDTO.longitude}),360),2) + POWER(ABS(latitude - #{nearbyDTO.latitude}),2)) AS distance |
| | | from renting_hourse_register t |
| | | LEFT JOIN (SELECT * FROM renting_hourse_file WHERE classification = 1 AND `type` = 1) t1 ON t.id = t1.ref_id |
| | | WHERE t.community_id = #{communityId} and t.status=2 and t.detail_status=3 |
| | | <if test="keyword !=null and keyword!=''"> |
| | | WHERE t.community_id = #{nearbyDTO.communityId} and t.status=2 and t.detail_status=3 |
| | | <if test="nearbyDTO.keyword !=null and nearbyDTO.keyword!=''"> |
| | | AND ( |
| | | village_name LIKE CONCAT('%', #{keyword}, '%') |
| | | OR address LIKE CONCAT('%', #{keyword}, '%') |
| | | village_name LIKE CONCAT('%', #{nearbyDTO.keyword}, '%') |
| | | OR address LIKE CONCAT('%', #{nearbyDTO.keyword}, '%') |
| | | ) |
| | | </if> |
| | | and (longitude BETWEEN ${minX} AND ${maxX}) |
| | | and (latitude BETWEEN ${minY} AND ${maxY}) group by t.id |
| | | and (latitude BETWEEN ${minY} AND ${maxY}) group by t.id order by distance ASC |
| | | </select> |
| | | |
| | | <select id="pageRentingHouseApplet" |