<?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.izouma.awesomeadmin.dao.HouseInfoMapper">
    <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.HouseInfo">
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
        <result column="title" property="title" jdbcType="VARCHAR"/>
        <result column="price" property="price" jdbcType="INTEGER"/>
        <result column="pay_mode" property="payMode" jdbcType="VARCHAR"/>
        <result column="feature_code" property="featureCode" jdbcType="VARCHAR"/>
        <result column="house_area" property="houseArea" jdbcType="VARCHAR"/>
        <result column="room" property="room" jdbcType="INTEGER"/>
        <result column="hall" property="hall" jdbcType="INTEGER"/>
        <result column="guard" property="guard" jdbcType="INTEGER"/>
        <result column="total_floor" property="totalFloor" jdbcType="INTEGER"/>
        <result column="house_floor" property="houseFloor" jdbcType="INTEGER"/>
        <result column="faced" property="faced" jdbcType="VARCHAR"/>
        <result column="decoration" property="decoration" jdbcType="VARCHAR"/>
        <result column="check_in" property="checkIn" jdbcType="VARCHAR"/>
        <result column="elevator" property="elevator" jdbcType="VARCHAR"/>
        <result column="renting_type" property="rentingType" jdbcType="VARCHAR"/>
        <result column="part_code" property="partCode" jdbcType="VARCHAR"/>
        <result column="house_introduce" property="houseIntroduce" jdbcType="VARCHAR"/>
        <result column="housekeeper" property="housekeeper" jdbcType="INTEGER"/>
        <result column="retrieval" property="retrieval" jdbcType="VARCHAR"/>
        <result column="housing_district" property="housingDistrict" jdbcType="VARCHAR"/>
        <result column="street_code" property="streetCode" jdbcType="VARCHAR"/>
        <result column="business_circle_code" property="businessCircleCode" jdbcType="VARCHAR"/>
        <result column="district_code" property="districtCode" jdbcType="VARCHAR"/>
        <result column="city_code" property="cityCode" jdbcType="VARCHAR"/>
        <result column="lat" property="lat" jdbcType="VARCHAR"/>
        <result column="lng" property="lng" jdbcType="VARCHAR"/>
        <result column="remark" property="remark" jdbcType="VARCHAR"/>
        <result column="rank" property="rank" jdbcType="INTEGER"/>
        <result column="hot" property="hot" jdbcType="INTEGER"/>
        <result column="recommend_flag" property="recommendFlag" jdbcType="CHAR"/>
        <result column="selected_flag" property="selectedFlag" jdbcType="CHAR"/>
        <result column="address" property="address" jdbcType="VARCHAR"/>
        <result column="address_detail" property="addressDetail" jdbcType="VARCHAR"/>
        <result column="status_flag" property="statusFlag" jdbcType="INTEGER"/>
        <result column="build_year" property="buildYear" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
        <result column="line_code" property="lineCode" jdbcType="VARCHAR"/>
        <result column="station_code" property="stationCode" jdbcType="VARCHAR"/>
        <result column="phone" property="phone" jdbcType="VARCHAR"/>
    </resultMap>
    <sql id="Base_Column_List">
            id, del_flag, title, price, pay_mode,
            feature_code, house_area, room, hall, guard,
            total_floor, house_floor, faced, decoration,
            check_in, elevator, renting_type, part_code,
            house_introduce, housekeeper, retrieval, housing_district,
            street_code, business_circle_code, district_code, city_code,
            lat, lng, remark, rank, hot, recommend_flag, selected_flag,
            address, address_detail,status_flag, build_year, create_time, update_time,
            line_code, station_code,phone
</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from house_info
        where id = #{id,jdbcType=INTEGER}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
        delete from house_info
        where id = #{id,jdbcType=INTEGER}
    </delete>
    <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.HouseInfo" useGeneratedKeys="true"
            keyProperty="id">
        insert into house_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id!= null">
                id,
            </if>
            <if test="delFlag!= null">
                del_flag,
            </if>
            <if test="title!= null">
                title,
            </if>
            <if test="price!= null">
                price,
            </if>
            <if test="payMode!= null">
                pay_mode,
            </if>
            <if test="featureCode!= null">
                feature_code,
            </if>
            <if test="houseArea!= null">
                house_area,
            </if>
            <if test="room!= null">
                room,
            </if>
            <if test="hall!= null">
                hall,
            </if>
            <if test="guard!= null">
                guard,
            </if>
            <if test="totalFloor!= null">
                total_floor,
            </if>
            <if test="houseFloor!= null">
                house_floor,
            </if>
            <if test="faced!= null">
                faced,
            </if>
            <if test="decoration!= null">
                decoration,
            </if>
            <if test="checkIn!= null">
                check_in,
            </if>
            <if test="elevator!= null">
                elevator,
            </if>
            <if test="rentingType!= null">
                renting_type,
            </if>
            <if test="partCode!= null">
                part_code,
            </if>
            <if test="houseIntroduce!= null">
                house_introduce,
            </if>
            <if test="housekeeper!= null">
                housekeeper,
            </if>
            <if test="retrieval!= null">
                retrieval,
            </if>
            <if test="housingDistrict!= null">
                housing_district,
            </if>
            <if test="streetCode!= null">
                street_code,
            </if>
            <if test="businessCircleCode!= null">
                business_circle_code,
            </if>
            <if test="districtCode!= null">
                district_code,
            </if>
            <if test="cityCode!= null">
                city_code,
            </if>
            <if test="lat!= null">
                lat,
            </if>
            <if test="lng!= null">
                lng,
            </if>
            <if test="remark!= null">
                remark,
            </if>
            <if test="rank!= null">
                rank,
            </if>
            <if test="hot!= null">
                hot,
            </if>
            <if test="recommendFlag!= null">
                recommend_flag,
            </if>
            <if test="selectedFlag!= null">
                selected_flag,
            </if>
            <if test="address!= null">
                address,
            </if>
            <if test="addressDetail!= null">
                address_detail,
            </if>
            <if test="statusFlag!= null">
                status_flag,
            </if>
            <if test="buildYear!= null">
                build_year,
            </if>
            <if test="createTime!= null">
                create_time,
            </if>
            <if test="updateTime!= null">
                update_time,
            </if>
            <if test="lineCode!= null">
                line_code,
            </if>
            <if test="stationCode!= null">
                station_code,
            </if>
            <if test="phone!= null">
                phone,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=INTEGER},
            </if>
            <if test="delFlag != null">
                #{delFlag,jdbcType=CHAR},
            </if>
            <if test="title != null">
                #{title,jdbcType=VARCHAR},
            </if>
            <if test="price != null">
                #{price,jdbcType=INTEGER},
            </if>
            <if test="payMode != null">
                #{payMode,jdbcType=VARCHAR},
            </if>
            <if test="featureCode != null">
                #{featureCode,jdbcType=VARCHAR},
            </if>
            <if test="houseArea != null">
                #{houseArea,jdbcType=VARCHAR},
            </if>
            <if test="room != null">
                #{room,jdbcType=INTEGER},
            </if>
            <if test="hall != null">
                #{hall,jdbcType=INTEGER},
            </if>
            <if test="guard != null">
                #{guard,jdbcType=INTEGER},
            </if>
            <if test="totalFloor != null">
                #{totalFloor,jdbcType=INTEGER},
            </if>
            <if test="houseFloor != null">
                #{houseFloor,jdbcType=INTEGER},
            </if>
            <if test="faced != null">
                #{faced,jdbcType=VARCHAR},
            </if>
            <if test="decoration != null">
                #{decoration,jdbcType=VARCHAR},
            </if>
            <if test="checkIn != null">
                #{checkIn,jdbcType=VARCHAR},
            </if>
            <if test="elevator != null">
                #{elevator,jdbcType=VARCHAR},
            </if>
            <if test="rentingType != null">
                #{rentingType,jdbcType=VARCHAR},
            </if>
            <if test="partCode != null">
                #{partCode,jdbcType=VARCHAR},
            </if>
            <if test="houseIntroduce != null">
                #{houseIntroduce,jdbcType=VARCHAR},
            </if>
            <if test="housekeeper != null">
                #{housekeeper,jdbcType=INTEGER},
            </if>
            <if test="retrieval != null">
                #{retrieval,jdbcType=VARCHAR},
            </if>
            <if test="housingDistrict != null">
                #{housingDistrict,jdbcType=VARCHAR},
            </if>
            <if test="streetCode != null">
                #{streetCode,jdbcType=VARCHAR},
            </if>
            <if test="businessCircleCode != null">
                #{businessCircleCode,jdbcType=VARCHAR},
            </if>
            <if test="districtCode != null">
                #{districtCode,jdbcType=VARCHAR},
            </if>
            <if test="cityCode != null">
                #{cityCode,jdbcType=VARCHAR},
            </if>
            <if test="lat != null">
                #{lat,jdbcType=VARCHAR},
            </if>
            <if test="lng != null">
                #{lng,jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                #{remark,jdbcType=VARCHAR},
            </if>
            <if test="rank != null">
                #{rank,jdbcType=INTEGER},
            </if>
            <if test="hot != null">
                #{hot,jdbcType=INTEGER},
            </if>
            <if test="recommendFlag != null">
                #{recommendFlag,jdbcType=CHAR},
            </if>
            <if test="selectedFlag != null">
                #{selectedFlag,jdbcType=CHAR},
            </if>
            <if test="address != null">
                #{address,jdbcType=VARCHAR},
            </if>
            <if test="addressDetail != null">
                #{addressDetail,jdbcType=VARCHAR},
            </if>
            <if test="statusFlag != null">
                #{statusFlag,jdbcType=INTEGER},
            </if>
            <if test="buildYear != null">
                #{buildYear,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="lineCode != null">
                #{lineCode,jdbcType=VARCHAR},
            </if>
            <if test="stationCode != null">
                #{stationCode,jdbcType=VARCHAR},
            </if>
            <if test="phone != null">
                #{phone,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.HouseInfo">
        update house_info
        <set>
            <if test="id != null">
                id= #{id,jdbcType=INTEGER},
            </if>
            <if test="delFlag != null">
                del_flag= #{delFlag,jdbcType=CHAR},
            </if>
            <if test="title != null">
                title= #{title,jdbcType=VARCHAR},
            </if>
            <if test="price != null">
                price= #{price,jdbcType=INTEGER},
            </if>
            <if test="payMode != null">
                pay_mode= #{payMode,jdbcType=VARCHAR},
            </if>
            <if test="featureCode != null">
                feature_code= #{featureCode,jdbcType=VARCHAR},
            </if>
            <if test="houseArea != null">
                house_area= #{houseArea,jdbcType=VARCHAR},
            </if>
            <if test="room != null">
                room= #{room,jdbcType=INTEGER},
            </if>
            <if test="hall != null">
                hall= #{hall,jdbcType=INTEGER},
            </if>
            <if test="guard != null">
                guard= #{guard,jdbcType=INTEGER},
            </if>
            <if test="totalFloor != null">
                total_floor= #{totalFloor,jdbcType=INTEGER},
            </if>
            <if test="houseFloor != null">
                house_floor= #{houseFloor,jdbcType=INTEGER},
            </if>
            <if test="faced != null">
                faced= #{faced,jdbcType=VARCHAR},
            </if>
            <if test="decoration != null">
                decoration= #{decoration,jdbcType=VARCHAR},
            </if>
            <if test="checkIn != null">
                check_in= #{checkIn,jdbcType=VARCHAR},
            </if>
            <if test="elevator != null">
                elevator= #{elevator,jdbcType=VARCHAR},
            </if>
            <if test="rentingType != null">
                renting_type= #{rentingType,jdbcType=VARCHAR},
            </if>
            <if test="partCode != null">
                part_code= #{partCode,jdbcType=VARCHAR},
            </if>
            <if test="houseIntroduce != null">
                house_introduce= #{houseIntroduce,jdbcType=VARCHAR},
            </if>
            <if test="housekeeper != null">
                housekeeper= #{housekeeper,jdbcType=INTEGER},
            </if>
            <if test="retrieval != null">
                retrieval= #{retrieval,jdbcType=VARCHAR},
            </if>
            <if test="housingDistrict != null">
                housing_district= #{housingDistrict,jdbcType=VARCHAR},
            </if>
            <if test="streetCode != null">
                street_code= #{streetCode,jdbcType=VARCHAR},
            </if>
            <if test="businessCircleCode != null">
                business_circle_code= #{businessCircleCode,jdbcType=VARCHAR},
            </if>
            <if test="districtCode != null">
                district_code= #{districtCode,jdbcType=VARCHAR},
            </if>
            <if test="cityCode != null">
                city_code= #{cityCode,jdbcType=VARCHAR},
            </if>
            <if test="lat != null">
                lat= #{lat,jdbcType=VARCHAR},
            </if>
            <if test="lng != null">
                lng= #{lng,jdbcType=VARCHAR},
            </if>
            <if test="remark != null">
                remark= #{remark,jdbcType=VARCHAR},
            </if>
            <if test="rank != null">
                rank= #{rank,jdbcType=INTEGER},
            </if>
            <if test="hot != null">
                hot= #{hot,jdbcType=INTEGER},
            </if>
            <if test="recommendFlag != null">
                recommend_flag= #{recommendFlag,jdbcType=CHAR},
            </if>
            <if test="selectedFlag != null">
                selected_flag= #{selectedFlag,jdbcType=CHAR},
            </if>
            <if test="address != null">
                address= #{address,jdbcType=VARCHAR},
            </if>
            <if test="addressDetail != null">
                address_detail= #{addressDetail,jdbcType=VARCHAR},
            </if>
            <if test="statusFlag != null">
                status_flag= #{statusFlag,jdbcType=INTEGER},
            </if>
            <if test="buildYear != null">
                build_year= #{buildYear,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time= #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="updateTime != null">
                update_time= #{updateTime,jdbcType=TIMESTAMP},
            </if>
            <if test="lineCode != null">
                line_code= #{lineCode,jdbcType=VARCHAR},
            </if>
            <if test="stationCode != null">
                station_code= #{stationCode,jdbcType=VARCHAR},
            </if>
            <if test="phone != null">
                phone= #{phone,jdbcType=VARCHAR},
            </if>
        </set>
        where id = #{id,jdbcType=INTEGER}
    </update>
    <select id="queryHouseInfoByPage" parameterType="java.util.Map"
            resultMap="houseInfoPageResultMap">
        select
        <include refid="Base_Column_List"/>
        from house_info
        <where>
            and del_flag = 'N'
            <if test="record.id != null and !&quot;&quot;.equals(record.id)">
                and id = #{record.id}
            </if>
            <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
                and del_flag = #{record.delFlag}
            </if>
            <if test="record.title != null and !&quot;&quot;.equals(record.title)">
                and title = #{record.title}
            </if>
            <if test="record.price != null and !&quot;&quot;.equals(record.price)">
                and price = #{record.price}
            </if>
            <if test="record.payMode != null and !&quot;&quot;.equals(record.payMode)">
                and pay_mode = #{record.payMode}
            </if>
            <if test="record.featureCode != null and !&quot;&quot;.equals(record.featureCode)">
                and feature_code = #{record.featureCode}
            </if>
            <if test="record.houseArea != null and !&quot;&quot;.equals(record.houseArea)">
                and house_area = #{record.houseArea}
            </if>
            <if test="record.room != null and !&quot;&quot;.equals(record.room)">
                and room = #{record.room}
            </if>
            <if test="record.hall != null and !&quot;&quot;.equals(record.hall)">
                and hall = #{record.hall}
            </if>
            <if test="record.guard != null and !&quot;&quot;.equals(record.guard)">
                and guard = #{record.guard}
            </if>
            <if test="record.totalFloor != null and !&quot;&quot;.equals(record.totalFloor)">
                and total_floor = #{record.totalFloor}
            </if>
            <if test="record.houseFloor != null and !&quot;&quot;.equals(record.houseFloor)">
                and house_floor = #{record.houseFloor}
            </if>
            <if test="record.faced != null and !&quot;&quot;.equals(record.faced)">
                and faced = #{record.faced}
            </if>
            <if test="record.decoration != null and !&quot;&quot;.equals(record.decoration)">
                and decoration = #{record.decoration}
            </if>
            <if test="record.checkIn != null and !&quot;&quot;.equals(record.checkIn)">
                and check_in = #{record.checkIn}
            </if>
            <if test="record.elevator != null and !&quot;&quot;.equals(record.elevator)">
                and elevator = #{record.elevator}
            </if>
            <if test="record.rentingType != null and !&quot;&quot;.equals(record.rentingType)">
                and renting_type = #{record.rentingType}
            </if>
            <if test="record.partCode != null and !&quot;&quot;.equals(record.partCode)">
                and part_code = #{record.partCode}
            </if>
            <if test="record.houseIntroduce != null and !&quot;&quot;.equals(record.houseIntroduce)">
                and house_introduce = #{record.houseIntroduce}
            </if>
            <if test="record.housekeeper != null and !&quot;&quot;.equals(record.housekeeper)">
                and housekeeper = #{record.housekeeper}
            </if>
            <if test="record.retrieval != null and !&quot;&quot;.equals(record.retrieval)">
                and retrieval = #{record.retrieval}
            </if>
            <if test="record.housingDistrict != null and !&quot;&quot;.equals(record.housingDistrict)">
                and housing_district = #{record.housingDistrict}
            </if>
            <if test="record.streetCode != null and !&quot;&quot;.equals(record.streetCode)">
                and street_code = #{record.streetCode}
            </if>
            <if test="record.businessCircleCode != null and !&quot;&quot;.equals(record.businessCircleCode)">
                and business_circle_code = #{record.businessCircleCode}
            </if>
            <if test="record.districtCode != null and !&quot;&quot;.equals(record.districtCode)">
                and district_code = #{record.districtCode}
            </if>
            <if test="record.cityCode != null and !&quot;&quot;.equals(record.cityCode)">
                and city_code = #{record.cityCode}
            </if>
            <if test="record.lat != null and !&quot;&quot;.equals(record.lat)">
                and lat = #{record.lat}
            </if>
            <if test="record.lng != null and !&quot;&quot;.equals(record.lng)">
                and lng = #{record.lng}
            </if>
            <if test="record.remark != null and !&quot;&quot;.equals(record.remark)">
                and remark = #{record.remark}
            </if>
            <if test="record.rank != null and !&quot;&quot;.equals(record.rank)">
                and rank = #{record.rank}
            </if>
            <if test="record.hot != null and !&quot;&quot;.equals(record.hot)">
                and hot = #{record.hot}
            </if>
            <if test="record.recommendFlag != null and !&quot;&quot;.equals(record.recommendFlag)">
                and recommend_flag = #{record.recommendFlag}
            </if>
            <if test="record.selectedFlag != null and !&quot;&quot;.equals(record.selectedFlag)">
                and selected_flag = #{record.selectedFlag}
            </if>
            <if test="record.address != null and !&quot;&quot;.equals(record.address)">
                and address = #{record.address}
            </if>
            <if test="record.addressDetail != null and !&quot;&quot;.equals(record.addressDetail)">
                and address_detail = #{record.addressDetail}
            </if>
            <if test="record.statusFlag != null and !&quot;&quot;.equals(record.statusFlag)">
                and status_flag = #{record.statusFlag}
            </if>
            <if test="record.buildYear != null and !&quot;&quot;.equals(record.buildYear)">
                and build_year = #{record.buildYear}
            </if>
            <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
                and create_time = #{record.createTime}
            </if>
            <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
                and update_time = #{record.updateTime}
            </if>
            <if test="record.lineCode != null and !&quot;&quot;.equals(record.lineCode)">
                and line_code = #{record.lineCode}
            </if>
            <if test="record.stationCode != null and !&quot;&quot;.equals(record.stationCode)">
                and station_code = #{record.stationCode}
            </if>
            <if test="record.phone != null and !&quot;&quot;.equals(record.phone)">
                and phone = #{record.phone}
            </if>

            <if test="record.roomFilter != null and !&quot;&quot;.equals(record.roomFilter)">
                <if test="record.roomFilter &lt; 4">
                    and room = #{record.roomFilter}
                </if>

                <if test="record.roomFilter == 4">
                    <![CDATA[ and room >= #{record.roomFilter}]]>
                </if>

            </if>

            <if test="record.minPrice != null and !&quot;&quot;.equals(record.minPrice)
            and record.maxPrice != null and !&quot;&quot;.equals(record.maxPrice)">
                <![CDATA[ and price >= #{record.minPrice} ]]>
                <![CDATA[ and price <= #{record.maxPrice} ]]>
            </if>

            <if test="record.minArea != null and !&quot;&quot;.equals(record.minArea)
            and record.maxArea != null and !&quot;&quot;.equals(record.maxArea)">
                <![CDATA[ and house_area >= #{record.minArea} ]]>
                <![CDATA[ and house_area <= #{record.maxArea} ]]>
            </if>

            <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
                <trim prefix="and (" suffix=")" prefixOverrides="OR">
                    OR title LIKE concat('%',#{record.searchKey},'%')
                    OR retrieval LIKE concat('%',#{record.searchKey},'%')
                </trim>
            </if>

            <if test="record.featureCodeKey != null and !&quot;&quot;.equals(record.featureCodeKey)">
                <trim prefix="and (" suffix=")" prefixOverrides="OR">
                    <foreach item="item" index="index" collection="record.featureCodeKey.split(',')">
                        OR FIND_IN_SET(#{item},feature_code)
                    </foreach>
                </trim>
            </if>

            <if test="record.distance != null and !&quot;&quot;.equals(record.distance)">

                <![CDATA[
                   AND ( ACOS(
                SIN((#{record.latKey} * PI()) / 180) * SIN((lat * PI()) / 180) +
                COS((#{record.latKey} * PI()) / 180) * COS((lat * PI()) / 180) * COS(
                (#{record.lngKey} * PI()) / 180 - (lng * PI()) / 180
                )
                ) * 6371.004 )  <= #{record.distance}
                    AND lng > #{record.lngKey} - 2
                    AND lng < #{record.lngKey} + 2
                    AND lat > #{record.latKey} - 2
                    AND lat < #{record.latKey} + 2
                    ]]>
            </if>


        </where>
        order by rank desc , id desc
    </select>
    <select id="queryAllHouseInfo" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.HouseInfo">
        select
        <include refid="Base_Column_List"/>
        from house_info
        <where>
            and del_flag = 'N'
            <if test="id != null and !&quot;&quot;.equals(id)">
                and id = #{id}
            </if>
            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
                and del_flag = #{delFlag}
            </if>
            <if test="title != null and !&quot;&quot;.equals(title)">
                and title = #{title}
            </if>
            <if test="price != null and !&quot;&quot;.equals(price)">
                and price = #{price}
            </if>
            <if test="payMode != null and !&quot;&quot;.equals(payMode)">
                and pay_mode = #{payMode}
            </if>
            <if test="featureCode != null and !&quot;&quot;.equals(featureCode)">
                and feature_code = #{featureCode}
            </if>
            <if test="houseArea != null and !&quot;&quot;.equals(houseArea)">
                and house_area = #{houseArea}
            </if>
            <if test="room != null and !&quot;&quot;.equals(room)">
                and room = #{room}
            </if>
            <if test="hall != null and !&quot;&quot;.equals(hall)">
                and hall = #{hall}
            </if>
            <if test="guard != null and !&quot;&quot;.equals(guard)">
                and guard = #{guard}
            </if>
            <if test="totalFloor != null and !&quot;&quot;.equals(totalFloor)">
                and total_floor = #{totalFloor}
            </if>
            <if test="houseFloor != null and !&quot;&quot;.equals(houseFloor)">
                and house_floor = #{houseFloor}
            </if>
            <if test="faced != null and !&quot;&quot;.equals(faced)">
                and faced = #{faced}
            </if>
            <if test="decoration != null and !&quot;&quot;.equals(decoration)">
                and decoration = #{decoration}
            </if>
            <if test="checkIn != null and !&quot;&quot;.equals(checkIn)">
                and check_in = #{checkIn}
            </if>
            <if test="elevator != null and !&quot;&quot;.equals(elevator)">
                and elevator = #{elevator}
            </if>
            <if test="rentingType != null and !&quot;&quot;.equals(rentingType)">
                and renting_type = #{rentingType}
            </if>
            <if test="partCode != null and !&quot;&quot;.equals(partCode)">
                and part_code = #{partCode}
            </if>
            <if test="houseIntroduce != null and !&quot;&quot;.equals(houseIntroduce)">
                and house_introduce = #{houseIntroduce}
            </if>
            <if test="housekeeper != null and !&quot;&quot;.equals(housekeeper)">
                and housekeeper = #{housekeeper}
            </if>
            <if test="retrieval != null and !&quot;&quot;.equals(retrieval)">
                and retrieval = #{retrieval}
            </if>
            <if test="housingDistrict != null and !&quot;&quot;.equals(housingDistrict)">
                and housing_district = #{housingDistrict}
            </if>
            <if test="streetCode != null and !&quot;&quot;.equals(streetCode)">
                and street_code = #{streetCode}
            </if>
            <if test="businessCircleCode != null and !&quot;&quot;.equals(businessCircleCode)">
                and business_circle_code = #{businessCircleCode}
            </if>
            <if test="districtCode != null and !&quot;&quot;.equals(districtCode)">
                and district_code = #{districtCode}
            </if>
            <if test="cityCode != null and !&quot;&quot;.equals(cityCode)">
                and city_code = #{cityCode}
            </if>
            <if test="lat != null and !&quot;&quot;.equals(lat)">
                and lat = #{lat}
            </if>
            <if test="lng != null and !&quot;&quot;.equals(lng)">
                and lng = #{lng}
            </if>
            <if test="remark != null and !&quot;&quot;.equals(remark)">
                and remark = #{remark}
            </if>
            <if test="rank != null and !&quot;&quot;.equals(rank)">
                and rank = #{rank}
            </if>
            <if test="hot != null and !&quot;&quot;.equals(hot)">
                and hot = #{hot}
            </if>
            <if test="recommendFlag != null and !&quot;&quot;.equals(recommendFlag)">
                and recommend_flag = #{recommendFlag}
            </if>
            <if test="selectedFlag != null and !&quot;&quot;.equals(selectedFlag)">
                and selected_flag = #{selectedFlag}
            </if>
            <if test="address != null and !&quot;&quot;.equals(address)">
                and address = #{address}
            </if>
            <if test="addressDetail != null and !&quot;&quot;.equals(addressDetail)">
                and address_detail = #{addressDetail}
            </if>
            <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
                and status_flag = #{statusFlag}
            </if>
            <if test="buildYear != null and !&quot;&quot;.equals(buildYear)">
                and build_year = #{buildYear}
            </if>
            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
                and create_time = #{createTime}
            </if>
            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
                and update_time = #{updateTime}
            </if>
            <if test="lineCode != null and !&quot;&quot;.equals(lineCode)">
                and line_code = #{lineCode}
            </if>
            <if test="stationCode != null and !&quot;&quot;.equals(stationCode)">
                and station_code = #{stationCode}
            </if>
            <if test="phone != null and !&quot;&quot;.equals(phone)">
                and phone = #{phone}
            </if>
        </where>
        order by id desc
    </select>
    <select id="queryHouseInfo" parameterType="java.util.Map" resultMap="houseInfoPageResultMap">
        select
        <include refid="Base_Column_List"/>
        from house_info
        <where>
            and del_flag = 'N'
            <if test="id != null and !&quot;&quot;.equals(id)">
                and id = #{id}
            </if>
            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
                and del_flag = #{delFlag}
            </if>
            <if test="title != null and !&quot;&quot;.equals(title)">
                and title = #{title}
            </if>
            <if test="price != null and !&quot;&quot;.equals(price)">
                and price = #{price}
            </if>
            <if test="payMode != null and !&quot;&quot;.equals(payMode)">
                and pay_mode = #{payMode}
            </if>
            <if test="featureCode != null and !&quot;&quot;.equals(featureCode)">
                and feature_code = #{featureCode}
            </if>
            <if test="houseArea != null and !&quot;&quot;.equals(houseArea)">
                and house_area = #{houseArea}
            </if>
            <if test="room != null and !&quot;&quot;.equals(room)">
                and room = #{room}
            </if>
            <if test="hall != null and !&quot;&quot;.equals(hall)">
                and hall = #{hall}
            </if>
            <if test="guard != null and !&quot;&quot;.equals(guard)">
                and guard = #{guard}
            </if>
            <if test="totalFloor != null and !&quot;&quot;.equals(totalFloor)">
                and total_floor = #{totalFloor}
            </if>
            <if test="houseFloor != null and !&quot;&quot;.equals(houseFloor)">
                and house_floor = #{houseFloor}
            </if>
            <if test="faced != null and !&quot;&quot;.equals(faced)">
                and faced = #{faced}
            </if>
            <if test="decoration != null and !&quot;&quot;.equals(decoration)">
                and decoration = #{decoration}
            </if>
            <if test="checkIn != null and !&quot;&quot;.equals(checkIn)">
                and check_in = #{checkIn}
            </if>
            <if test="elevator != null and !&quot;&quot;.equals(elevator)">
                and elevator = #{elevator}
            </if>
            <if test="rentingType != null and !&quot;&quot;.equals(rentingType)">
                and renting_type = #{rentingType}
            </if>
            <if test="partCode != null and !&quot;&quot;.equals(partCode)">
                and part_code = #{partCode}
            </if>
            <if test="houseIntroduce != null and !&quot;&quot;.equals(houseIntroduce)">
                and house_introduce = #{houseIntroduce}
            </if>
            <if test="housekeeper != null and !&quot;&quot;.equals(housekeeper)">
                and housekeeper = #{housekeeper}
            </if>
            <if test="retrieval != null and !&quot;&quot;.equals(retrieval)">
                and retrieval = #{retrieval}
            </if>
            <if test="housingDistrict != null and !&quot;&quot;.equals(housingDistrict)">
                and housing_district = #{housingDistrict}
            </if>
            <if test="streetCode != null and !&quot;&quot;.equals(streetCode)">
                and street_code = #{streetCode}
            </if>
            <if test="businessCircleCode != null and !&quot;&quot;.equals(businessCircleCode)">
                and business_circle_code = #{businessCircleCode}
            </if>
            <if test="districtCode != null and !&quot;&quot;.equals(districtCode)">
                and district_code = #{districtCode}
            </if>
            <if test="cityCode != null and !&quot;&quot;.equals(cityCode)">
                and city_code = #{cityCode}
            </if>
            <if test="lat != null and !&quot;&quot;.equals(lat)">
                and lat = #{lat}
            </if>
            <if test="lng != null and !&quot;&quot;.equals(lng)">
                and lng = #{lng}
            </if>
            <if test="remark != null and !&quot;&quot;.equals(remark)">
                and remark = #{remark}
            </if>
            <if test="rank != null and !&quot;&quot;.equals(rank)">
                and rank = #{rank}
            </if>
            <if test="hot != null and !&quot;&quot;.equals(hot)">
                and hot = #{hot}
            </if>
            <if test="recommendFlag != null and !&quot;&quot;.equals(recommendFlag)">
                and recommend_flag = #{recommendFlag}
            </if>
            <if test="selectedFlag != null and !&quot;&quot;.equals(selectedFlag)">
                and selected_flag = #{selectedFlag}
            </if>
            <if test="address != null and !&quot;&quot;.equals(address)">
                and address = #{address}
            </if>
            <if test="addressDetail != null and !&quot;&quot;.equals(addressDetail)">
                and address_detail = #{addressDetail}
            </if>
            <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
                and status_flag = #{statusFlag}
            </if>
            <if test="buildYear != null and !&quot;&quot;.equals(buildYear)">
                and build_year = #{buildYear}
            </if>
            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
                and create_time = #{createTime}
            </if>
            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
                and update_time = #{updateTime}
            </if>

            <if test="lineCode != null and !&quot;&quot;.equals(lineCode)">
                and line_code = #{lineCode}
            </if>
            <if test="stationCode != null and !&quot;&quot;.equals(stationCode)">
                and station_code = #{stationCode}
            </if>
            <if test="phone != null and !&quot;&quot;.equals(phone)">
                and phone = #{phone}
            </if>
        </where>
        LIMIT 1
    </select>
    <select id="queryHouseInfoDetail" parameterType="java.util.Map" resultMap="houseInfoDetailResultMap">
        select
        <include refid="Base_Column_List"/>
        from house_info
        <where>
            and del_flag = 'N'
            <if test="id != null and !&quot;&quot;.equals(id)">
                and id = #{id}
            </if>
            <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
                and del_flag = #{delFlag}
            </if>
            <if test="title != null and !&quot;&quot;.equals(title)">
                and title = #{title}
            </if>
            <if test="price != null and !&quot;&quot;.equals(price)">
                and price = #{price}
            </if>
            <if test="payMode != null and !&quot;&quot;.equals(payMode)">
                and pay_mode = #{payMode}
            </if>
            <if test="featureCode != null and !&quot;&quot;.equals(featureCode)">
                and feature_code = #{featureCode}
            </if>
            <if test="houseArea != null and !&quot;&quot;.equals(houseArea)">
                and house_area = #{houseArea}
            </if>
            <if test="room != null and !&quot;&quot;.equals(room)">
                and room = #{room}
            </if>
            <if test="hall != null and !&quot;&quot;.equals(hall)">
                and hall = #{hall}
            </if>
            <if test="guard != null and !&quot;&quot;.equals(guard)">
                and guard = #{guard}
            </if>
            <if test="totalFloor != null and !&quot;&quot;.equals(totalFloor)">
                and total_floor = #{totalFloor}
            </if>
            <if test="houseFloor != null and !&quot;&quot;.equals(houseFloor)">
                and house_floor = #{houseFloor}
            </if>
            <if test="faced != null and !&quot;&quot;.equals(faced)">
                and faced = #{faced}
            </if>
            <if test="decoration != null and !&quot;&quot;.equals(decoration)">
                and decoration = #{decoration}
            </if>
            <if test="checkIn != null and !&quot;&quot;.equals(checkIn)">
                and check_in = #{checkIn}
            </if>
            <if test="elevator != null and !&quot;&quot;.equals(elevator)">
                and elevator = #{elevator}
            </if>
            <if test="rentingType != null and !&quot;&quot;.equals(rentingType)">
                and renting_type = #{rentingType}
            </if>
            <if test="partCode != null and !&quot;&quot;.equals(partCode)">
                and part_code = #{partCode}
            </if>
            <if test="houseIntroduce != null and !&quot;&quot;.equals(houseIntroduce)">
                and house_introduce = #{houseIntroduce}
            </if>
            <if test="housekeeper != null and !&quot;&quot;.equals(housekeeper)">
                and housekeeper = #{housekeeper}
            </if>
            <if test="retrieval != null and !&quot;&quot;.equals(retrieval)">
                and retrieval = #{retrieval}
            </if>
            <if test="housingDistrict != null and !&quot;&quot;.equals(housingDistrict)">
                and housing_district = #{housingDistrict}
            </if>
            <if test="streetCode != null and !&quot;&quot;.equals(streetCode)">
                and street_code = #{streetCode}
            </if>
            <if test="businessCircleCode != null and !&quot;&quot;.equals(businessCircleCode)">
                and business_circle_code = #{businessCircleCode}
            </if>
            <if test="districtCode != null and !&quot;&quot;.equals(districtCode)">
                and district_code = #{districtCode}
            </if>
            <if test="cityCode != null and !&quot;&quot;.equals(cityCode)">
                and city_code = #{cityCode}
            </if>
            <if test="lat != null and !&quot;&quot;.equals(lat)">
                and lat = #{lat}
            </if>
            <if test="lng != null and !&quot;&quot;.equals(lng)">
                and lng = #{lng}
            </if>
            <if test="remark != null and !&quot;&quot;.equals(remark)">
                and remark = #{remark}
            </if>
            <if test="rank != null and !&quot;&quot;.equals(rank)">
                and rank = #{rank}
            </if>
            <if test="hot != null and !&quot;&quot;.equals(hot)">
                and hot = #{hot}
            </if>
            <if test="recommendFlag != null and !&quot;&quot;.equals(recommendFlag)">
                and recommend_flag = #{recommendFlag}
            </if>
            <if test="selectedFlag != null and !&quot;&quot;.equals(selectedFlag)">
                and selected_flag = #{selectedFlag}
            </if>
            <if test="address != null and !&quot;&quot;.equals(address)">
                and address = #{address}
            </if>
            <if test="addressDetail != null and !&quot;&quot;.equals(addressDetail)">
                and address_detail = #{addressDetail}
            </if>
            <if test="statusFlag != null and !&quot;&quot;.equals(statusFlag)">
                and status_flag = #{statusFlag}
            </if>
            <if test="buildYear != null and !&quot;&quot;.equals(buildYear)">
                and build_year = #{buildYear}
            </if>
            <if test="createTime != null and !&quot;&quot;.equals(createTime)">
                and create_time = #{createTime}
            </if>
            <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
                and update_time = #{updateTime}
            </if>
            <if test="lineCode != null and !&quot;&quot;.equals(lineCode)">
                and line_code = #{lineCode}
            </if>
            <if test="stationCode != null and !&quot;&quot;.equals(stationCode)">
                and station_code = #{stationCode}
            </if>
            <if test="phone != null and !&quot;&quot;.equals(phone)">
                and phone = #{phone}
            </if>
        </where>
        LIMIT 1
    </select>
    <update id="delete">
        UPDATE house_info SET del_flag = 'Y'
        <where>
            AND id = #{id}
        </where>
    </update>
    <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.HouseInfo">
        select
        <include refid="Base_Column_List"/>
        from house_info
        <where>
            and del_flag = 'N'
        </where>
        order by id desc
    </select>


    <resultMap id="houseInfoDetailResultMap" type="com.izouma.awesomeadmin.model.HouseInfo" extends="BaseResultMap">

        <association property="keeper" javaType="com.izouma.awesomeadmin.model.HouseKeeper"
                     select="com.izouma.awesomeadmin.dao.HouseKeeperMapper.queryHouseKeeper"
                     column="{id = housekeeper}">
        </association>

        <association property="housingDistrictInfo" javaType="com.izouma.awesomeadmin.model.HousingDistrict"
                     select="com.izouma.awesomeadmin.dao.HousingDistrictMapper.queryHousingDistrict"
                     column="{code = housing_district}">
        </association>
        <collection property="houseFeatures" ofType="com.izouma.awesomeadmin.model.HouseFeature"
                    select="com.izouma.awesomeadmin.dao.HouseFeatureMapper.queryAllHouseFeature"
                    column="{codeStr = feature_code}">
        </collection>
        <collection property="houseParts" ofType="com.izouma.awesomeadmin.model.HousePart"
                    select="com.izouma.awesomeadmin.dao.HousePartMapper.queryAllHousePart"
                    column="{codeStr = part_code}">
        </collection>
        <collection property="houseImages" ofType="com.izouma.awesomeadmin.model.HouseImage"
                    select="com.izouma.awesomeadmin.dao.HouseImageMapper.queryAllHouseImage" column="{houseId = id}">
        </collection>
    </resultMap>

    <resultMap id="houseInfoPageResultMap" type="com.izouma.awesomeadmin.model.HouseInfo" extends="BaseResultMap">
        <collection property="houseImages" ofType="com.izouma.awesomeadmin.model.HouseImage"
                    select="com.izouma.awesomeadmin.dao.HouseImageMapper.queryAllHouseImage" column="{houseId = id}">
        </collection>
        <collection property="houseFeatures" ofType="com.izouma.awesomeadmin.model.HouseFeature"
                    select="com.izouma.awesomeadmin.dao.HouseFeatureMapper.queryAllHouseFeature"
                    column="{codeStr = feature_code}">
        </collection>
    </resultMap>

</mapper>

