java110
2020-12-15 bec5154a10be4b138e24cc2b37494c003b9f10d6
优化代码
2个文件已修改
47 ■■■■■ 已修改文件
java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/owner/QueryOwnersListener.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/user/OwnerServiceDaoImplMapper.xml
@@ -118,8 +118,6 @@
    </insert>
    <!-- 查询业主信息 add by wuxw 2018-07-03 -->
    <select id="getOwnerInfo" parameterType="Map" resultType="Map">
        select t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,
@@ -127,21 +125,33 @@
        t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,
        t.owner_type_cd ownerTypeCd,t.create_time createTime,t.community_id,
        t.community_id communityId,t.id_card, t.id_card idCard,t.state,td.name ownerTypeName
        , borr.room_id roomId
        from
        building_owner t
        left join t_dict td on td.table_name = 'building_owner' and td.`table_columns` = 'owner_type_cd' and td.status_cd = t.owner_type_cd
        left join building_owner_room_rel borr on  borr.status_cd = '0' and t.owner_id = borr.owner_id
        <if test="roomIds != null">
            , borr.room_id roomId
        </if>
        from building_owner t,t_dict td
        <if test="roomId != null and roomId != ''">
            ,building_owner_room_rel borr
        </if>
        <if test="roomIds != null ">
            ,building_owner_room_rel borr
        </if>
        where 1 =1
        <if test="roomId != null and roomId != ''">
            and t.owner_id = borr.owner_id
            and borr.status_cd = '0'
            and borr.room_id = #{roomId}
        </if>
        <if test="roomIds != null">
            and t.owner_id = borr.owner_id
            and borr.status_cd = '0'
            and borr.room_id in
            <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
        and td.table_name = 'building_owner'
        and td.`table_columns` = 'owner_type_cd'
        and td.status_cd = t.owner_type_cd
        <if test="sex !=null">
            and t.sex= #{sex}
        </if>
@@ -206,15 +216,22 @@
    <!-- 查询业主信息 add by wuxw 2018-07-03 -->
    <select id="getOwnerInfoCount" parameterType="Map" resultType="Map">
        select count(1) count
        from
        building_owner t
        left join t_dict td on td.table_name = 'building_owner' and td.`table_columns` = 'owner_type_cd' and td.status_cd = t.owner_type_cd
        left join building_owner_room_rel borr on  borr.status_cd = '0' and t.owner_id = borr.owner_id
        from building_owner t
        <if test="roomId != null and roomId != ''">
            ,building_owner_room_rel borr
        </if>
        <if test="roomIds != null ">
            ,building_owner_room_rel borr
        </if>
        where 1 =1
        <if test="roomId != null and roomId != ''">
            and t.owner_id = borr.owner_id
            and borr.status_cd = '0'
            and borr.room_id = #{roomId}
        </if>
        <if test="roomIds != null">
            and t.owner_id = borr.owner_id
            and borr.status_cd = '0'
            and borr.room_id in
            <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
                #{item}
@@ -267,12 +284,6 @@
        </if>
        <if test="ownerTypeCd !=null and ownerTypeCd != ''">
            and t.owner_type_cd= #{ownerTypeCd}
        </if>
        <if test="ownerTypeCds != null">
            and t.owner_type_cd in
            <foreach collection="ownerTypeCds" item="item" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
    </select>
service-api/src/main/java/com/java110/api/listener/owner/QueryOwnersListener.java
@@ -106,7 +106,7 @@
                }
                ownerDtos.add(ownerDto);
            }
            freshRoomInfo(ownerDtos);
            //freshRoomInfo(ownerDtos);
            apiOwnerVo.setOwners(BeanConvertUtil.covertBeanList(ownerDtos, ApiOwnerDataVo.class));
        }