<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.panzhihua.service_community.dao.RentingHourseRegisterDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.RentingHourseRegister"
|
id="RentingHourseRegisterBaseResultMap">
|
<result property="id" column="id"/>
|
<result property="streetId" column="street_id"/>
|
<result property="communityId" column="community_id"/>
|
<result property="villageId" column="village_id"/>
|
<result property="villageName" column="village_name"/>
|
<result property="alley" column="alley"/>
|
<result property="houseNum" column="house_num"/>
|
<result property="unitNo" column="unit_no"/>
|
<result property="floor" column="floor"/>
|
<result property="houseNo" column="house_no"/>
|
<result property="buildingNo" column="building_no"/>
|
<result property="code" column="code"/>
|
<result property="address" column="address"/>
|
<result property="authCode" column="auth_code"/>
|
<result property="authStatus" column="auth_status"/>
|
<result property="status" column="status"/>
|
<result property="detailStatus" column="detail_status"/>
|
<result property="longitude" column="longitude"/>
|
<result property="latitude" column="latitude"/>
|
<result property="constructArea" column="construct_area"/>
|
<result property="path" column="path"/>
|
<result property="seeHourseTelephone" column="see_hourse_telephone"/>
|
<result property="title" column="title"/>
|
<result property="brn" column="brn"/>
|
<result property="lrn" column="lrn"/>
|
<result property="wcn" column="wcn"/>
|
<result property="roomType" column="room_type"/>
|
<result property="monthlyRentMoney" column="monthly_rent_money"/>
|
<result property="depositMoney" column="deposit_money"/>
|
<result property="serverCharge" column="server_charge"/>
|
<result property="dingMoney" column="ding_money"/>
|
<result property="totalFloor" column="total_floor"/>
|
<result property="orientation" column="orientation"/>
|
<result property="decoration" column="decoration"/>
|
<result property="seeHourseDate" column="see_hourse_date"/>
|
<result property="hourseDescription" column="hourse_description"/>
|
<result property="checkInRequirement" column="check_in_requirement"/>
|
<result property="hourseItem" column="hourse_item"/>
|
<result property="label" column="label"/>
|
<result property="hourseOwnerName" column="hourse_owner_name"/>
|
<result property="hourseIdCard" column="hourse_id_card"/>
|
<result property="hoursePhone" column="hourse_phone"/>
|
<result property="infoStatus" column="info_status"/>
|
<result property="hourseOwnerWeixinAppid" column="hourse_owner_weixin_appid"/>
|
<result property="hourseOwnerUserId" column="hourse_owner_user_id"/>
|
<result property="tenantWeixinAppid" column="tenant_weixin_appid"/>
|
<result property="tenantUserId" column="tenant_user_id"/>
|
<result property="createAt" column="create_at"/>
|
<result property="updateAt" column="update_at"/>
|
</resultMap>
|
<select id="pageRentingHouse"
|
resultType="com.panzhihua.common.model.vos.community.rentingHouses.RentingHouseRegisterVO">
|
SELECT t1.id, t1.title, t1.brn, t1.construct_area, t1.floor, t1.orientation, t1.decoration,
|
t1.label, t1.address, t1.monthly_rent_money, t1.`status`, t1.detail_status, t1.auth_status, t1.auth_code, t2.url
|
FROM renting_hourse_register t1
|
LEFT JOIN (SELECT * FROM renting_hourse_file WHERE classification = 1 AND `type` = 1) t2 ON t1.id = t2.ref_id
|
WHERE t1.community_id = ${pageRegisterDTO.communityId} AND t1.`status` = #{pageRegisterDTO.status}
|
<if test="pageRegisterDTO.brn != null">
|
<if test="pageRegisterDTO.moreBrn == null">
|
AND t1.brn = #{pageRegisterDTO.brn}
|
</if>
|
<if test="pageRegisterDTO.moreBrn != null and pageRegisterDTO.moreBrn == 1">
|
AND t1.brn > #{pageRegisterDTO.brn}
|
</if>
|
</if>
|
<if test="pageRegisterDTO.decoration != null">
|
AND t1.decoration = #{pageRegisterDTO.decoration}
|
</if>
|
<if test="pageRegisterDTO.orientation != null">
|
AND t1.orientation = #{pageRegisterDTO.orientation}
|
</if>
|
<if test="pageRegisterDTO.detailStatus != null">
|
AND t1.detail_status = #{pageRegisterDTO.detailStatus}
|
</if>
|
<if test="pageRegisterDTO.minArea != null">
|
AND t1.construct_area >= #{pageRegisterDTO.minArea}
|
</if>
|
<if test="pageRegisterDTO.maxArea != null">
|
AND t1.construct_area <= #{pageRegisterDTO.maxArea}
|
</if>
|
<if test="pageRegisterDTO.minRentMoney != null">
|
AND t1.monthly_rent_money >= #{pageRegisterDTO.minRentMoney}
|
</if>
|
<if test="pageRegisterDTO.maxRentMoney != null">
|
AND t1.monthly_rent_money <= #{pageRegisterDTO.maxRentMoney}
|
</if>
|
<if test="pageRegisterDTO.keyword != null and pageRegisterDTO.keyword != """>
|
AND (
|
t1.village_name LIKE CONCAT('%', #{pageRegisterDTO.keyword}, '%')
|
OR t1.address LIKE CONCAT('%', #{pageRegisterDTO.keyword}, '%')
|
)
|
</if>
|
GROUP BY id ORDER BY id DESC
|
</select>
|
|
<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,
|
(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 = ${nearbyDTO.communityId} and t.status=2 and t.detail_status=3
|
<if test="nearbyDTO.keyword !=null and nearbyDTO.keyword!=''">
|
AND (
|
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 order by distance ASC
|
</select>
|
|
<select id="pageRentingHouseApplet"
|
resultType="com.panzhihua.common.model.vos.community.rentingHouses.RentingHouseRegisterVO">
|
SELECT t.id, t.title, t.brn, t.construct_area, t.floor, t.orientation, t.decoration, t.label, t.address, t.monthly_rent_money,
|
t.`status`, t.detail_status, t.auth_status,t1.url, t2.phone AS tenantTelephone, t.see_hourse_telephone, t.update_at
|
<if test="pageRegisterDTO.longitude !=null and pageRegisterDTO.longitude !=''">
|
,(POWER(MOD(ABS(longitude - #{pageRegisterDTO.longitude}),360),2) + POWER(ABS(latitude - #{pageRegisterDTO.latitude}),2)) AS distance
|
</if>
|
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
|
LEFT JOIN sys_user t2 ON t.tenant_user_id = t2.user_id
|
WHERE t.community_id = ${pageRegisterDTO.communityId}
|
<if test="pageRegisterDTO.status == null and pageRegisterDTO.isMy == null">
|
AND t.`status` = 2
|
</if>
|
<if test="pageRegisterDTO.status != null">
|
AND t.`status` = #{pageRegisterDTO.status}
|
</if>
|
<if test="pageRegisterDTO.isMy != null and pageRegisterDTO.isMy == 1">
|
AND t.hourse_owner_user_id = #{pageRegisterDTO.currentUserId}
|
</if>
|
<if test="pageRegisterDTO.brn != null">
|
<if test="pageRegisterDTO.moreBrn == null">
|
AND t.brn = #{pageRegisterDTO.brn}
|
</if>
|
<if test="pageRegisterDTO.moreBrn != null and pageRegisterDTO.moreBrn == 1">
|
AND t.brn > #{pageRegisterDTO.brn}
|
</if>
|
</if>
|
<if test="pageRegisterDTO.decoration != null">
|
AND t.decoration = #{pageRegisterDTO.decoration}
|
</if>
|
<if test="pageRegisterDTO.orientation != null">
|
AND t.orientation = #{pageRegisterDTO.orientation}
|
</if>
|
<if test="pageRegisterDTO.detailStatus != null">
|
AND t.detail_status = #{pageRegisterDTO.detailStatus}
|
</if>
|
<if test="pageRegisterDTO.minArea != null">
|
AND t.construct_area >= #{pageRegisterDTO.minArea}
|
</if>
|
<if test="pageRegisterDTO.maxArea != null">
|
AND t.construct_area <= #{pageRegisterDTO.maxArea}
|
</if>
|
<if test="pageRegisterDTO.minRentMoney != null">
|
AND t.monthly_rent_money >= #{pageRegisterDTO.minRentMoney}
|
</if>
|
<if test="pageRegisterDTO.maxRentMoney != null">
|
AND t.monthly_rent_money <= #{pageRegisterDTO.maxRentMoney}
|
</if>
|
<if test="pageRegisterDTO.keyword != null and pageRegisterDTO.keyword != """>
|
AND (
|
t.village_name LIKE CONCAT('%', #{pageRegisterDTO.keyword}, '%')
|
OR t.address LIKE CONCAT('%', #{pageRegisterDTO.keyword}, '%')
|
)
|
</if>
|
group by t.id
|
<if test="pageRegisterDTO.sort ==null">
|
order by update_at desc
|
</if>
|
<if test="pageRegisterDTO.sort !=null">
|
<if test="pageRegisterDTO.longitude !=null">
|
<if test="pageRegisterDTO.sort==1">
|
order by distance DESC
|
</if>
|
<if test="pageRegisterDTO.sort==2">
|
order by distance ASC
|
</if>
|
</if>
|
<if test="pageRegisterDTO.sort==3">
|
order by monthly_rent_money DESC
|
</if>
|
<if test="pageRegisterDTO.sort==4">
|
order by monthly_rent_money ASC
|
</if>
|
</if>
|
</select>
|
|
</mapper>
|