linwe
2024-09-03 764d883b5ea3bdc06abbec548b6df0511e567978
src/main/java/org/springblade/modules/disputeRecord/mapper/DisputeRecordMapper.xml
@@ -85,10 +85,10 @@
            and jdr.id_card_two like concat('%',#{disputeRecord.idCardTwo},'%')
        </if>
        <if test="disputeRecord.startTime != null and disputeRecord.startTime != ''">
            and date_format(jdr.create_time,'%Y-%m-%d') &gt;= #{disputeRecord.startTime}
            and date_format(jdr.event_time,'%Y-%m-%d') &gt;= #{disputeRecord.startTime}
        </if>
        <if test="disputeRecord.endTime != null and disputeRecord.endTime != ''">
            and date_format(jdr.create_time,'%Y-%m-%d') &lt;= #{disputeRecord.endTime}
            and date_format(jdr.event_time,'%Y-%m-%d') &lt;= #{disputeRecord.endTime}
        </if>
        <if test="disputeRecord.searchKey!=null and disputeRecord.searchKey!=''">
            and CONCAT(
@@ -221,5 +221,158 @@
        </if>
    </select>
    <!--导出矛盾纠纷记录表-->
    <select id="exportDisputeRecordList" resultType="org.springblade.modules.disputeRecord.excel.ExportDisputeRecordExcel">
        select
        jdr.address,
        jdr.event_time,
        jdr.name_one,
        case when jdr.gender_one =1 then '男'
        when jdr.gender_one=2 then '女'
        end as gender_one,
        jdr.phone_one,
        jdr.id_card_one,
        jdr.name_two,
        case when jdr.gender_two =1 then '男'
        when jdr.gender_two=2 then '女'
        end as gender_two,
        jdr.phone_two,
        jdr.id_card_two,
        jdr.dispute_type,
        jdr.dispute_content,
        case when jdr.injury_flag=1 then '是'
        when jdr.injury_flag=0 then '否'
        end as injury_flag,
        jdr.injury_desc,
        jdr.alarm_num,
        jdr.source,
        case when jdr.handle_result=1 then '已化解'
        when jdr.handle_result=2 then '未化解'
        when jdr.handle_result=3 then '移送e呼即办'
        end as handle_result,
        br.town_name as townName,
        br.name as communityName,
        jpag.pcs_name pcsName
        from jczz_dispute_record jdr
        LEFT JOIN jczz_grid jg on jg.grid_code = jdr.grid_code and jg.is_deleted = 0
        LEFT JOIN jczz_police_affairs_grid jpag on jdr.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
        LEFT JOIN blade_region br on br.code = jpag.community_code
        where jdr.is_deleted = 0
        <if test="disputeRecord.disputeType != null">
            and jdr.dispute_type = #{disputeRecord.disputeType}
        </if>
        <if test="disputeRecord.injuryFlag != null">
            and jdr.injury_flag = #{disputeRecord.injuryFlag}
        </if>
        <if test="disputeRecord.source != null">
            and jdr.source = #{disputeRecord.source}
        </if>
        <if test="disputeRecord.townName != null and disputeRecord.townName != ''">
            and br.town_name like concat('%',#{disputeRecord.townName},'%')
        </if>
        <if test="disputeRecord.communityName != null and disputeRecord.communityName != ''">
            and jbr.name like concat('%',#{disputeRecord.communityName},'%')
        </if>
        <if test="disputeRecord.pcsName != null and disputeRecord.pcsName != ''">
            and jpag.pcs_name like concat('%',#{disputeRecord.pcsName},'%')
        </if>
        <if test="disputeRecord.address != null and disputeRecord.address != ''">
            and jdr.address like concat('%',#{disputeRecord.address},'%')
        </if>
        <if test="disputeRecord.disputeContent != null and disputeRecord.disputeContent != ''">
            and jdr.dispute_content like concat('%',#{disputeRecord.disputeContent},'%')
        </if>
        <if test="disputeRecord.nameOne != null and disputeRecord.nameOne != ''">
            and jdr.name_one like concat('%',#{disputeRecord.nameOne},'%')
        </if>
        <if test="disputeRecord.phoneOne != null and disputeRecord.phoneOne != ''">
            and jdr.phone_one like concat('%',#{disputeRecord.phoneOne},'%')
        </if>
        <if test="disputeRecord.idCardOne != null and disputeRecord.idCardOne != ''">
            and jdr.id_card_one like concat('%',#{disputeRecord.idCardOne},'%')
        </if>
        <if test="disputeRecord.nameTwo != null and disputeRecord.nameTwo != ''">
            and jdr.name_two like concat('%',#{disputeRecord.nameTwo},'%')
        </if>
        <if test="disputeRecord.phoneTwo != null and disputeRecord.phoneTwo != ''">
            and jdr.phone_two like concat('%',#{disputeRecord.phoneOne},'%')
        </if>
        <if test="disputeRecord.idCardTwo != null and disputeRecord.idCardTwo != ''">
            and jdr.id_card_two like concat('%',#{disputeRecord.idCardTwo},'%')
        </if>
        <if test="disputeRecord.startTime != null and disputeRecord.startTime != ''">
            and date_format(jdr.event_time,'%Y-%m-%d') &gt;= #{disputeRecord.startTime}
        </if>
        <if test="disputeRecord.endTime != null and disputeRecord.endTime != ''">
            and date_format(jdr.event_time,'%Y-%m-%d') &lt;= #{disputeRecord.endTime}
        </if>
        <if test="disputeRecord.searchKey!=null and disputeRecord.searchKey!=''">
            and CONCAT(
            ifnull(jdr.name_one,''),
            ifnull(jdr.phone_one,''),
            ifnull(jdr.name_two,''),
            ifnull(jdr.phone_two,''),
            ifnull(jdr.address,''),
            ifnull(jdr.dispute_content,'')
            ) like CONCAT ('%', #{disputeRecord.searchKey},'%')
        </if>
        <if test="isAdministrator==2">
            <choose>
                <when test="disputeRecord.roleName != null and disputeRecord.roleName != ''">
                    <if test="disputeRecord.roleName=='wgy'">
                        <choose>
                            <when test="gridCodeList !=null and gridCodeList.size()>0">
                                and jg.grid_code in
                                <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
                                    #{code}
                                </foreach>
                            </when>
                            <otherwise>
                                and jg.grid_code in ('')
                            </otherwise>
                        </choose>
                    </if>
                    <if test="disputeRecord.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 jdr.id desc,jdr.create_time desc
    </select>
</mapper>