linwei
2024-01-19 d46ca134f82fd106bfbbbd71aef7184805e6d7e7
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -141,43 +141,107 @@
        left join jczz_grid_range jgr on jgr.house_code = jh.house_code
        left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0
        left join blade_region br on br.code = jg.community_code
        where jh.is_deleted = 0
        <if test="house.id != null ">and jh.id = #{house.id}</if>
        <if test="house.streetCode != null and house.streetCode != ''">
            and jda.town_street_code like concat('%',#{house.streetCode},'%')
        </if>
        <if test="house.houseCode != null  and house.houseCode != ''">and jh.house_code = #{house.houseCode}</if>
        <if test="house.districtCode != null  and house.districtCode != ''">and jh.district_code =
            #{house.districtCode}
        </if>
        <if test="house.districtName != null  and house.districtName != ''">
            and jh.district_name like concat('%',#{house.districtName},'%')
        </if>
        <if test="house.townStreetName!=null and house.townStreetName!=''">
            and br.town_name like concat('%',#{house.townStreetName},'%')
        </if>
        <if test="house.neiName!=null and house.neiName!=''">
            and br.name like concat('%',#{house.neiName},'%')
        </if>
        <if test="house.houseName != null  and house.houseName != ''">and jh.house_name like
            concat('%',#{house.houseName},'%')
        </if>
        <if test="house.phone != null  and house.phone != ''">and jh.phone = #{house.phone}</if>
        <if test="house.area != null ">and jh.area = #{house.area}</if>
        <if test="house.propertyPrice != null ">and jh.property_price = #{house.propertyPrice}</if>
        <if test="house.serviceDue != null ">and jh.service_due = #{house.serviceDue}</if>
        <if test="house.floor != null ">and jh.floor = #{house.floor}</if>
        <if test="house.building != null  and house.building != ''">and jh.building = #{house.building}</if>
        <if test="house.unit != null  and house.unit != ''">and jh.unit = #{house.unit}</if>
        <if test="house.room != null  and house.room != ''">and jh.room = #{house.room}</if>
        <if test="house.buildingNo != null ">and jh.building_no = #{house.buildingNo}</if>
        <if test="house.regionCode != null and house.regionCode !='' ">
            and jg.community_code like concat('%',#{house.regionCode},'%')
        </if>
        <where>
            <if test="house.id != null ">and jh.id = #{house.id}</if>
            <if test="house.streetCode != null and house.streetCode != ''">
                and jda.town_street_code like concat('%',#{house.streetCode},'%')
            </if>
            <if test="house.houseCode != null  and house.houseCode != ''">and jh.house_code = #{house.houseCode}</if>
            <if test="house.districtCode != null  and house.districtCode != ''">and jh.district_code =
                #{house.districtCode}
            </if>
            <if test="house.districtName != null  and house.districtName != ''">
                and jh.district_name like concat('%',#{house.districtName},'%')
            </if>
            <if test="house.townStreetName!=null and house.townStreetName!=''">
                and br.town_name like concat('%',#{house.townStreetName},'%')
            </if>
            <if test="house.neiName!=null and house.neiName!=''">
                and br.name like concat('%',#{house.neiName},'%')
            </if>
            <if test="house.houseName != null  and house.houseName != ''">and jh.house_name like
                concat('%',#{house.houseName},'%')
            </if>
            <if test="house.phone != null  and house.phone != ''">and jh.phone = #{house.phone}</if>
            <if test="house.area != null ">and jh.area = #{house.area}</if>
            <if test="house.propertyPrice != null ">and jh.property_price = #{house.propertyPrice}</if>
            <if test="house.serviceDue != null ">and jh.service_due = #{house.serviceDue}</if>
            <if test="house.floor != null ">and jh.floor = #{house.floor}</if>
            <if test="house.building != null  and house.building != ''">and jh.building = #{house.building}</if>
            <if test="house.unit != null  and house.unit != ''">and jh.unit = #{house.unit}</if>
            <if test="house.room != null  and house.room != ''">and jh.room = #{house.room}</if>
            <if test="house.buildingNo != null ">and jh.building_no = #{house.buildingNo}</if>
            <if test="isAdministrator==2">
                <choose>
                    <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                        and jg.community_code in
                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                            #{code}
                        </foreach>
                    </when>
                    <otherwise>
                        and jg.community_code in ('')
                    </otherwise>
                </choose>
            </if>
            <if test="house.parentId != null ">
                and jh.house_code in (
                SELECT DISTINCT
                juhl.house_code
                FROM
                jczz_user_house_label juhl
                LEFT JOIN jczz_label jl ON juhl.label_id = jl.id
                WHERE
                juhl.lable_type = 2
                <if test="house.labelId != null ">
                    AND jl.id = #{house.labelId}
                </if>
                <if test="house.parentId != null ">
                    AND jl.parent_id = #{house.parentId}
                </if>
                AND juhl.label_id IS NOT NULL
                )
            </if>
            and jh.is_deleted = 0
            ORDER BY
            jh.update_time DESC
        </where>
    </select>
    <!--房屋详情-->
    <resultMap id="houseAndHouseLabelDetailMap" type="org.springblade.modules.house.vo.HouseVO" autoMapping="true">
        <result column="id" property="id"/>
        <result column="house_code" property="houseCode"/>
        <result column="district_code" property="districtCode"/>
        <result column="district_name" property="districtName"/>
        <result column="house_name" property="houseName"/>
        <result column="phone" property="phone"/>
        <result column="area" property="area"/>
        <result column="property_price" property="propertyPrice"/>
        <result column="service_due" property="serviceDue"/>
        <result column="floor" property="floor"/>
        <result column="building" property="building"/>
        <result column="unit" property="unit"/>
        <result column="room" property="room"/>
        <result column="building_no" property="buildingNo"/>
        <result column="image_urls" property="imageUrls"/>
        <result column="create_user" property="createUser"/>
        <result column="created_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="remark" property="remark"/>
        <result column="is_deleted" property="isDeleted"/>
        <collection property="userHouseLabelVOList" javaType="java.util.List"
                    ofType="org.springblade.modules.house.vo.UserHouseLabelVO" autoMapping="true">
            <id property="id" column="cid"/>
            <result property="remark" column="cremark"/>
        </collection>
    </resultMap>
    <!--房屋自定义详情查询-->
    <select id="getHouseDetail" resultMap="houseAndHouseLabelMap">
    <select id="getHouseDetail" resultMap="houseAndHouseLabelDetailMap">
        select
        jh.*,
        jhl.id as cid,jhl.*,jhl.remark as cremark,