linwe
2023-12-18 ede1ff3b4482bb7e712d1a8563a56a66d349321c
住户和房屋列表接口优化
3 files modified
75 ■■■■■ changed files
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml 47 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml 25 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.xml 3 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -76,6 +76,51 @@
    <!--房屋详情-->
    <resultMap id="houseAndHouseLabelMap" 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" select="selectHouseLabelPage"  column="house_code"
                    ofType="org.springblade.modules.house.vo.UserHouseLabelVO" autoMapping="true">
        </collection>
    </resultMap>
    <select id="selectHouseLabelPage" resultType="org.springblade.modules.house.vo.HouseholdLabelVO">
        select
            id,
            house_code,
            label_id,
            label_name,
            color,
            remark cremark,
            user_id,
            lable_type,
            household_id
        from
            jczz_user_house_label
        where house_code = #{houseCode} and lable_type = 2
    </select>
    <!--房屋详情-->
    <resultMap id="housePageAndHouseLabelMap" type="org.springblade.modules.house.vo.HouseVO" autoMapping="true">
        <id property="id" column="id"/>
        <collection property="userHouseLabelVOList" javaType="java.util.List"
                    ofType="org.springblade.modules.house.vo.UserHouseLabelVO" autoMapping="true">
@@ -85,7 +130,7 @@
    </resultMap>
    <!--自定义分页列表-->
    <select id="selectHousePage" resultType="org.springblade.modules.house.vo.HouseVO">
    <select id="selectHousePage" resultMap="houseAndHouseLabelMap">
        select jh.*,concat(building," ",unit," ",room) as address from jczz_house jh
        left join jczz_doorplate_address jda on jda.address_code = jh.house_code
        where is_deleted = 0
src/main/java/org/springblade/modules/house/mapper/HouseholdMapper.xml
@@ -89,8 +89,31 @@
        </collection>
    </resultMap>
    <resultMap id="householdPageAndLabelMap" type="org.springblade.modules.house.vo.HouseholdVO" autoMapping="true">
        <id property="id" column="id"/>
        <collection property="householdLabelList" javaType="java.util.List" select="selectHouseLabelPage"  column="id"
                    ofType="org.springblade.modules.house.vo.HouseholdLabelVO" autoMapping="true">
        </collection>
    </resultMap>
    <select id="selectHouseLabelPage" resultType="org.springblade.modules.house.vo.HouseholdLabelVO">
        select
        id,
        house_code,
        label_id,
        label_name,
        color,
        remark cremark,
        user_id,
        lable_type,
        household_id
        from
        jczz_user_house_label
        where household_id = #{id} and lable_type = 1
    </select>
    <!--自定义分页数据查询-->
    <select id="selectHouseholdPage" resultType="org.springblade.modules.house.vo.HouseholdVO">
    <select id="selectHouseholdPage" resultMap="householdPageAndLabelMap">
        select
        jh.*,
        jhs.district_name aoiName,
src/main/java/org/springblade/modules/house/mapper/UserHouseLabelMapper.xml
@@ -22,7 +22,8 @@
            color,
            remark,
            user_id,
            lable_type
            lable_type,
            household_id
        from
            jczz_user_house_label
    </sql>