linwe
2024-06-24 60e1a68fa319cd9e92d632bf678b31af20973508
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -406,8 +406,11 @@
        FROM
        jczz_house jh
        LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
        WHERE
        jda.nei_code = #{code}
       <where>
           jda.nei_code in
           <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
               #{code}
           </foreach>
        AND jh.is_deleted = 0
        <if test="buildingCode != null  and buildingCode != ''">
            and jda.building_code=#{buildingCode}
@@ -444,6 +447,8 @@
            )
        </if>
        ) a
       </where>
    </select>
@@ -456,8 +461,11 @@
        LEFT JOIN jczz_house jh ON jda.address_code = jh.house_code AND jh.is_deleted = 0
        LEFT JOIN jczz_grid jg on jg.grid_code = jh.grid_code and jg.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        WHERE
        jda.nei_code = #{code}
        <where>
            jda.nei_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
        and jda.doorplate_type = '户室牌'
        <choose>
            <when test="(buildingCode != null  and buildingCode != '') or
@@ -508,9 +516,7 @@
                        <otherwise>
                            <choose>
                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                    and
                                    (
                                    jg.grid_code in
                                        and ( jg.grid_code in
                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                        #{code}
                                    </foreach>
@@ -523,11 +529,7 @@
                                </when>
                                <otherwise>
                                    and
                                    (
                                    jg.grid_code in ('')
                                    or
                                    jpag.community_code in ('')
                                    )
                                        ( jg.grid_code in ('') or jpag.community_code in ('') )
                                </otherwise>
                            </choose>
                        </otherwise>
@@ -535,6 +537,8 @@
                </if>
            </otherwise>
        </choose>
        </where>
    </select>
@@ -544,8 +548,11 @@
        FROM
        jczz_household jhh
        LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jhh.house_code
        WHERE
        jda.nei_code = #{code}
        <where>
            jda.nei_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
        AND jhh.is_deleted = 0
        and jda.doorplate_type = '户室牌'
        <if test="buildingCode != null  and buildingCode != ''">
@@ -583,6 +590,7 @@
            jc.res_police_user_id like concat('%',#{userId},'%'))
            )
        </if>
        </where>
    </select>
@@ -596,8 +604,11 @@
        FROM
        jczz_house jh
        LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jh.house_code
        WHERE
        jda.nei_code = #{code}
        <where>
            jda.nei_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
        AND jh.is_deleted = 0
        AND jda.unit_code is not null
        <if test="buildingCode != null  and buildingCode != ''">
@@ -635,8 +646,7 @@
            )
        </if>
        ) a
        </where>
    </select>
    <select id="getHouseBuilding" resultType="java.lang.String">
@@ -860,67 +870,11 @@
            LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
            LEFT JOIN jczz_user_house_label juhl ON juhl.house_code = jh.house_code and juhl.lable_type = 2
            where jda.doorplate_type = '户室牌'
            <if test="house.communityCode != null  and house.communityCode != ''">
                and jda.nei_code = #{house.communityCode}
            </if>
            <if test="isAdministrator==2">
                <choose>
                    <when test="house.roleName != null and house.roleName != ''">
                        <if test="house.roleName=='wgy'">
                            <choose>
                                <when test="gridCodeList !=null and gridCodeList.size()>0">
                                    and jh.grid_code in
                                    <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
            <if test="communityCodeList != null">
                and jda.nei_code in
                <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                                        #{code}
                                    </foreach>
                                </when>
                                <otherwise>
                                    and jh.grid_code in ('')
                                </otherwise>
                            </choose>
                        </if>
                        <if test="house.roleName=='mj'">
                            <choose>
                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                    and jpag.community_code in
                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")"
                                             separator=",">
                                        #{code}
                                    </foreach>
                                </when>
                                <otherwise>
                                    and jpag.community_code in ('')
                                </otherwise>
                            </choose>
                        </if>
                    </when>
                    <otherwise>
                        <choose>
                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
                                and
                                (
                                jg.grid_code in
                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                                or
                                jpag.community_code in
                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                                )
                            </when>
                            <otherwise>
                                and
                                (
                                jg.grid_code in ('')
                                or
                                jpag.community_code in ('')
                                )
                            </otherwise>
                        </choose>
                    </otherwise>
                </choose>
            </if>
            group by juhl.label_name
        ) b on a.label_name =b.labelName