广州市综治平台后端
zhouxiantao
9 days ago 93430938a25ab3d4e218a2198ae1b24a516f6382
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseTaskMapper.xml
@@ -408,7 +408,28 @@
                and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
            <if test="terms.status == 2">
                and t1.handle_result in (0, 1, 2)
@@ -548,7 +569,28 @@
                and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
        </if>
    </sql>
@@ -606,6 +648,10 @@
                and (DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createTimeStart}
                and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createTimeEnd})
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
@@ -614,6 +660,27 @@
            </if>
            <if test='terms.mediatorType != null and terms.mediatorType =="2"'>
                and t3.mediator_id is null
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
        </if>
    </sql>
@@ -882,4 +949,674 @@
    <update id="deleteCaseTaskByCaseId">
        update dyh_case_task set delete_status = 1,update_time = #{updateTime} where case_id = #{caseId}
    </update>
    <sql id="where-select-task-all">
        <if test="terms != null">
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
        </if>
    </sql>
    <sql id="select-task-all">
        SELECT
        t1.id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.create_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.handle_time as turnaroundTime,
        </if>
        t1.expire_time as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        '' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待分派' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已分派' as taskTypeName
        </if>
        FROM
        dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        (t1.node_id = 'ZJ_DFP' or  t1.node_id = 'QJ_DFP' or  t1.node_id = 'SJ_DFP' or  t1.node_id = 'DFP')
        and t1.case_task_type = 1
        and t2.delete_status = 0
        and t1.status = #{terms.status}
        <if test="terms.status != null and terms.status ==1">
            and t1.cande_unit_id = #{terms.candeUnitId}
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.handle_unit_id = #{terms.candeUnitId}
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT
        t1.id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.create_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.handle_time as turnaroundTime,
        </if>
        t1.expire_time as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        '' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待受理' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已受理' as taskTypeName
        </if>
        FROM
        dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        (t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id = 'DSL')
        and t2.delete_status = 0
        and t1.status = 1
        <if test="terms.status != null and terms.status ==1">
            and t1.cande_unit_id = #{terms.candeUnitId}
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.handle_unit_id = #{terms.candeUnitId}
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        <if test="terms.status != null and terms.status ==2">
            UNION ALL
            SELECT
            t1.case_task_id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
            t1.dis_time as turnaroundTime,
            null as timeLimit,
            t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
            concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
            (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
            '' as taskType,
            '不已受理' as taskTypeName
            FROM
            dyh_case_dismiss t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
            where t2.delete_status = 0
            and t1.dis_unit_id = #{terms.candeUnitId}
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <include refid="where-select-task-all"/>
        </if>
        <if test="terms.status != null and terms.status ==1">
            UNION ALL
            SELECT
            t1.id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
            t1.create_time as turnaroundTime,
            t1.expire_time as timeLimit,
            t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
            concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
            (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
            'sxbl' as taskType,
            '办理中' as taskTypeName
            FROM
            dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id
            left join dyh_case_info_unfold t3 on t1.case_id = t3.id
            where
            t1.node_id = 'BLFK'
            and t1.status = 1
            and t2.delete_status = 0
            and t1.cande_unit_id = #{terms.candeUnitId}
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <include refid="where-select-task-all"/>
            UNION ALL
            SELECT
            t1.case_task_id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
            t1.apply_time as turnaroundTime,
            null as timeLimit,
            t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
            concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
            (select count(1) from dyh_case_supervise where case_id = t2.id and sup_status = 0) as superviseCount,
            'sxbl' as taskType,
            '结案申请' as taskTypeName
            FROM dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id
            left join dyh_case_info_unfold t3 on t3.id = t2.id
            where
            t1.apply_status = 0
            and t2.delete_status = 0
            and (t1.apply_unit_id = #{terms.candeUnitId} or t3.assist_unit_id like concat('%', #{terms.candeUnitId}, '%'))
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <include refid="where-select-task-all"/>
        </if>
        <if test="terms.status != null and terms.status ==2">
            UNION ALL
            SELECT
            t3.case_task_id as ownerId, t1.id as caseId, t2.is_risk as isRisk,
            t2.close_time as turnaroundTime,
            null as timeLimit,
            t1.case_level as caseGrade, t1.canal_name as caseSource, concat_ws('', ifnull(t1.case_type_first_name, ''), '/' , ifnull(t1.case_type_name, '')) as caseType,
            concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) as defendants,
            (select count(1) from dyh_case_supervise where case_id = t1.id and sup_status = 0) as superviseCount,
            'sxbl' as taskType,
            '已结案' as taskTypeName
            from dyh_case_info t1
            left join dyh_case_info_unfold t2 on t1.id = t2.id
            left join dyh_case_windup_apply t3 on t1.id = t3.case_id
            where t1.process in (5, 6)
            and t1.delete_status = 0
            and (t2.mediate_unit_id = #{terms.candeUnitId} or t2.assist_unit_id like concat('%', #{terms.candeUnitId}, '%'))
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, ''), ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) like concat('%', #{terms.partyName}, '%') or t1.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t1.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t1.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t1.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t1.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t1.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t1.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t2.medi_result = #{terms.mediResult}
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
        </if>
        UNION ALL
        SELECT
        t1.case_task_id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.return_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.audit_time as turnaroundTime,
        </if>
        null as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs, concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        'htsh' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待审核' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已审核' as taskTypeName
        </if>
        FROM
        dyh_case_return t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.return_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.return_status = 1
        </if>
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.case_task_id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.appear_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.audit_time as turnaroundTime,
        </if>
        null as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs, concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        'sbsh' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待审核' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已审核' as taskTypeName
        </if>
        FROM
        dyh_case_appear t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.apply_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.apply_status = 1
        </if>
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.case_task_id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.apply_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.audit_time as turnaroundTime,
        </if>
        null as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource,
        concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType, concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        'jash' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待审核' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已审核' as taskTypeName
        </if>
        FROM
        dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.apply_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.apply_status = 1
        </if>
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.id as ownerId, t1.case_id as CaseId, t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.apply_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.audit_time as turnaroundTime,
        </if>
        null as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs, concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        'lhczsh' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待审核' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已审核' as taskTypeName
        </if>
        FROM
        dyh_case_assist_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.apply_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.apply_status = 1
        </if>
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.sup_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.reply_time as turnaroundTime,
        </if>
        DATEADD(hour, t1.reply_term, t1.sup_time) as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource,
        concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType, concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        0 as superviseCount,
        '' as taskType,
        '督办' as taskTypeName
        FROM
        dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.sup_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.sup_status = 1
        </if>
        and t1.quilt_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        <if test="terms.status != null and terms.status ==2">
            UNION ALL
            SELECT t1.id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
            t1.sup_time as turnaroundTime,
            DATEADD(hour, t1.reply_term, t1.sup_time) as timeLimit,
            t2.case_level as caseGrade, t2.canal_name as caseSource,
            concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType, concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
            0 as superviseCount,
            '' as taskType,
            '督办' as taskTypeName
            FROM
            dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
            where
            t1.delete_status = 0
            and t1.sup_unit_id = #{terms.candeUnitId}
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <include refid="where-select-task-all"/>
        </if>
    </sql>
    <select id="pageMyTaskAll" resultType="cn.huge.module.cases.domain.dto.FrontPageListAllDTO">
        select * from
        (<include refid="select-task-all"/>) t where 1=1
        order by isnull(t.turnaroundTime), t.turnaroundTime desc
        limit #{page.offset}, #{page.size}
    </select>
    <select id="countMyTaskAll" resultType="java.lang.Long">
        select count(1) from
        (<include refid="select-task-all"/>) t
    </select>
    <select id="countYbDispatch" resultType="java.lang.Long">
        select count(1) from
        (SELECT
        t1.id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        (t1.node_id = 'ZJ_DFP' or  t1.node_id = 'QJ_DFP' or  t1.node_id = 'SJ_DFP' or  t1.node_id = 'DFP')
        and t1.case_task_type = 1
        and t2.delete_status = 0
        and t1.status = #{terms.status}
        and t1.handle_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        ) t
    </select>
    <select id="countYbAccept" resultType="java.lang.Long">
        select count(1) from
        (SELECT
        t1.id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        (t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id = 'DSL')
        and t2.delete_status = 0
        and t1.status = 1
        and t1.handle_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT
        t1.case_task_id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_dismiss t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where t2.delete_status = 0
        and t1.dis_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        ) t
    </select>
    <select id="countYbClosed" resultType="java.lang.Long">
        select count(1) from
        (SELECT
        t3.case_task_id as ownerId, t1.id as caseId
        from dyh_case_info t1
        left join dyh_case_info_unfold t2 on t1.id = t2.id
        left join dyh_case_windup_apply t3 on t1.id = t3.case_id
        where t1.process in (5, 6)
        and t1.delete_status = 0
        and (t2.mediate_unit_id = #{terms.candeUnitId} or t2.assist_unit_id like concat('%', #{terms.candeUnitId}, '%'))
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, ''), ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) like concat('%', #{terms.partyName}, '%') or t1.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t1.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t1.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t1.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t1.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t1.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t1.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t2.medi_result = #{terms.mediResult}
        </if>
        ) t
    </select>
    <select id="countYbAudit" resultType="java.lang.Long">
        select count(1) from
        (
        SELECT
        t1.case_task_id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_return t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.return_status = 1
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.case_task_id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_appear t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.apply_status = 1
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.case_task_id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.apply_status = 1
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.id as ownerId, t1.case_id as CaseId
        FROM
        dyh_case_assist_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.apply_status = 1
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        ) t
    </select>
    <select id="countYbSupervise" resultType="java.lang.Long">
        select count(1) from
        (
        SELECT t1.id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.sup_status = 1
        and t1.quilt_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.sup_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        ) t
    </select>
</mapper>