linwe
2024-07-29 aeb7d068be92312dcdcea75e1240bcf2a78dd0fe
src/main/java/org/springblade/modules/place/mapper/PlaceCheckMapper.xml
@@ -84,6 +84,8 @@
        jg.grid_name,
        jp.principal,
        jp.principal_phone,
        jp.nine_type,
        jp.is_nine,
        br.town_name,
        br.village_name,
        bu.`name`,
@@ -91,14 +93,23 @@
        jpe.legal_person
        FROM
        jczz_place_check jpc
        LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code
        LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code
        LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code and jp.is_deleted = 0
        LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
        LEFT JOIN blade_region br ON br.`code` = jg.community_code
        LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
        LEFT JOIN blade_user bu ON bu.id = jpc.create_user
        LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id and jpe.is_deleted = 0
        LEFT JOIN blade_user bu ON bu.id = jpc.create_user and bu.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        where jpc.is_deleted = 0
        <if test="placeCheck.houseCode!=null and placeCheck.houseCode!=''">
            and jpc.house_code = #{placeCheck.houseCode}
        </if>
        <if test="placeCheck.hiddenDangerNumber!=null and placeCheck.hiddenDangerNumber==0">
            and jpc.hidden_danger_number  = #{placeCheck.hiddenDangerNumber}
        </if>
        <if test="placeCheck.hiddenDangerNumber!=null and placeCheck.hiddenDangerNumber==1">
            and jpc.hidden_danger_number > 0
        </if>
        <if test="placeCheck.streetName!=null and placeCheck.streetName!=''">
@@ -125,16 +136,75 @@
            and jp.principal_phone like concat('%', #{placeCheck.principalPhone},'%')
        </if>
        <if test="nineTypeList!=null and nineTypeList.size()>0">
            and jp.nine_type in
            <foreach collection="nineTypeList" separator="," open="(" close=")" item="nineType">
                #{nineType}
            </foreach>
        </if>
        <if test="placeCheck.startTime!=null and placeCheck.startTime!=''">
            and date_format(jpc.create_time,'%Y-%m-%d') &gt;= #{placeCheck.startTime}
        </if>
        <if test="placeCheck.endTime!=null and placeCheck.endTime!=''">
            and date_format(jpc.create_time,'%Y-%m-%d') &lt;= #{placeCheck.endTime}
        </if>
        and jpc.create_time=(
        SELECT MAX(create_time) FROM jczz_place_check where jpc.house_code=house_code
        )
        <if test="isAdministrator==2">
            <choose>
                <when test="placeCheck.roleName != null and placeCheck.roleName != ''">
                    <if test="placeCheck.roleName=='wgy'">
                        <choose>
                            <when test="gridCodeList !=null and gridCodeList.size()>0">
                                and jp.grid_code in
                                <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                            </when>
                            <otherwise>
                                and jp.grid_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                    <if test="placeCheck.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>
        order by jpc.create_time desc
    </select>
@@ -197,5 +267,131 @@
        </where>
    </select>
    <!--查询列表数据导出-->
    <select id="selectPlaceCheckListExcel" resultType="org.springblade.modules.place.excel.PlaceCheckExcel">
        SELECT
        jpc.*,
        jp.id jpid,
        jp.place_name,
        jp.location,
        jg.grid_name,
        jp.principal,
        jp.principal_phone,
        jp.nine_type,
        jp.is_nine,
        br.town_name as streetName,
        br.village_name as communityName,
        bu.`name`,
        jpe.legal_tel,
        jpe.legal_person
        FROM
        jczz_place_check jpc
        LEFT JOIN jczz_place jp ON jpc.house_code = jp.house_code and jp.is_deleted = 0
        LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
        LEFT JOIN blade_region br ON br.`code` = jg.community_code
        LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id and jpe.is_deleted = 0
        LEFT JOIN blade_user bu ON bu.id = jpc.create_user and bu.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        where jpc.is_deleted = 0
        <if test="placeCheck.houseCode!=null and placeCheck.houseCode!=''">
            and jpc.house_code = #{placeCheck.houseCode}
        </if>
        <if test="placeCheck.streetName!=null and placeCheck.streetName!=''">
            and br.town_name like concat('%', #{placeCheck.streetName},'%')
        </if>
        <if test="placeCheck.communityName!=null and placeCheck.communityName!=''">
            and br.village_name like concat('%', #{placeCheck.communityName},'%')
        </if>
        <if test="placeCheck.gridName!=null and placeCheck.gridName!=''">
            and jg.grid_name like concat('%', #{placeCheck.gridName},'%')
        </if>
        <if test="placeCheck.placeName!=null and placeCheck.placeName!=''">
            and jp.place_name like concat('%', #{placeCheck.placeName},'%')
        </if>
        <if test="placeCheck.principal!=null and placeCheck.principal!=''">
            and jp.principal like concat('%', #{placeCheck.principal},'%')
        </if>
        <if test="placeCheck.principalPhone!=null and placeCheck.principalPhone!=''">
            and jp.principal_phone like concat('%', #{placeCheck.principalPhone},'%')
        </if>
        <if test="nineTypeList!=null and nineTypeList.size()>0">
            and jp.nine_type in
            <foreach collection="nineTypeList" separator="," open="(" close=")" item="nineType">
                #{nineType}
            </foreach>
        </if>
        <if test="placeCheck.startTime!=null and placeCheck.startTime!=''">
            and date_format(jpc.create_time,'%Y-%m-%d') &gt;= #{placeCheck.startTime}
        </if>
        <if test="placeCheck.endTime!=null and placeCheck.endTime!=''">
            and date_format(jpc.create_time,'%Y-%m-%d') &lt;= #{placeCheck.endTime}
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="placeCheck.roleName != null and placeCheck.roleName != ''">
                    <if test="placeCheck.roleName=='wgy'">
                        <choose>
                            <when test="gridCodeList !=null and gridCodeList.size()>0">
                                and jp.grid_code in
                                <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                            </when>
                            <otherwise>
                                and jp.grid_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                    <if test="placeCheck.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>
        order by jpc.create_time desc
    </select>
</mapper>