linwei
2024-02-22 9269fc94626bd9ed8c6c3d9e021d37b22d86a665
src/main/java/org/springblade/modules/taskPlaceSelfCheck/mapper/TaskPlaceSelfCheckMapper.xml
@@ -36,7 +36,7 @@
        </collection>
    </resultMap>
    <!--自定义分页查询-->
    <select id="selectTaskPlaceSelfCheckPage" resultMap="taskPlaceSelfCheckResultMap">
        select jpc.*,
        jp.id jpid,
@@ -68,6 +68,13 @@
            </if>
            <if test="place.principal != null  and place.principal != ''">
                and jp.principal like concat('%', #{place.principal},'%')
            </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="place.remark != null  and place.remark != ''">and jpc.remark = #{place.remark}</if>
            <if test="place.updateTime != null ">and jpc.update_time = #{place.updateTime}</if>
@@ -337,4 +344,143 @@
            <if test="deleteFlag != null ">and delete_flag = #{deleteFlag}</if>
        </where>
    </select>
    <!--导出消防自查信息-->
    <select id="exportTaskPlaceSelfCheck" resultType="org.springblade.modules.taskPlaceSelfCheck.excel.TaskPlaceSelfCheckExcel">
        select
        jpc.id,
        case when jpc.status=1 then '待审核'
        when jpc.status=2 then '审核通过'
        when jpc.status=3 then '审核不通过'
        else '待完成' end as status,
        jpc.remark,
        jpc.create_time,
        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_task_place_self_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>
            <if test="place.id != null ">and jpc.id = #{place.id}</if>
            <if test="place.taskId != null ">and jpc.task_id = #{place.taskId}</if>
            <if test="place.taskName != null  and place.taskName != ''">and jpc.task_name = #{place.taskName}</if>
            <if test="place.placeName != null  and place.placeName != ''">
                and jp.place_name like concat('%', #{place.placeName},'%')
            </if>
            <if test="place.principal != null  and place.principal != ''">
                and jp.principal like concat('%', #{place.principal},'%')
            </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="place.remark != null  and place.remark != ''">and jpc.remark = #{place.remark}</if>
            <if test="place.updateTime != null ">and jpc.update_time = #{place.updateTime}</if>
            <if test="place.createTime != null ">and jpc.create_time = #{place.createTime}</if>
            <if test="place.houseCode != null  and place.houseCode != ''">and jpc.house_code = #{place.houseCode}</if>
            <if test="place.rectificationEndTime != null ">and jpc.rectification_end_time =
                #{place.rectificationEndTime}
            </if>
            <if test="place.rectificationCompleteTime != null ">and jpc.rectification_complete_time =
                #{place.rectificationCompleteTime}
            </if>
            <if test="place.rectificationFlag != null ">and jpc.rectification_flag = #{place.rectificationFlag}</if>
            <if test="place.policeStation != null  and place.policeStation != ''">and jpc.police_station =
                #{place.policeStation}
            </if>
            <if test="place.rectificationNoticeImgUrl != null  and place.rectificationNoticeImgUrl != ''">and
                jpc.rectification_notice_img_url = #{place.rectificationNoticeImgUrl}
            </if>
            <if test="place.signaturePath != null  and place.signaturePath != ''">and jpc.signature_path =
                #{place.signaturePath}
            </if>
            <if test="place.streetName!=null and place.streetName!=''">
                and br.town_name like concat('%', #{place.streetName},'%')
            </if>
            <if test="place.communityName!=null and place.communityName!=''">
                and br.village_name like concat('%', #{place.communityName},'%')
            </if>
            <if test="place.gridName!=null and place.gridName!=''">
                and jg.grid_name like concat('%', #{place.gridName},'%')
            </if>
            <if test="place.createUser != null ">and jpc.create_user = #{place.createUser}</if>
            <if test="place.imageUrls != null  and place.imageUrls != ''">and jpc.image_urls = #{place.imageUrls}</if>
            <if test="place.status != null ">and jpc.status = #{place.status}</if>
            <if test="place.deleteFlag != null ">and jpc.delete_flag = #{place.deleteFlag}</if>
            <if test="isAdministrator==2">
                <choose>
                    <when test="place.roleName != null and place.roleName != ''">
                        <if test="place.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="place.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>
                            </otherwise>
                        </choose>
                    </otherwise>
                </choose>
            </if>
        </where>
    </select>
</mapper>